/var/lib/mrtg v/s /usr/local/nagios/share/perfdata

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
zaji_nms
Posts: 616
Joined: Tue Oct 16, 2012 12:28 am

/var/lib/mrtg v/s /usr/local/nagios/share/perfdata

Post by zaji_nms »

Dear Expert

while I was comparing my result
/var/lib/mrtg RRD file is simply giving the result in BYTES (if I am wrong, please correct me) then upto the user to convert it to K, M, G

rrdtool graph dummy -s20190101 -e20190201 DEF:test=/varlibmrtg/router-3750-1_10001.rrd:ds0:MAX PRINT:test:MAX:'Max - %.3lf'
Max - 1209984.202

rrdtool graph dummy -s20190101 -e20190201 DEF:test=/usrlocnagshareperf/router_3750_1_fast1_0_1_Bandwidth.rrd:1:MAX PRINT:test:MAX:'Max - %.3lf'
Max - 9.717

if me correct that /var/lib/mrtg simple giving result in BYTES, then how to know /usr/local/nagios/share/perfdata/HOST/SERVICE giving result in B,K,M or G without taking help of any other file (xml).

Regards
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: /var/lib/mrtg v/s /usr/local/nagios/share/perfdata

Post by ssax »

Correct, RRDs in /var/lib/mrtg are bytes (or octets).

Please see this architecture KB article for a better understanding:

Code: Select all

https://support.nagios.com/kb/article/nagios-xi-switch-and-router-wizard-architecture-62.html
So essentially MRTG runs on cron job every 5 minutes, queries the devices, and builds or updates the RRD files in /var/lib/mrtg, these are generally returned from the device in octets (which is essentially a byte).

Then when your bandwidth service checks, it uses a different plugin which you pass the B, K, M or G into that reads the MRTG RRDs in /var/lib/mrtg and coverts the output into the desired Unit:

Code: Select all

check_xi_service_mrtgtraf!192.168.X.X_5179.rrd!50.00,50.00!80.00,80.00!M
Which calls the check command:

Code: Select all

    command_name    check_xi_service_mrtgtraf
    command_line    $USER1$/check_rrdtraf -f /var/lib/mrtg/$ARG1$ -w $ARG2$ -c $ARG3$ -l $ARG4$
Which puts the values into /usr/local/nagios/share/perfdata/HOSTNAME/SERVICENAME.rrd as B, K, M or G (already converted numbers).

See the -l option of check_rrdtraf below:

Code: Select all

[root@xid html]# /usr/local/nagios/libexec/check_rrdtraf

Usage:
 check_rrdtraf -f <rrd_file> -w <warning_pair> -c <critical_pair>
           [-v][-e expire_seconds] [-l label_units]
 check_rrdtraf (-V | --version)
 check_rrdtraf (-h | --help)

Options:
-h, --help
  Print detaiiled help screen
-V, --version
  Print version information
-v    Verbose output. Can be specified twice for more verbosity
-vv   More verbose output, same as -v -v
-f    Full path to RRD file to read data from
-w    Warning threshold <rate> or pair <incoming>,<outgoing>
-c    Critical threshold <rate> or pair <incoming>,<outgoing>
-e    Log age threshold (in seconds, 5min=300)
-l    Data display label, one of B,K,M or G
Locked