Error monitoring HP

Hello all,
I am trying to monitor a HP Pro 477dw MFP printer with the check_hpjd plugin but I am getting the error message "Error in packet () ". Please who has encountered this issue before or know what might be the cause of this error.

Regards

I think the plugin is too old for that printer. If the printer speaks SNMP you can give check_printer_health a try.

Thank you Carsten,

I found another plugin " check_printer" by Rikersen, which I already tested from console and it works. The check_command was also provided but the issue now is how to define the services and hosts. I need a sample service and host definition for this check_printer plugin.

Hi,

can you share the CLI command plus the CheckCommand definition?

Cheers,
Michael

Hi, please find below the commands that i already tried and also the check_command below it. The check printer plugin was downloaded from https://github.com/riskersen/Monitoring/tree/master/Printer.

./check_printer 10.100.100.39 public 1 paper 2
Warning - Tray 2
./check_printer 10.100.100.39 public 1 parts 1
OK - top cover Status=4 | part=4;c r
 ./check_printer 10.100.100.39 public 1 hardware 1
OK - HP PageWide Pro 477dw MFP Status=2 | data=0;c 
 ./check_printer 10.100.100.39 public 1 counter 1
OK - Total: 16322 | pagecount=16322;c 
 ./check_printer 10.100.100.39 public 1 toner 1
OK - yellow ink HP F6T83A 50% (50 of 100 left) | toner=50;20;0;0;100 
 ./check_printer 10.100.100.39 public 1 toner 2
OK - magenta ink HP F6T82A 27% (27 of 100 left) | toner=27;20;0;0;100c 
 ./check_printer 10.100.100.39 public 1 toner 3
OK - cyan ink HP F6T81A 36% (36 of 100 left) | toner=36;20;0;0;100c 
object CheckCommand "printer_riskersen" {
  import "plugin-check-command"
  command = [  PluginDir + "/check_printer_riskersen"  ]

  arguments = {
    "-H" ={ 
          value = "$check_printer_riskersen_address$"
          skip_key = true
          order = 0   
        }
    "-C" ={ 
          value = "$snmp_community$"
          skip_key = true
          order = 1  
        }

    "-s" ={
          value = "$check_printer_riskersen_SNMPv$"
          skip_key = true
          order = 2  
        }

    "-x" ={
          value = "$check_printer_riskersen_command$"
          skip_key = true
          order = 3
        }

    "-n" ={
          value = "$check_printer_riskersen_num$"
          skip_key = true
          order = 4
        }
    "-W" ={
          value = "$check_printer_riskersen_warn$"
          skip_key = true
          order = 5
        }
  }

Regards

So, following the docs you’ll now have to reference the defined custom attributes from inside the CheckCommand, similar to other check command templates already provided.

apply Service "pagecount" {
  check_command = "printer_riskersen" 

  vars.check_printer_riskersen_address = host.address //prefer the host's address
  vars.snmp_community = "public" //as seen on the CLI
  vars.check_printer_riskersen_SNMPv = 1 //seems version 1 of SNMP
  vars.check_printer_riskersen_command = "counter"
  vars.check_printer_riskersen_num = 1 // no idea what this parameter does

  assign where ...
}

The plugin itself doesn’t properly implement getopts, the parameters are hard to read. Since the CheckCommand goes over it one by one, just follow the order in there. Or open the script and check how it parses the input parameters and how they are used later.

The other plugin calls work in the same fashion and you should create more service apply rules from it with modifying the custom attributes. First ensure to get the above example working with a proper assign where expression matching your host object, e.g. on vars.server_type = "printer".

Cheers,
Michael

1 Like

Thank you Michael,

I tried already and it is fine.

Regards