Ok,
Sorry for the delay, I wanted to make sure I had everything I can think of covered.
Here’s what I found.
I liberally used the logging capacity with Print OUT whatever from inside the perl pluggin… and it worked well.
When I use the command from the command line I get a perfect trace in plugging.log. Everything is working fine!
For example: (From the file pluggin.log)
hostname:x.x.91.254bgppeer:x.xx.91.zz community:Publicresult:HASH(0x8619180)output:xx.xx.91.zz (ASxx312) state is established(6)state:oKOutput:xx.xx.91.zz (ASxx312) state is established(6). Established for 2d4h38m47s. Last error “Hold Timer Expired”.
Next I enabled Nagios logging facility by changing the flag in Nagios.cfg and also enabling the highest level of verbose output. 2 I think.
However, when Nagios is using the script, nothing happen in the pluggin.log file and I still get (null) as the only thing that is returned.
But from nagios log file, I can see that at least the macro containing the string to call: check_bgp.0.4.pl is being started.
Presumably, this macro is to replace all the variable such as $USER1$ and $HOSTADDRESS$ and form a complete command.
As far as I can tell, the complete command is looking good. See final output in bold…
And further down, I see something similar happening with other simple command such as check_ping.
**** BEGIN MACRO PROCESSING ***********
Processing: '$USER1$/check_bgp.0.4.pl -H $HOSTADDRESS$ -C public -p xx.xx.91.50’
Processing part: ''
Not currently in macro. Running output (0): ''
Processing part: 'USER1’
Processed ‘USER1’, Clean Options: 0, Free: 0
Processed ‘USER1’, Clean Options: 0, Free: 0
Cleaning options: global=0, local=0, effective=0
Uncleaned macro. Running output (25): '/usr/local/nagios/libexec’
Just finished macro. Running output (25): '/usr/local/nagios/libexec’
Processing part: '/check_bgp.0.4.pl -H '
Not currently in macro. Running output (46): '/usr/local/nagios/libexec/check_bgp.0.4.pl -H '
Processing part: 'HOSTADDRESS’
macro_x[2] (HOSTADDRESS) match.
Processed ‘HOSTADDRESS’, Clean Options: 0, Free: 1
Processed ‘HOSTADDRESS’, Clean Options: 0, Free: 1
Cleaning options: global=0, local=0, effective=0
Uncleaned macro. Running output (59): '/usr/local/nagios/libexec/check_bgp.0.4.pl -H xx.xx.91.254’
Just finished macro. Running output (59): '/usr/local/nagios/libexec/check_bgp.0.4.pl -H xx.xx.91.254’
Processing part: ’ -C public -p 206.75.91.50’
Not currently in macro. Running output (85): '/usr/local/nagios/libexec/check_bgp.0.4.pl -H xx.xx.91.254 -C public -p xx.xx.91.zz’
Done. Final output: ‘/usr/local/nagios/libexec/check_bgp.0.4.pl -H xx.xx.91.254 -C public -p xx.xx.91.zz’
**** END MACRO PROCESSING *************
So, again, when Nagios call the pluggin, nothing is added in the pluggin.log, where I liberally dump some variable values.
This is weird. there’s got to be something simple I did not see. Either Nagios is simply not calling the pluggin, (I checked the file permissions and it looks fine) or it crash so early in the pluggin that indeed, nothing is returned.
When adding a perl pluggin, is there anything else to do? (According to the doc, you put the .pl file in /usr/local/nagios/libexec/ and change your config file to use it.)
Any idea??
Thanks a lot!!!