pnp4nagios 0.6.25 BULK Mode with NPCD

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: pnp4nagios 0.6.25 BULK Mode with NPCD

Post by Box293 »

Excellent, once you wrap your head around it everything starts to make sense. Don't worry I went through all the same frustrations you did when I learnt it :lol:
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Pikmin
Posts: 82
Joined: Tue Feb 17, 2015 5:32 pm

Re: pnp4nagios 0.6.25 BULK Mode with NPCD

Post by Pikmin »

Thanks for all your help :D It does get quite frustrating at times. I will be sleeping better with this issue out of the way :)

EDIT:
I spoke too soon, there are still issues with this :) When bandwidth goes high, the units change to MB from KB but the graph is not displaying this properly, 11 MB barely shows, as if it's 11 KB. I have a feeling that's not gonna be easy to fix
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: pnp4nagios 0.6.25 BULK Mode with NPCD

Post by rkennedy »

Can you post a screenshot to give us an example of what you're seeing?
Former Nagios Employee
Pikmin
Posts: 82
Joined: Tue Feb 17, 2015 5:32 pm

Re: pnp4nagios 0.6.25 BULK Mode with NPCD

Post by Pikmin »

I took a screenshot last night. You can clearly see 11 MB but on the graph it's barely showing
MAX and AVG are wrong too now, as the link Max is 12.5 MB
Attachments
Nagios MB.png
Pikmin
Posts: 82
Joined: Tue Feb 17, 2015 5:32 pm

Re: pnp4nagios 0.6.25 BULK Mode with NPCD

Post by Pikmin »

I decided it was time to try another plugin as check_mrtgtraf doesn't seem to want to play nice

Trying to follow jrdalrymple advice and check_mrtg looks promising but it can only do one variable at a time so I created two checks, one for incoming one for outgoing. The units seem to be in bytes, hopefully they will not change

One problem I have so far is that the critical and warning tresholds don't appear to be detected properly, I get the Max.Value and crit and warn but not any actual warnings on the output. Can someone confirm this is normal?

Code: Select all

 ./check_mrtg -F /var/www/mrtg/192.168.199.1_5.log -a MAX -v 1 -w 22 -c 33
Max. value = 265384 |value=265384;22;33;
In Nagios the output looks like this

Tunnel0 Incoming
OK 11-18-2015 10:48:19 0d 0h 40m 41s 1/3 Max. Incoming = 265384

Tunnel0 Outgoing
OK 11-18-2015 10:43:32 0d 0h 45m 28s 1/3 Max. Outgoing = 218022


The old check_mrtgtraf for comparison purposes
Tunnel0
OK 11-18-2015 10:43:12 0d 0h 45m 48s 1/3 Traffic OK - Avg. In = 327.9 KB/s, Avg. Out = 212.9 KB/s
Last edited by Pikmin on Tue Nov 17, 2015 6:53 pm, edited 1 time in total.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: pnp4nagios 0.6.25 BULK Mode with NPCD

Post by Box293 »

Can you post the template code here in a code block please.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Pikmin
Posts: 82
Joined: Tue Feb 17, 2015 5:32 pm

Re: pnp4nagios 0.6.25 BULK Mode with NPCD

Post by Pikmin »

Code: Select all

<?php
#
# Copyright (c) 2006-2010 Joerg Linge (http://www.pnp4nagios.org)
# Default Template used if no other template is found.
# Don`t delete this file !
#
# Define some colors ..
#
$_WARNRULE = '#FFFF00';
$_CRITRULE = '#FF0000';
$_AREA     = '#256aef';
$_LINE     = '#000000';
#
# Initial Logic ...
#



