...
For string variables you have to provide quotes in your expression, e.g.
Code Block calculate => 'CVAR1=somestringthing; return 42 if ("$CVAR1" eq "online");'
- Numeric variables can be used straight without quotes.
How to keep temporary CVAR data out of the RRD databases
As outlined above all the objects that you want to access via CVAR
s must be defined in the same section. If your test/calculate expression is within an rrd
section, all the other objects will have to be within that rrd
section, too, and thus they would be collected by NMIS and stored in RRD - quite wasteful if these other variables are just temporary and only there to for access using one CVAR
expression.
In versions 8.6.0 and above you can prevent this by adding an option
with value nosave
:
Code Block |
---|
'snmp' => {
'hrNumUsers' => {
'oid' => 'hrSystemNumUsers',
'option' => 'nosave',
}, |
In the example above, hrNumUsers
would be retrieved with SNMP, and other variables could be defined in terms of e.g. CVAR3=hrNumUsers
, but hrNumUsers
would not be saved.
Please note that setting nosave
disables alerts for the given object.