Netmond V2. NetState serviceThe
NetState service is a special
built-in mechanism to provide actual real-time network status information.
Basic algorithm and conventionsNetState service protocol is a classical text-based session oriented
client-server protocol. Client connects to NetState TCP port, send requests
and receive answer messages. Multiple requests possible in the same session.
Client function are:
Server functions are:
Server listen specified TCP port forever. Client connects this TCP port when needed. Server check client address against their access list. If client unauthorized, server close session. Otherwise server send greeting message and wait for client request. Client send request and waiting for answer. Server parses and process request and reply answer. This can happen multiple times, until client close session, activity timeout elapsed, or error takes place. NetState protocol request is a single string consisting of a number of keywords and a mandatory argument. Syntax conventions are:
Client and server waiting for peer side message until Timeout elapsed. Client has to send next request when server readiness string appear. NetState protocol answer is a multistring message. Answer consists of number of status strings, and a number of meaningful data strings. Syntax conventions for answer are:
If requested data not found, data strings are absent in server answer. But context switch flags may present. This way user can calculate total monitored objects count, and total objects types available. with current Netmond configuration Client close session with special command QUIT without arguments.
Object typesData is grouping by objects types in a NetState server answer. Following object types possible:
NetState protocol objects types strictly correspond to Netmond types. NetState can have and report more object types then client expect. So, client has to be ready to ignore such a data strings. NetState server reports error when client request unknown object type data. Client-side commandsClient-side NetState protocol commands consist of:
NetState protocol request is a single string consisting of a number of keywords and a mandatory argument. Request components are separated each other with any number of blanks. The total request string length is up to 1024 chars. Letter case in keywords ignored. Argument is a REGEX statement; letter case is taking into account. Modifiers are optional. Following modifiers are possible now:
Command is a requested object's type keyword or an ANY keyword, matching any type of objects. So commands are:
The only QUIT command has no modifiers and arguments. Argument is a REGEX statement. This mask filters requested objects names and variable - only matched variables reported to client. This is sample client-side command: Here Old - is a modifier, Any - is a command, and .* - is an argument. NetState server will return previous values for all known variables, for all objects. Returning dataObject type keywords used in requests also used as an object type switches in replies. NetState server return
variables whose name matched with REGEX and variable's parent object type match
command keyword.
Object type switches return for each object of this type all the time, even if no
variables matched with REGEX.
Data reported as text string. String consist of full variable name and their value, separated with "=" sign: Full variable name is a full hierarchy path. Hierarchy nodes names are separated with exclamation sign !. Variable value can be integer, float or a quoted string, for example "No error". Special untypified value Unused reported if variable is not yet evaluated. Current variables values are reported for request without modifiers. Previous variables values are reported for request with OLD modifier. Single ! followed by CRLF is an "end of answer" flag. Simple session exampleHere is simple NetState session example. Server replies marked by "S:" prefix, client's requests marked by "C:" prefix: netmon:bob:~/work> telnet localhost 3333 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. S: NetState server ready (timeout 30 sec.) S: ! C: interface Octets S: !INTERFACE S: host-1!Serial0/0!ifInOctets = 2345522619 S: host-1!Serial0/0!ifOutOctets = 2566982883 S: !INTERFACE S: host-1!Serial0/2!ifInOctets = 3272028327 S: host-1!Serial0/2!ifOutOctets = 1026741022 S: ! C: interface REPLY S: !INTERFACE S: host-1!Serial0/0!REPLYTIME = 948284131 S: !INTERFACE S: host-1!Serial0/2!REPLYTIME = 948284131 S: ! C: old interface Octets S: !INTERFACE S: host-1!Serial0/0!ifInOctets = 2345415173 S: host-1!Serial0/0!ifOutOctets = 2566644924 S: !INTERFACE S: host-1!Serial0/2!ifInOctets = 3271986926 S: host-1!Serial0/2!ifOutOctets = 1025637499 S: ! C: old interface REPLY S: !INTERFACE S: host-1!Serial0/0!REPLYTIME = 948284101 S: !INTERFACE S: host-1!Serial0/2!REPLYTIME = 948284101 S: ! C: quit Connection closed by foreign host. See also: © 1998-2002, Rinet Software
|