check_snmp_printer stopped working after Ubuntu 16.04 upgrad
check_snmp_printer stopped working after Ubuntu 16.04 upgrad
My 4.2.4 Nagios implementation on Ubuntu 16.04 was working without issues. When I updated Ubuntu to 18.04, I had issues with the check_snmp_printer plugin (https://exchange.nagios.org/directory/P ... ck/details). Here is the entry in my command.cfg
#'check_snmp_printer' command definition
define command{
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -t $ARG2$
}
I can run this command on the server
./check_snmp_printer -H x.x.x.x -x public -t "CONSUM TEST"
Consumables you may monitor:
Black Toner Cartridge
Drum Unit
But when I try to check the CONSUM, I receive the error:
./check_snmp_printer -H x.x.x.x -x public -t "CONSUM Black Toner Cartridge"
./check_snmp_printer: line 466: [: No Such Instance currently exists at this OID: integer expression expected
./check_snmp_printer: line 486: let: CURRENT_CAPACITY=No Such Instance currently exists at this OID * 100 / No Such Instance currently exists at this OID: syntax error in expression (error token is "Such Instance currently exists at this OID * 100 / No Such Instance currently exists at this OID")
No Such Instance currently exists at this OID is at 0% - CRITICAL!,| 'No Such Instance currently exists at this OID'=0;20;5
This is the same error that occurs on the web interface as well.
Any thoughts or suggestions? TIA
#'check_snmp_printer' command definition
define command{
command_name check_snmp_printer
command_line $USER1$/check_snmp_printer -H $HOSTADDRESS$ -C $ARG1$ -t $ARG2$
}
I can run this command on the server
./check_snmp_printer -H x.x.x.x -x public -t "CONSUM TEST"
Consumables you may monitor:
Black Toner Cartridge
Drum Unit
But when I try to check the CONSUM, I receive the error:
./check_snmp_printer -H x.x.x.x -x public -t "CONSUM Black Toner Cartridge"
./check_snmp_printer: line 466: [: No Such Instance currently exists at this OID: integer expression expected
./check_snmp_printer: line 486: let: CURRENT_CAPACITY=No Such Instance currently exists at this OID * 100 / No Such Instance currently exists at this OID: syntax error in expression (error token is "Such Instance currently exists at this OID * 100 / No Such Instance currently exists at this OID")
No Such Instance currently exists at this OID is at 0% - CRITICAL!,| 'No Such Instance currently exists at this OID'=0;20;5
This is the same error that occurs on the web interface as well.
Any thoughts or suggestions? TIA
Re: check_snmp_printer stopped working after Ubuntu 16.04 up
Running the script with the bash debug option may give us some clues:
Code: Select all
bash -x ./check_snmp_printer -H x.x.x.x -x public -t "CONSUM TEST"As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: check_snmp_printer stopped working after Ubuntu 16.04 up
In Ubuntu 18, not all of the SNMP MIB files are installed on the server.
They have to be manually installed so run this as root to do so.
Then run this to download and install them.
To have the new MIBs recognized by net-snmp, edit /etc/snmp/snmp.conf file as follows:
Then, test the plugin to see if it works.
They have to be manually installed so run this as root to do so.
Code: Select all
apt-get install snmp-mibs-downloaderCode: Select all
download-mibsCode: Select all
mibs +ALLBe sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_snmp_printer stopped working after Ubuntu 16.04 up
I followed the instructions to add the MIBs and made the change to the snmp.conf file and then received the following error:
Bad operator (INTEGER): At line 73 in /usr/share/snmp/mibs/ietf/SNMPv2-PDU
I followed these instructions https://serverfault.com/questions/93611 ... or-in-mibs and deleted my SNMPv2-PDU file. The plugin runs without errors, but does not return any results. Here are the bash -x results:
+ PRIVACYPROTOCOL=public
+ shift
+ shift
+ test -n -t
+ case "$1" in
++ cut -d ' ' -f1
++ echo 'CONSUM Black Toner Cartridge'
+ CHECK_TYPE=CONSUM
++ cut -d ' ' -f2-
++ echo 'CONSUM Black Toner Cartridge'
+ PARAMETER='Black Toner Cartridge'
+ shift
+ shift
+ test -n ''
+ '[' '!' -z CONSUM ']'
+ case "$CHECK_TYPE" in
+ CheckConsumables 'Black Toner Cartridge'
+ CONSUMS_STATE=0
+ HEX_ID=0
+ CURRENT_STATUS=0
+ HEX_MARKER=
+ ASCII_MARKER=
+ MARKERS_MATCHED=
+ case "$1" in
++ walk_snmp 1.3.6.1.2.1.43.11.1.1.6.1 false
++ '[' false = true ']'
++ OUTPUT_OPTIONS=-Oa
++ [[ 2c = 3 ]]
+++ snmpwalk -v 2c -Oa -c public 10.7.225.121 1.3.6.1.2.1.43.11.1.1.6.1
++ RESULT_TEXT='Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"
Printer-MIB::prtMarkerSuppliesDescription.1.2 = STRING: "Drum Unit"'
++ RESULT_CODE=0
++ [[ 0 -ne 0 ]]
++ '[' false = true ']'
++ echo 'Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"
Printer-MIB::prtMarkerSuppliesDescription.1.2 = STRING: "Drum Unit"'
+ ALL_MARKERS='Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"
Printer-MIB::prtMarkerSuppliesDescription.1.2 = STRING: "Drum Unit"'
+ check_snmp_error 0 'Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"
Printer-MIB::prtMarkerSuppliesDescription.1.2 = STRING: "Drum Unit"'
+ [[ 0 -ne 0 ]]
++ egrep -i 'Black Toner Cartridge'
++ echo 'Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"
Printer-MIB::prtMarkerSuppliesDescription.1.2 = STRING: "Drum Unit"'
+ MARKERS_MATCHED='Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"'
+ '[' -z 'Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"' ']'
++ awk -F= '{print $1}'
++ awk -F. '{print $8}'
++ echo 'Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"'
+ return 0
+ STATE=0
+ '[' '' == '' ']'
+ echo ''
+ exit 0
Bad operator (INTEGER): At line 73 in /usr/share/snmp/mibs/ietf/SNMPv2-PDU
I followed these instructions https://serverfault.com/questions/93611 ... or-in-mibs and deleted my SNMPv2-PDU file. The plugin runs without errors, but does not return any results. Here are the bash -x results:
+ PRIVACYPROTOCOL=public
+ shift
+ shift
+ test -n -t
+ case "$1" in
++ cut -d ' ' -f1
++ echo 'CONSUM Black Toner Cartridge'
+ CHECK_TYPE=CONSUM
++ cut -d ' ' -f2-
++ echo 'CONSUM Black Toner Cartridge'
+ PARAMETER='Black Toner Cartridge'
+ shift
+ shift
+ test -n ''
+ '[' '!' -z CONSUM ']'
+ case "$CHECK_TYPE" in
+ CheckConsumables 'Black Toner Cartridge'
+ CONSUMS_STATE=0
+ HEX_ID=0
+ CURRENT_STATUS=0
+ HEX_MARKER=
+ ASCII_MARKER=
+ MARKERS_MATCHED=
+ case "$1" in
++ walk_snmp 1.3.6.1.2.1.43.11.1.1.6.1 false
++ '[' false = true ']'
++ OUTPUT_OPTIONS=-Oa
++ [[ 2c = 3 ]]
+++ snmpwalk -v 2c -Oa -c public 10.7.225.121 1.3.6.1.2.1.43.11.1.1.6.1
++ RESULT_TEXT='Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"
Printer-MIB::prtMarkerSuppliesDescription.1.2 = STRING: "Drum Unit"'
++ RESULT_CODE=0
++ [[ 0 -ne 0 ]]
++ '[' false = true ']'
++ echo 'Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"
Printer-MIB::prtMarkerSuppliesDescription.1.2 = STRING: "Drum Unit"'
+ ALL_MARKERS='Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"
Printer-MIB::prtMarkerSuppliesDescription.1.2 = STRING: "Drum Unit"'
+ check_snmp_error 0 'Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"
Printer-MIB::prtMarkerSuppliesDescription.1.2 = STRING: "Drum Unit"'
+ [[ 0 -ne 0 ]]
++ egrep -i 'Black Toner Cartridge'
++ echo 'Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"
Printer-MIB::prtMarkerSuppliesDescription.1.2 = STRING: "Drum Unit"'
+ MARKERS_MATCHED='Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"'
+ '[' -z 'Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"' ']'
++ awk -F= '{print $1}'
++ awk -F. '{print $8}'
++ echo 'Printer-MIB::prtMarkerSuppliesDescription.1.1 = STRING: "Black Toner Cartridge"'
+ return 0
+ STATE=0
+ '[' '' == '' ']'
+ echo ''
+ exit 0
Re: check_snmp_printer stopped working after Ubuntu 16.04 up
Can you upload the plugin that you are running to the post so we can view it?
The output does not seem to match what I see so I would like to test with the actual plugin you are using.
The output does not seem to match what I see so I would like to test with the actual plugin you are using.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_snmp_printer stopped working after Ubuntu 16.04 up
I assume you are using check_snmp_printer Version 4.0, which can be downloaded from here:
https://exchange.nagios.org/directory/P ... ck/details
I may be wrong though...
As @tgriep mentioned, it's probably the best to know what is the exact plugin that you are using, and test it in-house.
Having said that, I tested the plugin above on Ubuntu 18, and it worked for me. See below:
https://exchange.nagios.org/directory/P ... ck/details
I may be wrong though...
Having said that, I tested the plugin above on Ubuntu 18, and it worked for me. See below:
Code: Select all
root@ubuntu18x64:/usr/local/nagios/libexec# uname -a
Linux ubuntu18x64 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
root@ubuntu18x64:/usr/local/nagios/libexec# cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
root@ubuntu18x64:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_snmp_printer -H x.x.x.x -v 1 -t "CONSUM TEST" -C public
Consumables you may monitor:
Black Cartridge HP CE278A
root@ubuntu18x64:/usr/local/nagios/libexec# /usr/local/nagios/libexec/check_snmp_printer -H x.x.x.x -v 1 -t "CONSUMX Black Cartridge HP CE278A" -C public -w 20 -c 10
Black Cartridge HP CE278A is at 10% - CRITICAL!,| 'Black Cartridge HP CE278A'=10;20;10Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_snmp_printer stopped working after Ubuntu 16.04 up
Yes, I am using the version 4.0 of the check_snmp_printer. I noticed that your reply uses CONSUMX instead of CONSUM and when I changed my code worked! I know this was working on Ubuntu version 14....
I appreciate your help! Thank you!
I appreciate your help! Thank you!
Re: check_snmp_printer stopped working after Ubuntu 16.04 up
I am glad I could help! Let us know if it is OK to close this topic. Thank you!
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: check_snmp_printer stopped working after Ubuntu 16.04 up
I am closing the topic as requested by the user via PM.
Be sure to check out our Knowledgebase for helpful articles and solutions!