check_hpjd shows warning unnesessarily

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.
Adam
Posts: 14
Joined: Tue Feb 02, 2016 1:01 pm

Re: check_hpjd shows warning unnesessarily

Post by Adam »

Service State Information



Current Status:
WARNING
(for 0d 0h 0m 7s)
Status Information: No log handling enabled - turning on stderr logging ("Standby mode is on.")
Performance Data:
Current Attempt: 1/3 (SOFT state)
Last Check Time: 02-04-2016 12:36:45
Check Type: ACTIVE
Check Latency / Duration: 0.000 / 0.041 seconds
Next Scheduled Check: 02-04-2016 12:37:45
Last State Change: 02-04-2016 12:36:45
Last Notification: N/A (notification 0)
Is This Service Flapping?
NO
(0.00% state change)
In Scheduled Downtime?
NO

Last Update: 02-04-2016 12:36:48 ( 0d 0h 0m 4s ago)




Active Checks:
ENABLED

Passive Checks:
ENABLED

Obsessing:
ENABLED

Notifications:
ENABLED

Event Handler:
ENABLED

Flap Detection:
ENABLED





Service Commands


Disable Active Checks Of This Service Disable active checks of this service
Re-schedule Next Service Check Re-schedule the next check of this service
Submit Passive Check Result For This Service Submit passive check result for this service
Stop Accepting Passive Checks For This Service Stop accepting passive checks for this service
Stop Obsessing Over This Service Stop obsessing over this service
Disable Notifications For This Service Disable notifications for this service
Delay Next Service Notification Delay next service notification
Send Custom Notification Send custom service notification
Schedule Downtime For This Service Schedule downtime for this service
Disable Event Handler For This Service Disable event handler for this service
Disable Flap Detection For This Service Disable flap detection for this service



User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_hpjd shows warning unnesessarily

Post by Box293 »

What is the output of:

Code: Select all

/usr/local/nagios/libexec/check_hpjd -H 192.168.x.x -C public
And then after the command completes what is the output of:

Code: Select all

echo $?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Adam
Posts: 14
Joined: Tue Feb 02, 2016 1:01 pm

Re: check_hpjd shows warning unnesessarily

Post by Adam »

Code: Select all

[root@localhost adam]# /usr/local/nagios/libexec/check_hpjd -H 192.168.2.160 -C public
No log handling enabled - turning on stderr logging ("Standby mode is on.")

Code: Select all

[root@localhost adam]# echo $?
1
After doing some digging online I am beginning to think this is a bug in CentOS 6 and/or SNMP.
Adam
Posts: 14
Joined: Tue Feb 02, 2016 1:01 pm

Re: check_hpjd shows warning unnesessarily

Post by Adam »

This is what I get when I try snmpwalk

Code: Select all

[root@localhost adam]# snmpwalk -v 2c -c public 192.168.2.160 system
No log handling enabled - turning on stderr logging
/etc/snmp/snmp.conf: line 7: Warning: Unknown token: com2sec.
/etc/snmp/snmp.conf: line 9: Warning: Unknown token: com2sec.
/etc/snmp/snmp.conf: line 17: Warning: Unknown token: group.
/etc/snmp/snmp.conf: line 19: Warning: Unknown token: group.
/etc/snmp/snmp.conf: line 25: Warning: Unknown token: view.
/etc/snmp/snmp.conf: line 27: Warning: Unknown token: view.
/etc/snmp/snmp.conf: line 29: Warning: Unknown token: view.
/etc/snmp/snmp.conf: line 37: Warning: Unknown token: access.
/etc/snmp/snmp.conf: line 39: Warning: Unknown token: access.
SNMPv2-MIB::sysDescr.0 = STRING: HP ETHERNET MULTI-ENVIRONMENT,SN:CNB6H2CD9J,FN:YF41YES,SVCID:25127,PID:HP Color LaserJet MFP M476nw
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.11.2.3.9.1
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (76530580) 8 days, 20:35:05.80
SNMPv2-MIB::sysContact.0 = STRING: 
SNMPv2-MIB::sysName.0 = STRING: YColor
SNMPv2-MIB::sysLocation.0 = STRING: Yosemite Store
SNMPv2-MIB::sysServices.0 = INTEGER: 72
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.2 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.5 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmMIBCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB Module from SNMPv2 entities
SNMPv2-MIB::sysORDescr.2 = STRING: SNMP Management Architecture MIB
SNMPv2-MIB::sysORDescr.3 = STRING: Message Processing and Dispatching MIB
SNMPv2-MIB::sysORDescr.4 = STRING: USM User MIB
SNMPv2-MIB::sysORDescr.5 = STRING: VACM MIB
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (0) 0:00:00.00
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (0) 0:00:00.00
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_hpjd shows warning unnesessarily

Post by rkennedy »

