5.6 Server Configuration

Config: server id { ... }
 
server id {
  enable bool;
  host string;
  timeout number;
  retries number;
  community string;
  expression expr;
  variable name oid;
  constant name value;
  macro name expansion;
  assert oid op pattern;
}

Creates a new entry in the database of monitored servers. The id parameter supplies the server identifier, an arbitrary string which will be used in log messages related to that server. Its value is also available in output format string as format specifier ‘%i’ (see section Output Format String).

Other parameters of the server are defined in the substatements, as described below.

Config: server: enable bool

If bool is ‘no’, this server is disabled, i.e. it is not polled nor taken account of in load calculations. Use this statement if you want to temporarily disable a server.

Config: server: host string

Sets the IP address (or hostname) of this server.

Config: server: timeout number

Sets the timeout for SNMP requests to that server.

Config: server: retries number

Sets the maximum number of retries for that server, after which a timeout is reported.

Config: server: community string

Sets SNMP community.

Config: server: expression string

Defines load estimation function for this server. See section Expression, for a description of the syntax of string. If this statement is absent, the default expression will be used (see default-expression). If it is not declared as well, an error is reported.

Config: server: variable name oid

Defines a variable name to have the value returned by oid. The latter must return a numeric value.

Any occurrence of name in the expression (as defined in the ‘expression’ statement) is replaced with this value.

Config: server: constant name number

Defines a constant name to have the value returned by oid.

Notice that expression variables and constants share the same namespace, therefore it is an error to have both a ‘variable’ and a ‘constant’ statement defining the same name.

Config: server: macro name expansion

Defines a macro name to expand to expansion. Macros allow to customize output formats on a per-server basis. See macro.

Config: server: assert oid op pattern

Ensures that the value of SNMP variable oid matches pattern. The type of match is given by the op argument:

eq

The value must match pattern exactly.

ne

The value must not match pattern.

If the assertion fails, the server is excluded from the load table.

Use this statement to ensure that a variable used in the computation refers to a correct entity. For example, if your expression refers to ‘IF-MIB::ifInOctets.3’ (number of input octets on network interface 3), it would be wise to ensure that the 3rd row refers to the interface in question (say ‘eth1’):

 
assert "IF-MIB::ifDescr.3" eq "STRING: eth1";

Notice, that pattern must include the data type.