CustoSec:Check SNMP Calculation

From CustosecWiki
Jump to navigation Jump to search
caption
Basic Information on Check
Name of Check SNMP-Calculation Technical Name check_snmp_calc
Available in Standard Number of Arguments 9
From Version ARANSEC 2 Compability All ARANSEC and CustoSec



Scope of Check

A very powerful check to calculate a value to be monitored on the basis of multiple OID's via a standard arithmetical formula (Perl's standard arithmetic is supported). The check allows to do almost everything with numeric OID's and therefore is a very powerful check for special needs.

Please note, that this check has been enhanced as of Version 2.42 (ARANSEC) and 3.0 (CustoSec).

  • It has got an additional argument (Unit of Measure) and
  • it displays the lower limits as well.
  • Additionally it now supports constants with more than one decimal in the formula (see below).

Requirements

For the check to work properly the following requirements must be met:

  • The check is configured as a service check on the target host that should be monitored
  • SNMP must be activated on the target host (read only and a community name; It is also recommended to allow only the ARANSEC/CustoSec IP-Address to read SNMP information on the host). SNMP can easily be checked by starting a second session in a second browser tab and do a SNMP-Walk from ARANSEC's SNMP-Walk function (bottom entry in the left hand menu).
  • When working with OID's it might prove useful to have an explanation on individual OID's at hand. A good resource for this is i.e. the OID Repository where more information on OID's can be found.
  • The value returned from the SNMP queries is expected as unsigned integer.


Arguments

To configure the check, the following arguments are available:

Argument No. Argument Name Allowed Arguments Explanation Examples
Arg1 snmp-community string Community name for the SNMP agent. It is strongly recommended to change the default community on most systems from "public" to something like "aransec".
Must be entered or check cannot find OID.
custosec
Arg2 port string Port number of the snmp-service on the particular host. Default is 161. Must be entered or check cannot find the OID. 161
Arg3 OID-list string List of Object Identifier(s) or SNMP variable(s) that are to be monitored. Those can be obtained either by doing a SNMP-Walk on the target system or a search within MIB-Databases.
Must be entered or check will time out.
OID's (or SNMP Variables) must be separated by the pipe character "|".
hrStorageUsed.1 | 1.3.6.1.2.1.25.2.3.1.6.1
Arg4 Formula string Formula to calculate the result (see below) sqrt(x1 + x2 + x3)
Arg5 Lower Critical integer
(no ranges)
Lower critical threshold. (see below)
Must be entered or the check will return "malformed arguments". If lower thresholds are not needed, they can be given as negative or 0. Decimals are allowed.
Must be lower than "Lower Warning" (Argument 6)
-2.4
Arg6 Lower Warning integer
(no ranges)
Lower warning threshold. (see below)
Must be entered or the check will return "malformed arguments". If lower thresholds are not needed, they can be given as negative or 0. Decimals are allowed.
Must be lower than "Upper Warning" (Argument 7)
10
Arg7 Upper Warning integer
(no ranges)
Upper warning threshold. (see below)
Must be entered or the check will return "malformed arguments". If lower thresholds are not needed, they can be given as negative or 0. Decimals are allowed.
Must be lower than "Upper Critical" (Argument 8)
30.5
Arg8 Upper Critical integer
(no ranges)
Upper critical threshold. (see below) 40.888
Arg9 Unit of Measure
(new in 2.42)
string This is an optional setting. Default is ""; Unit of Measure to be added in the return string %


The Formula

A formula consists of the following elements:

  • Operators: "+", "-", "*", "/", "%" (Modulo), "**" (Power)
  • Constants: Any natural or floating point numbers.
  • Variables: Are used as placeholders for the results queried by the OID's. A variable name is a "x" followed by the index number of the OID in the list (Argument 3). First OID = x1, second OID = x2, ..., n OID = xn
  • Brackets: Round brackets are allowed.
  • Functions: The following functions are supported by the check:
       abs(xn) = Absolute value.
       cos(xn) = Cosine.
       exp(xn) = Natural exponent e^x for any base use ** (n**x = n^x).
       log(xn) = Natural logarithm ln(x).
       sin(xn) = Sine. sqrt(xn) = Square root xn must be positive.


Rounding (new in ARANSEC 2.50 /CustoSec 3.0)

