|
Netmond V2. Save directive
The Save directive defines the part of object's data storing
algorithm. It defines the way to export internal data to outside world,
the way of online analysis of internal variables and
conditional data storing.
Being used in global context, Save directive only declare data
store mode, 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, saving method can be fully declared inside object definition block.
Netmond have a number of built-in saving methods - you don't need to declare it.
These methods can be called inside object definition by their name without quotes
and without arguments.
Directive may appear in two forms:
- Save "name" {
- ( File | Pipe | Exec )
"file"
- [ Data "format" ]
- [ State "format" ]
- [ When "evaluate" seconds
[ "format" ] ]
- }
- Declare saving method and define its parameters.
- name
- Unique saving method name.
- file
- File name data to write.
Strftime(3) macroses can be used here.
If filename is not absolute path, Netmond will look up it in parent object
directory.
With Pipe or Exec it will executed as
/bin/sh -c file.
- format
- Output string format. Internal variables names may be used in this
string. At method evaluation time, this names will replaced with variables values.
If some variable don't exist, its name will passed as is, without any substitution.
- evaluate
- Conditional expression string. Internal variables names may be used in this
string. At method evaluation time, this names will replaced with variables values.
If some variable don't exist, its name will passed as is, without any substitution.
Resulting string processed by calculator to
evaluate final logical value. The real data storing takes place if conditional expression
is evaluated as "true" (non-zero) during seconds time interval.
- seconds
- Delay interval, during witch evaluate conditional expression must be evaluated
as "true" to save data. Zero value mean - no delay, data saving take place just conditional
expression evaluated as "true".
Three data saving modes exist:
- File
- Write data to plain text file. New data is appended to end of file string by string.
If specified file does not exist, Netmond create it.
If Netmond compiled with POSIX Threads, data storing take place
asynchronously, in separate thread.
- Pipe
- Write data to pipe. Specified file is launched as external program
with vfork(2),execve(2) syscalls, so its STDIN is connected as
receiving side for this pipe. Asynchronous data transfer take place.
If Netmond compiled with POSIX Threads, data storing take place
in separate thread.
- Exec
- Specified file is launched as external program
with vfork(2),execve(2) syscalls, with arguments, consisting of data to store.
Asynchronous data transfer take place.
If Netmond compiled with POSIX Threads, data storing take place
in separate thread.
Data, State and When can
appear together in saving method definition in any combination:
- Data
- This data stored periodically, once per parent object's
Saving interval.
If Saving period is a number divisible by
Polling interval, data saving take place
after corresponding polling cycle. Otherwise Saving takes place
independently from Polling.
- State
- This data stored when parent object's state changes.
This can happen immediately during polling cycle or when corresponding trap received.
- When
- This data stored when specified conditional expression evaluate
is evaluated as "true" (non-zero) during seconds time interval.
Format strings in Save directive definition may have
references to arguments. These arguments are substituted in configuration
parsing time. This references look like $0..$9, where $0 is
a saving method name, $1 is a first word in argument string, etc.
- Save
( Router | Interface | BGP |
Temp | "name" ) [ "arguments" ]
- Binding of saving method to object. This form of directive can be
used only inside object declaration block.
- name
- Reference to early declared saving method.
- arguments
- Arguments string. Arguments separated each other with blanks and
numbered from 1 to 9; 0 - method name.
Following Netmond built-in saving methods exist:
- Router
- Once per Saving interval store values
- "$time $sysUpTime $ifNumber $ciscoFreeMem.ave $ciscoAvgBusy.ave"
to file "%Y.%m.%d".
- Additionally, when parent object's status changes, store values
- "$time $state $ciscoWhyReload" to the same file.
- Interface
- Once per Saving interval store values
- "$time $ifInOctets.delta $ifOutOctets.delta $ifInUcastPkts.delta
$ifOutUcastPkts.delta $ifInDrops.delta $ifOutDrops.delta $ifInErrors.delta
$ifOutErrors.delta" to file "%Y.%m.%d".
- Additionally, when parent interface status changes, store values:
- "$time $state $ciscoIfReason" to the same file.
- Conditionally, if "$ifSpeed.old && $ifSpeed != $ifSpeed.old",
store values
- "$time BW $ifSpeed.old -> $ifSpeed" to the same file.
- BGP
- Store values
- "$time $name $state"
to file "%Y.%m.%d"
when BGP peer status changes.
- Temp
- Store values
- "$time $name $state $ciscoEnvTempValue"
to file "%Y.%m.%d" when
thermal probe's temperature value changes.
Object's saving methods linked to a list the same order it appear in configuration
file. The number of methods not limited.
See also:
Date and time representation (strftime)
Evaluated expression (calculator)
Network interfaces statistic accumulation
© 1998-2002, Rinet Software
|