check_hpjd plugin in Plugins 1.4
Andreas Ericsson
ae at op5.se
Fri Feb 18 19:36:38 CET 2005
Edward MacGillivray wrote:
> Sorry to be replying to my own message, but I've did some more research into
> the differences between the three versions (1.4alpha2, 1.4, and the new test
> version). I've found that the command_line variables are being filled in the
> following ways:
>
> 1.4alpha2:
> sprintf (command_line, "%s -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community,
>
> 1.4
> sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET,
> community,
>
> new-test
> sprintf (command_line, "%s -Oqa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET,
> community,
>
> Then I looked again at snmpget (or actually snmpcmd) and was not able to find
> the option -Oa. I also don't see the option -OQ, which is in the newest one
> that I can compile. I changed the 1.4 version that I have to -Ovq (the
> options that Andreas asked about), and after compiling with this mods the
> plugin doesn't have the error output from snmpget. However the plugin only
> prints a '0' and the exit value of the plugin is 3, so I don't know that this
> "worked".
>
It doesn't. The logic that parses the snmpget output assumes that there
is text in a certain sequence prior to the actual value.
> So I then took the -O snmpget options out completely and recompiled. After
> doing this the plugin puts 'Printer ok - ("")' on stdout and has an exit
> value of 0, which is what happens with the 1.4alpha2 version.
>
This is also busted. The logic expects the MIB-description of the OID
and an equal sign, which is impossible to get with ucd-snmp and net-snmp
< 5.0.2. It's just poorly coded, that's all. What happens if you run
snmpget -Ovq on the target? If that works, then at least I know that
much. The "errors" being undefined is an easy fix, so long as I know the
rest of the code is sound.
> Anyway, I hope this helps.
> mac
>
> On Friday 18 February 2005 11:14 am, Edward MacGillivray wrote:
>
>>On Friday 18 February 2005 3:56 am, Andreas Ericsson wrote:
>>
>>>(sorry for posting again, I'm trying to patch this issue and just need
>>>some verification).
>>>
>>>Does your snmpget support the -Ovq output option?
>>
>>Yes, thanks for the information, the snmpget has both -Oq and -Ov, I
>>believe they'd work together as you have them. The snmpget that the server
>>has is ucdsnmp-4.2.6-152.
>>
>>I also saw the "check_hpjd hack" email thread, and I went through to test
>>it. However it didn't compile for me. I renamed the old check_hpjd.c file
>>to check_hpjd-dist.c and then put the new check_hpjd.c file in the plugins
>>folder. Then I deleted the check_hpjd file and the check_hpjd.o file, and
>>finally ran make (I'd previously done ./configure and didn't think that'd
>>be needed again). The make command reported:
>>
>>check_hpjd.c: In function `main':
>>check_hpjd.c:211: error: `errors' undeclared (first use in this function)
>>check_hpjd.c:211: error: (Each undeclared identifier is reported only once
>>check_hpjd.c:211: error: for each function it appears in.)
>>
>>This is the block in which line 211 is.
>>
>>210 /* obviously no read errors, so check the printer status results...
>>*/ 211 if (!errors) {
>>212 result = STATE_OK;
>>213 printf (_("Printer ok - (%s)\n"), display_message);
>>214 }
>>
>>Is this supposed to be the errorflag that is declared and used above the if
>>construct on line 211?
>>
>>thanks
>>mac
>>
>>
>>-------------------------------------------------------
>>SF email is sponsored by - The IT Product Guide
>>Read honest & candid reviews on hundreds of IT Products from real users.
>>Discover which products truly live up to the hype. Start reading now.
>>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
>>_______________________________________________
>>Nagios-users mailing list
>>Nagios-users at lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/nagios-users
>>
>>::: Please include Nagios version, plugin version (-v) and OS when
>>::: reporting any issue. Messages without supporting info will risk being
>>::: sent to /dev/null
>
>
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Lead Developer
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list