Rounding: A function for rounding the result of the calculation. The rounding function is used outside the formula, the formula being an argument of the rounding function.

  Syntax: round(Formula,x) - where "x" is the number of decimal places to display in the result. 
  Note: Round "half to even" - method is used. (e.g. 1.5 = 2)

The Thresholds

caption

The check provides the possibility to have a lower and an upper threshold range. These Arguments have to be given. They can be negative and have decimals (with a "." (dot) as separator!).

The OK-area is between the lower warning threshold and the upper warning threshold.

If no lower threshold is needed, lower critical can be set to i.e. -2 and lower warn can be -1. The same applies to the higher thresholds.

So, if i.e. a check is to be configured to calculate the charging level of an ink cartridge in a printer. This can be done by dividing the OID (actual filling level) by the OID (maximum filling level). The result is a percentage and you want the lower limits to apply as this percentage is coming down. The higher thresholds are simply set to 1.1 and 1.2 which is above 1 and will clearly never be the result of the calculation.


Examples

The following examples should explain the usage of the check and how the arguments should be entered in ARANSEC.
(Please Note: Pipe Character in the fields of this table divide different options. Exception: Within the "Output" lines in the "Output" field, the pipe character is real and shows the division between the checks output and the checks performance data)

Example Description Output
!custosec!161!hrStorageUsed.2|hrStorageUsed.3|hrStorageUsed.4! (x1+x2+x3)!-2!-1!20000000!40000000 On a remote system, the used storage on 3 HDD's is queried using the OID "hrStorageUsed.x". SNMP-community on this system is "custosec"; The check will go into "WARNING" status, if the used storage space (represented in units, according to hrStorageAllocationUnits. Read more in the notes to the SNMP-Standard check) is greater than 20.000.000 Units and it will go into "CRITICAL" status when more than 40.000.000 Units are used. Status: OK
Output: OK: Result: 18260783 |value=18260783;20000000;40000000;
!custosec!161!hrStorageUsed.2|hrStorageUsed.3|hrStorageUsed.4! (x1+x2+x3)/3!-2!-1!20000000!40000000 Same as above, but this time the average used storage is calculated. Status: OK
Output: OK: Result: 6086931 |value=6086931;20000000;40000000;
!public!161!1.3.6.1.2.1.43.11.1.1.9.1.2|1.3.6.1.2.1.43.11.1.1.8.1.2! (x1/x2)!0.10!0.25!1.1!1.2 This time we check the filling state of a printer cartridge. The first OID shows the actual filling level of the cartridge, the second the maximum filling level. The calculation divides the actual filling by the maximum level. The result will be a percentage (like 0.794274809160305 which represents almost 80%)
This time we only use the lower thresholds. The upper thresholds are set to above 1 which means, they will never come into effect.
Status: OK
Output: OK: Result: 0.794274809160305 |value=0.794274809160305;1.1;1.2;
!public!161!1.3.6.1.2.1.43.11.1.1.9.1.2|1.3.6.1.2.1.43.11.1.1.8.1.2! round((x1/x2)*100,2)!10!25!110!120! % Cyan As of Ver. 2.42
This time we check the filling state of a printer cartridge (Cyan). It is the same example as above, but we use the new possibilities of the check
* The calculation again divides the actual filling by the maximum level. The result would be a percentage (like 0.794274809160305 which represents almost 80%)
* This time we multiply the result with 100 to get a nice percentage
* By using the new round - function, we normalize the result to 2 decimals
* And we add a Unit of Measure (new 9th argument) to make it more understandable
* The thresholds are the same as above
Status: OK
Output: OK: Result: 79.83% Cyan |value=79.83% Cyan;25:150;10:200

Please note the upper and lower thresholds being displayed as of now, which is useful in ReportBase

Notes

  • Please note, that decimals for thresholds must be entered with a "." (dot), not a "," (comma) as the decimal point.

Known Issues

  • There is a problem with this check when the result is in the lower critical range. In certain circumstances the check delivers a "9" in the status field (where normally you find OK, WARNING, CRITICAL or UNKNOWN). This has also been fixed in Version ARANSEC 2.50 and CustoSec 3.0
  • The check only returns the upper warn and critical threshold in the response string. The lower thresholds are not displayed. This has been changed in ARANSEC Version 2.50 / CustoSec 3.0. If needed please update your system.
  • This check does not support "ranges" for "Warn" and "Critical" arguments like "lower threshold: 120:". As of Version ARANSEC 2.50 / CustoSec 3.0 ranges are supported as well.