Netmond V2. Method directive


The Method directive defines the part of object's monitoring algorithm. It defines the way to check object's characteristics.
The result of such checking is object's status information. Some useful statistics information can be mined and saved to object's variables in polling process.

Being used in global context, Method directive only declare algorithm, parameters and method name. This method name can be used late in configuration file many times in objects definitions, possibly with different arguments, to refer to above-mentioned method.
Also, method can be fully declared inside object definition block.

Polling method inherit default Polling, Timeout and Retries parameters from global level variables.

Netmond have a number of predefined polling methods - you don't need to declare it. These methods can be called inside object definition by their names without quotes, possibly with some arguments.

Directive may appear in three forms:

  1. Method "name" {
    ( TCP | UDP ) Port port
    [ LocalPort min_port [ max_port ] ]
    [ Address "address" ]
    [ Timeout seconds ]
    [ Retries counter ]
    [ ChatScript {
    [ Send "string" ] ...
    [ Expect "regex" [ { $Variable ... } ] ] ...
    } ]
    }
    Declare TCP or UDP polling method and define its parameters:
    name
    The unique method name.
    port
    Remote port number.
    min_port è max_port
    Local ports range. For example, to use remote shell -like interaction it has to be from 512 to 1023.
    address
    Remote host address. Used when target service can be accessed via proxy only.
    seconds
    Time to wait for reply, seconds See also Timeout.
    counter
    The number of retries in one session. See also Retries.
    string
    String constant to send. It may be empty - nothing is sending. Special characters possible in this string.
    regex
    Expected response regex(3) - formatted mask. It may be empty.
    Variable
    Reference to variable name, to save taken value. Value is extracted from reply message by regex matching. This is parent level variable. It may be new variable, or earlier declared variable.

    String è regex parameters may have references to arguments. These arguments are substituted in configuration parsing time. This references look like $0..$9, where $0 is a method name, $1 is a first word in argument string, etc.

  2. Method "name" {
    ICMP
    [ Size bytes ]
    [ Send packets [ Expect packets ] ]
    [ Timeout seconds ]
    [ Retries counter ]
    }
    Declare ICMP-echo polling method with parameters:
    name
    The unique method name.
    bytes
    Packets size.
    packets
    Number of packets to send. Default = 0.
    seconds
    Time to wait for response packet. See also Timeout.
    counter
    The number of retries in one session. See also Retries.

    While ICMP method executing, sequence of the Send number of ICMP-echo packets issued. Each packet has Size bytes length. Object became UP only when Expect reply packets received. By default, Expect is equal to Send. If Send is equal to 0, object state became UP.

    If received packets number less then expected, cycle repeat count times.
    Execution results are stored in variables whose name equal to method name:

    $name
    Average response time, milliseconds, float.
    $name.send
    Number of sent packets.
    $name.recv
    Number of received packets.

    ICMP method doesn't use Record Route option. Use built-in Ping method for topology building.

  3. Method ( Ping | Router | SNMP | DNS | Radius | Tacacs | "name" ) [ "arguments" ]
    Binding of polling method to object. This form of directive can be used only inside object declaration block. New variable appear whose name equal to method name. This variable store diagnostic message of last method execution.
    name
    Reference to early declared polling method.
    arguments
    Arguments string. Arguments separated each other with blanks and numbered from 1 to 9, 0 - method name.

    Following Netmond built-in polling methods exist:

    Ping
    ICMP-echo request with Record Route option. Method used for object status checking (UP èëè DOWN), response time measuring, and topology building. Variable $PING store response time in milliseconds.
    Attention: Some devices and OSes can't maintain ICMP-echo Record Route option properly. Use ping -R utility to investigate this.
    Router
    This is complex SNMP v1 object polling with SNMP tables indexing. Method used to poll predefined SNMP variables on an object having Interfaces, BGP sessions and thermal probes Env Temp. This way subobjects status checked, traffic counters gathered, temperature values gathered and so on. Method store object's SNMP variables $sysObjID, $sysUpTime $sysName. If used on a Cisco device $ciscoFreeMem, $ciscoAvgBusy and $ciscoWhyReload values stored too.
    Method accepts only one argument - SNMP-Community string. Default community - "public".
    SNMP
    Simple SNMP v1 Get request. Method used to gather arbitrary object's SNMP variables, for example:
    $sysContact 1.3.6.1.2.1.1.4.0
    $sysLocation 1.3.6.1.2.1.1.6.0
    Method SNMP "community" { $sysContact $sysLocation }
    DNS
    Standard DNS query. Method used to check DNS service and to check specified domain zone SOA record authority. Argument is a domain name to check. If no argument specified A record for zone "." requested. (root servers list).
    Variable $DNS store diagnostic string.
    Radius
    Simple Radius authentication request. Method used to check AAA server status. Method request Service-Type = Authenticate-Only for netmon username with argument as a password. ( Server's secret key is the same.)
    Both return codes - Access-Accept and Access-Reject is valid - if server replies something meaningful - it working( UP). Variable $RADIUS store diagnostic string, from attributes that server return. If none answer received, server is DOWN.
    Tacacs
    Simple Tacacs authentication request. Works like Radiusmethod; PAP-Authentication requested. If no arguments specified, tcp connection checked only. Variable $TACACS store diagnostic string.

Object's methods linked to a list the same order it appear in configuration file. The number of methods not limited, but total execution time for all methods have to be less them Polling interval for this object.


See also:
Object directive
Regular expression (regex)
Object inquiring using Remote Shell example

© 1998-2002, Rinet Software