I don't see the proper SNMP return in your walk for a 'Ready' status. Here are a couple alternatives that may work, if it is indeed a cent6 bug.
- Try this plugin https://exchange.nagios.org/directory/P ... ck/details and see if it returns the correct result
- Modify this bash script to work for your needs, it will change the statuses that a script is outputting. It currently switches ok -> crit, and crit -> ok, with warning remaining the same. You will need to adjust the 'enter_the_script_here' with the command you're running over the CLI to check_hpjd.

Code: Select all

#!/bin/bash

# define vars
script=$(enter_the_script_here)

# switch OK to CRITICAL
if [[ $script == *"OK"* ]]
then
echo "CRITICAL"
exit 2

# switch CRITICAL to OK
elif [[ $script == *"CRITICAL"* ]]
then
echo "OK"
exit 0

# WARNING stays the same
elif [[ $script == *"WARNING"* ]]
then
echo "WARNING"
exit 1

# catchall UNKNOWN
else
echo "UNKNOWN"
exit 3
fi
Former Nagios Employee
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_hpjd shows warning unnesessarily

Post by Box293 »

Adam wrote:

Code: Select all

[root@localhost adam]# /usr/local/nagios/libexec/check_hpjd -H 192.168.2.160 -C public
No log handling enabled - turning on stderr logging ("Standby mode is on.")

Code: Select all

[root@localhost adam]# echo $?
1
After doing some digging online I am beginning to think this is a bug in CentOS 6 and/or SNMP.
So it's clear the plugin is not working correctly at this point, hence why you get a warning.

I suspect this is a permissions issue on your SNMP MIB files, what is the output of:

Code: Select all

ls -la /usr/share/snmp/mibs
Make sure this points to the location of your mibs directory.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Adam
Posts: 14
Joined: Tue Feb 02, 2016 1:01 pm

Re: check_hpjd shows warning unnesessarily

Post by Adam »

Code: Select all

