Hello,

I've ran into a strange behaviour, a nagios plugin does not execute
correctly when called from icinga2, but is OK from command line.

The check is (cmk_load.pl and check_mk_agent.pl are perl scripts of mine):

> object CheckCommand "Check_Load" {
>     import "plugin-check-command"
>     command = [ PluginDir + "/cmk_checks/cmk_load.pl" ]
>     arguments = {
>     "-H" = "$address$"
>     "-w" = "$warn$"
>     "-c" = "$crit$"
>     "-vd" = ""
>     }
>
>     vars.warn = "4,4,4"
>     vars.crit = "8,8,8"
> }

When running from command line *as icinga user* it is OK :

> # su icinga
> bash-4.2$ /usr/lib64/nagios/plugins/cmk_checks/cmk_load.pl -vd
> DEBUG: $VAR1 = [
>           '0.10 0.11 0.11 1/302 31501 2'
>         ];
>
> CMK_LOAD OK - load average 0.10, 0.11, 0.11|load1=0.100;1.000;5.000;0;
> load5=0.110;1.000;5.000;0; load15=0.110;1.000;5.000;0;

But inside icinga, I got this result :

> DEBUG: $VAR1 = undef;
> Use of uninitialized value $load_datas in split at
> /usr/share/perl5/check_mk_agent.pm line 132.
> Use of uninitialized value $l1 in numeric gt (>) at
> /usr/share/perl5/check_mk_agent.pm line 134.
> Use of uninitialized value $l5 in numeric gt (>) at
> /usr/share/perl5/check_mk_agent.pm line 134.

debug.log show me that the plugin is called with the correct parameters.
I have an idea of what fails (DEBUG: $VAR1 = undef; is self
explanatory), but I don't have a clue about how to debug it, aside from
running from cli as user icinga, which does not fail...

If you're curious, the full (dirty) code is here :
https://github.com/xavier8854/check-mk-agent-perl

Thanks for any help,

Cheers,

Xavier

-- 
Xavier Humbert
CRT Supervision et Exploitation de Niveau 1
Rectorat de Nancy-Metz
03 83 86 27 39


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to