foreach ($this->DS as $KEY=>$VAL) {

        $maximum  = "";
        $minimum  = "";
        $critical = "";
        $crit_min = "";
        $crit_max = "";
        $warning  = "";
        $warn_max = "";
        $warn_min = "";
        $vlabel   = " ";
        $lower    = "";
        $upper    = "";

        if ($VAL['WARN'] != "" && is_numeric($VAL['WARN']) ){
                $warning = $VAL['WARN'] / 1000;
        }
        if ($VAL['WARN_MAX'] != "" && is_numeric($VAL['WARN_MAX']) ) {
                $warn_max = $VAL['WARN_MAX'];
        }
        if ( $VAL['WARN_MIN'] != "" && is_numeric($VAL['WARN_MIN']) ) {
                $warn_min = $VAL['WARN_MIN'];
        }
        if ( $VAL['CRIT'] != "" && is_numeric($VAL['CRIT']) ) {
                $critical = $VAL['CRIT'] / 1000;
        }
        if ( $VAL['CRIT_MAX'] != "" && is_numeric($VAL['CRIT_MAX']) ) {
                $crit_max = $VAL['CRIT_MAX'];
        }
        if ( $VAL['CRIT_MIN'] != "" && is_numeric($VAL['CRIT_MIN']) ) {
                $crit_min = $VAL['CRIT_MIN'];
        }
        if ( $VAL['MIN'] != "" && is_numeric($VAL['MIN']) ) {
                $lower = " --lower=" . $VAL['MIN'];
                $minimum = $VAL['MIN'];
        }
        if ( $VAL['MAX'] != "" && is_numeric($VAL['MAX']) ) {
if ( $VAL['CRIT'] != "" && is_numeric($VAL['CRIT']) ) {
                $critical = $VAL['CRIT'] / 1000;
        }
        if ( $VAL['CRIT_MAX'] != "" && is_numeric($VAL['CRIT_MAX']) ) {
                $crit_max = $VAL['CRIT_MAX'];
        }
        if ( $VAL['CRIT_MIN'] != "" && is_numeric($VAL['CRIT_MIN']) ) {
                $crit_min = $VAL['CRIT_MIN'];
        }
        if ( $VAL['MIN'] != "" && is_numeric($VAL['MIN']) ) {
                $lower = " --lower=" . $VAL['MIN'];
                $minimum = $VAL['MIN'];
        }
        if ( $VAL['MAX'] != "" && is_numeric($VAL['MAX']) ) {
                $maximum = $VAL['MAX'];
        }
        if ($VAL['UNIT'] == "%%") {
                $vlabel = "%";
                $upper = " --upper=101 ";
                $lower = " --lower=0 ";
        }
        else {
                $vlabel = $VAL['UNIT'];
        }

        $opt[$KEY] = '--vertical-label "' . $vlabel . '" --title "' . $this->MACRO['DISP_HOSTNAME'] . ' / ' . $this->MACRO['DISP_SERVICEDESC'] . '"' . $uppe
r . $lower;
        $ds_name[$KEY] = $VAL['LABEL'];
        $def[$KEY]  = rrd::def     ("var1", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE");
        $def[$KEY] .= rrd::gradient("var1", "3152A5", "BDC6DE", rrd::cut($VAL['NAME'],16), 20);
        $def[$KEY] .= rrd::line1   ("var1", $_LINE );
#####   $def[$KEY] .= rrd::gprint  ("var1", array("LAST","MAX","AVERAGE"), "%3.4lf %S".$VAL['UNIT']);
        $def[$KEY] .= rrd::gprint  ("var1", array("LAST","MAX","AVERAGE"), "%3.4lf %S".$VAL['UNIT']);
        if ($warning != "") {
                $def[$KEY] .= rrd::hrule($warning, $_WARNRULE, "Warning  $warning KB \\n");
        }
        if ($warn_min != "") {
                $def[$KEY] .= rrd::hrule($warn_min, $_WARNRULE, "Warning  (min)  $warn_min \\n");
        }
        if ($warn_max != "") {
                $def[$KEY] .= rrd::hrule($warn_max, $_WARNRULE, "Warning  (max)  $warn_max \\n");
        }
        if ($critical != "") {
                $def[$KEY] .= rrd::hrule($critical , $_CRITRULE, "Critical $critical KB\\n");
        }
        if ($crit_min != "") {
                $def[$KEY] .= rrd::hrule($crit_min, $_CRITRULE, "Critical (min)  $crit_min \\n");
        }
        if ($crit_max != "") {
                $def[$KEY] .= rrd::hrule($crit_max, $_CRITRULE, "Critical (max)  $crit_max \\n");
        }
        $def[$KEY] .= rrd::comment("B7 Template\\r");
        $def[$KEY] .= rrd::comment("Command " . $VAL['TEMPLATE'] . "\\r");
}
?>
Pikmin
Posts: 82
Joined: Tue Feb 17, 2015 5:32 pm

Re: pnp4nagios 0.6.25 BULK Mode with NPCD

Post by Pikmin »

It's working!!

I wish the documentation of check_mrtg plugin actually described that it never reports warning or critical on the terminal.

Code: Select all

Right now the link is heavily used but the plugin doesn't show critical
./check_mrtg -F /var/www/mrtg/192.168.199.1_5.log -a MAX -v 1 -w 11250000 -c 11875000 -l Incoming
Max. Incoming = 12120977 |Incoming=12120977;11250000;11875000;
However, both nagios and pnp4nagios are reporting and showing critical. Yay
Attachments
tunnel0 graph.png
tunnel0.png
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: pnp4nagios 0.6.25 BULK Mode with NPCD

Post by rkennedy »

For clarification, it looks like it should be reporting critical - this is what you want correct?

If not - can you post the two service definitions for Tunnel0 and Tunnel0 Incoming?
Former Nagios Employee
Pikmin
Posts: 82
Joined: Tue Feb 17, 2015 5:32 pm

Re: pnp4nagios 0.6.25 BULK Mode with NPCD

Post by Pikmin »

It appears to be working correctly, thanks. I wasn't aware that the check_mrtg plugin doesn't report anything to do with warning and critical when run in terminal, unlike check_mrtgtraf
Not sure if this is a bug or intentional but it does make it harder to test stuff
Locked