[adam@localhost ~]$ ls -la /usr/share/snmp/mibs
total 1780
drwxr-xr-x. 2 root root   4096 Feb  5 20:01 .
drwxr-xr-x. 4 root root   4096 Feb  5 20:01 ..
-rw-r--r--. 1 root root  17455 Aug 17 08:51 AGENTX-MIB.txt
-rw-r--r--. 1 root root  50948 Aug 17 08:51 BRIDGE-MIB.txt
-rw-r--r--. 1 root root  68104 Aug 17 08:51 DISMAN-EVENT-MIB.txt
-rw-r--r--. 1 root root  24613 Aug 17 08:51 DISMAN-SCHEDULE-MIB.txt
-rw-r--r--. 1 root root  64311 Aug 17 08:51 DISMAN-SCRIPT-MIB.txt
-rw-r--r--. 1 root root  84492 Aug 17 08:51 EtherLike-MIB.txt
-rw-r--r--. 1 root root   4660 Aug 17 08:51 HCNUM-TC.txt
-rw-r--r--. 1 root root  52544 Aug 17 08:51 HOST-RESOURCES-MIB.txt
-rw-r--r--. 1 root root  10583 Aug 17 08:51 HOST-RESOURCES-TYPES.txt
-rw-r--r--. 1 root root   4819 Aug 17 08:51 IANA-ADDRESS-FAMILY-NUMBERS-MIB.txt
-rw-r--r--. 1 root root  29665 Aug 17 08:51 IANAifType-MIB.txt
-rw-r--r--. 1 root root   4299 Aug 17 08:51 IANA-LANGUAGE-MIB.txt
-rw-r--r--. 1 root root   3513 Aug 17 08:51 IANA-RTPROTO-MIB.txt
-rw-r--r--. 1 root root   5066 Aug 17 08:51 IF-INVERTED-STACK-MIB.txt
-rw-r--r--. 1 root root  71691 Aug 17 08:51 IF-MIB.txt
-rw-r--r--. 1 root root  16782 Aug 17 08:51 INET-ADDRESS-MIB.txt
-rw-r--r--. 1 root root  46286 Aug 17 08:51 IP-FORWARD-MIB.txt
-rw-r--r--. 1 root root 185667 Aug 17 08:51 IP-MIB.txt
-rw-r--r--. 1 root root  15936 Aug 17 08:51 IPV6-ICMP-MIB.txt
-rw-r--r--. 1 root root  48703 Aug 17 08:51 IPV6-MIB.txt
-rw-r--r--. 1 root root   7257 Aug 17 08:51 IPV6-TCP-MIB.txt
-rw-r--r--. 1 root root   2367 Aug 17 08:51 IPV6-TC.txt
-rw-r--r--. 1 root root   4400 Aug 17 08:51 IPV6-UDP-MIB.txt
-rw-r--r--. 1 root root   5931 Aug 17 08:51 LM-SENSORS-MIB.txt
-rw-r--r--. 1 root root  42375 Aug 17 08:51 MTA-MIB.txt
-rw-r--r--. 1 root root  15732 Aug 17 08:51 NET-SNMP-AGENT-MIB.txt
-rw-r--r--. 1 root root   9160 Aug 17 08:51 NET-SNMP-EXAMPLES-MIB.txt
-rw-r--r--. 1 root root   9198 Aug 17 08:51 NET-SNMP-EXTEND-MIB.txt
-rw-r--r--. 1 root root   2036 Aug 17 08:51 NET-SNMP-MIB.txt
-rw-r--r--. 1 root root   3350 Aug 17 08:51 NET-SNMP-PASS-MIB.txt
-rw-r--r--. 1 root root   4686 Aug 17 08:51 NET-SNMP-TC.txt
-rw-r--r--. 1 root root   5039 Aug 17 08:51 NET-SNMP-VACM-MIB.txt
-rw-r--r--. 1 root root  21006 Aug 17 08:51 NETWORK-SERVICES-MIB.txt
-rw-r--r--. 1 root root  24694 Aug 17 08:51 NOTIFICATION-LOG-MIB.txt
-rw-r--r--. 1 root root   3067 Aug 17 08:51 RFC1155-SMI.txt
-rw-r--r--. 1 root root  79667 Aug 17 08:51 RFC1213-MIB.txt
-rw-r--r--. 1 root root   1174 Aug 17 08:51 RFC-1215.txt
-rw-r--r--. 1 root root 147822 Aug 17 08:51 RMON-MIB.txt
-rw-r--r--. 1 root root  45323 Aug 17 08:51 SCTP-MIB.txt
-rw-r--r--. 1 root root   4649 Aug 17 08:51 SMUX-MIB.txt
-rw-r--r--. 1 root root  15490 Aug 17 08:51 SNMP-COMMUNITY-MIB.txt
-rw-r--r--. 1 root root  22342 Aug 17 08:51 SNMP-FRAMEWORK-MIB.txt
-rw-r--r--. 1 root root   5496 Aug 17 08:51 SNMP-MPD-MIB.txt
-rw-r--r--. 1 root root  20014 Aug 17 08:51 SNMP-NOTIFICATION-MIB.txt
-rw-r--r--. 1 root root   9106 Aug 17 08:51 SNMP-PROXY-MIB.txt
-rw-r--r--. 1 root root  22769 Aug 17 08:51 SNMP-TARGET-MIB.txt
-rw-r--r--. 1 root root  39201 Aug 17 08:51 SNMP-USER-BASED-SM-MIB.txt
-rw-r--r--. 1 root root   2205 Aug 17 08:51 SNMP-USM-AES-MIB.txt
-rw-r--r--. 1 root root  21101 Aug 17 08:51 SNMP-USM-DH-OBJECTS-MIB.txt
-rw-r--r--. 1 root root   8263 Aug 17 08:51 SNMPv2-CONF.txt
-rw-r--r--. 1 root root  29305 Aug 17 08:51 SNMPv2-MIB.txt
-rw-r--r--. 1 root root   8924 Aug 17 08:51 SNMPv2-SMI.txt
-rw-r--r--. 1 root root  38034 Aug 17 08:51 SNMPv2-TC.txt
-rw-r--r--. 1 root root   5775 Aug 17 08:51 SNMPv2-TM.txt
-rw-r--r--. 1 root root  34162 Aug 17 08:51 SNMP-VIEW-BASED-ACM-MIB.txt
-rw-r--r--. 1 root root  28564 Aug 17 08:51 TCP-MIB.txt
-rw-r--r--. 1 root root  16418 Aug 17 08:51 TRANSPORT-ADDRESS-MIB.txt
-rw-r--r--. 1 root root   2163 Aug 17 08:51 UCD-DEMO-MIB.txt
-rw-r--r--. 1 root root   4402 Aug 17 08:51 UCD-DISKIO-MIB.txt
-rw-r--r--. 1 root root   3010 Aug 17 08:51 UCD-DLMOD-MIB.txt
-rw-r--r--. 1 root root   8118 Aug 17 08:51 UCD-IPFWACC-MIB.txt
-rw-r--r--. 1 root root  46150 Aug 17 08:51 UCD-SNMP-MIB.txt
-rw-r--r--. 1 root root  20882 Aug 17 08:51 UDP-MIB.txt
[adam@localhost ~]$ 
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: check_hpjd shows warning unnesessarily

Post by rkennedy »

I suspect these need to be set to root:nagios as that is what I'm seeing on my system.

Code: Select all

chown -R root:nagios /usr/share/snmp/*
Did this have any affect?
Former Nagios Employee
Adam
Posts: 14
Joined: Tue Feb 02, 2016 1:01 pm

Re: check_hpjd shows warning unnesessarily

Post by Adam »

rkennedy do you have a default copy of snmp.conf? I suspect I have it set up wrong.
Adam
Posts: 14
Joined: Tue Feb 02, 2016 1:01 pm

Re: check_hpjd shows warning unnesessarily

Post by Adam »

rkennedy wrote:I suspect these need to be set to root:nagios as that is what I'm seeing on my system.

Code: Select all

chown -R root:nagios /usr/share/snmp/*
Did this have any affect?
This had no effect that I can tell.
Locked