[Nagiosplug-devel] check_mrtg and check_mrtgtraf return incorrectly (?) using versions from nagios 1.4.13

Craig Braithwaite craig.braithwaite at gmail.com
Wed Feb 11 00:24:08 CET 2009


Second attempt..
         frompostmaster at smtp.novabase.pt
         to craig.braithwaite at gmail.com
         date10 February 2009 13:33
         subjectDelivery Status Notification (Failure)
         mailed-bynovabase.pt
         Final-Recipient: rfc822;nagiosplug-devel at lists.sourceforge.net
         Action: failed
         Status: 5.7.1
         Diagnostic-Code: smtp;550 5.7.1 Unable to relay
.. but that's a side-issue.



---------- Forwarded message ----------
From: "Craig Braithwaite" <craig.braithwaite at gmail.com>
To: <nagiosplug-devel at lists.sourceforge.net>
Date: Tue, 10 Feb 2009 10:35:40 +1100
Subject: [Nagiosplug-devel] check_mrtg and check_mrtgtraf return
incorrectlyusing versions from nagios 1.4.13
(I hope gmail really does send plain text when I ask it to.)

So.. Dear mailing_list
I've been struggling with these for a fortnight or so, and have tried
to learn enough about c to sort it out myself,
however I am so far failing.

check_mrtg apparently fails to return an OK status at any stage and is
initialised at UNKNOWN so therefore
continues to show unknown unless the values cause a flip to warning or
critical.

check_mrtgtraf also passes (or fails to?) something incorrectly to
nagios, as the command line usage can
be made to return a string of OK, however nagios reports warning for
the same values so is either
getting an incorrect return code, or none.

.At least, this is what I think. I've lived in the click-n-close
windows world too long and have never written
much more than 'hello world'.  From what I can gather these two
plugins will comprise a hefty proportion
of my monitoring options and the versions I have are (I think) the
most recent. (both report 1.4.13 but also1991)
I am new to everything related to this project,
 .linux (centos5.2 on a VM), nagios (3.0.6), mrtg (last months version)
so if I'm totally in the wrong place can someone point me in the right
direction.



Am I right, do these need updating?
If so, is it likely that someone reading this mailing list can do so
and inform us?

Cheers ../craigb
("aussiepics" on this list.)

##########################################################################################

# from /usr/local/nagios/objects/commands.cfg
# 'check_local_mrtgtraf' command definition
define command{
       command_name    check_local_mrtgtraf
       command_line    $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w
$ARG3$ -c $ARG4$ -e $ARG5$
       }

# 'check_local_mrtg' command defiition (wasn't here, I made it myself ./cb)
#
define command{
       command_name    check_local_mrtg
       command_line    $USER1$/check_mrtg -F $ARG1$ -a $ARG2$ -v
$ARG3$ -w $ARG4$ -c $ARG5$
       }
#############################################################################################
#from /usr/local/nagios/objects/switch.cfg
# Monitor bandwidth via MRTG logs
#
define service{
       use                     generic-service ; Use values from a template
       host_name               FPV0626
       service_description     Trunk 6 from FPR Bandwidth Usage
       check_command
check_local_mrtgtraf!/var/www/mrtg/203.103.224.233_trk6.log!AVG!2200000000,
2200000000! 2500000000, 2500000000!10
       }
#############################################################################################


===================== cpu temp ====================
[root at Pengy102 libexec]# head /var/www/mrtg/fpvser019-temp1.log
1234162202 23 23
1234162202 23 23 23 23
1234161903 23 23 23 23
1234161900 23 23 23 23
1234161600 23 23 23 23
1234161300 23 23 23 23
1234161000 23 23 23 23
1234160700 23 23 23 23
1234160400 23 23 23 23
1234160100 23 23 23 23
You have new mail in /var/spool/mail/root
[root at Pengy102 libexec]# head /var/www/mrtg/ip.ad.dr.ss_trk6.log
1234162502 2314146519 456159057
1234162502 0 238811639 0 238811639
1234162202 0 238811639 0 238811639
1234162200 0 238811639 0 238811639
1234161900 0 238811639 0 238811639
1234161600 0 238811639 0 238811639
1234161300 0 238811639 0 238811639
1234161000 0 238811639 0 238811639
1234160700 0 238811639 0 238811639
1234160400 0 238811639 0 238811639

###############################################################################
# #########  from /usr/local/nagios/etc/objects/windows.cfg  ##################
# Monitor cpu-temp via MRTG logs
# UNTESTED == MAY OR MAY NOT WORK
#####
define service{
      use                     generic-service ; Use values from a template
      host_name               fpvser019
      service_description     CPU Temp
#####
# This one works, but check_mrtg has a bug and doesn't
# return OK when it's ok so it perpetually says UNKNOWN
# until you have a real problem
#####
 check_command  check_local_mrtg!/var/www/mrtg/fpvser019-temp1.log!MAX!1!25!35!
#####
# So I'll try using check_mrtgtraf instead even
# though it's the wrong tool
# BELOW SENDS THE -v COMMAND (WHICH IS WRONG?) BUT WORKS IN NAGIOS
# EXCEPT IT ALWAYS SITS AT 'WARNING'.  (I guess the plug-in
# actually strips out the -v arg, but like check_mrtg, the return codes
# are incorrect.)
#       check_command
check_local_mrtgtraf!/var/www/mrtg/fpvser019-temp1.log!MAX!1!30,30!35,35!
# ommitting the '1' for the -v arg, causes nagios to show part of the
outputted error string.
####
       }
####
##################################################################################


############## command line checking of the plugin
###############################
[root at Pengy102 libexec]# ./check_mrtgtraf -F
/var/www/mrtg/fpvser019-temp1.log -a MAX -v 1 -w 30,30 -c 40,40 -e 10
/check_mrtgtraf: invalid option -- v
######### note 'invalid option' -- v above  #############
######### note usage prompt generated (below) ###########
Usage check_mrtgtraf -F <log_file> -a <AVG | MAX> -v <variable> -w
<warning_pair>-c <critical_pair> [-e expire_minutes] [-t timeout] [-v]
#######################################################
[root at Pengy102 libexec]# ./check_mrtgtraf -F
/var/www/mrtg/fpvser019-temp1.log -a MAX  -w 30,30 -c 40,40 -e 10
Traffic OK - Max. In = 23.0 B/s, Max. Out = 23.0
B/s|in=23.000000B/s;30.000000;40.000000;0.000000
in=23.000000B/s;30.000000;40.000000;0.000000




More information about the Devel mailing list