Robert.C.Moore | 23 May 21:36 2013
Picon

[Check_mk (english)] Problems with check_esxi_hardware.py

Hello,

I am trying to implement a python plugin for monitoring the hardware of ESXi Hosts, as available here: http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php. I have used this plugin successfully in a previous non-omd, check_mk setup. I am now setting up omd and check_mk, both from git, to use the latest features but when I implement this check, it does not seem to work properly. I can run the check as the omd site user from the command line and get the desired output including exit codes but when run as a check from nagios it fails. The nagios website shows CRIT status with (null) output. Any help or guidance would be greatly appreciated as I have searched the web exhaustively and have not found a working solution.

Thanks,
Robert
_______________________________________________
checkmk-en mailing list
checkmk-en@...
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en
Brendon Colby | 31 May 23:27 2013

Re: [Check_mk (english)] Problems with check_esxi_hardware.py

On Thu, May 23, 2013 at 3:36 PM, <Robert.C.Moore-zES+1Ur7hjI@public.gmane.org> wrote:
Hello,

I am trying to implement a python plugin for monitoring the hardware of ESXi Hosts, as available here: http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php. I have used this plugin successfully in a previous non-omd, check_mk setup. I am now setting up omd and check_mk, both from git, to use the latest features but when I implement this check, it does not seem to work properly. I can run the check as the omd site user from the command line and get the desired output including exit codes but when run as a check from nagios it fails. The nagios website shows CRIT status with (null) output. Any help or guidance would be greatly appreciated as I have searched the web exhaustively and have not found a working solution.

Not sure if you're still having problems...but if you are, how are you configuring this check? I don't use OMD, but here's how I configure legacy checks with CheckMK. You might be able to use this information to figure it out.

I put all configuration in /etc/check_mk/main.mk - I don't use any other Nagios config.

First I set up the check command:

extra_nagios_conf += r"""

define command {
    command_name    check-mysql-slave
    command_line    $USER1$/check_mysql -H $HOSTADDRESS$ -P $ARG1$ -u nagios -S -w $ARG2$ -c $ARG3$
}

"""

Then I set up a legacy check:

legacy_checks = [
    (('check-mysql-slave!3306!30!60', 'MySQL Status - Slave', False), ['mysql_slave'], ALL_HOSTS),
]

This runs the command on all hosts tagged mysql_slave. That's all I do.

If you think the plugin is failing for some reason, you can also put print statements in the plugin that print to a log file in /tmp. That's what I do some times when I have a custom plugin and it seems to be failing for some reason. Then the plugin will be run as it should be through Nagios, and you can see if it's failing somehow.

Brendon
_______________________________________________
checkmk-en mailing list
checkmk-en@...
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en
Robert.C.Moore | 5 Jun 21:31 2013
Picon

Re: [Check_mk (english)] Problems with check_esxi_hardware.py

So, when I went to revisit this, my check_mk web page was showing output errors from the command. The script was complaining about an unrecognized parameter $... This led me to write a new simple command to write much of the needed command to a temp file as you suggested. It wrote the temp file but appended a $ to the name of the file (the last word of the command). My command has a $ in it that is part of a password. In previous builds I quoted the whole password and this worked to escape the special characters in it. After playing with different ways to escape the $ and other special characters as well as quote them I finally stumbled upon this page: http://www.krenger.ch/blog/nagios-escape-dollar-character/ Which guided me in the right direction. To properly quote my $ I had to us \$$  No other method of quotes or escape characters worked.

This resolved my problem and now the command is working great.

-Rob Moore





From:        Brendon Colby <brendon-UZPdSscjHxQoM3ANB2zruQ@public.gmane.org>
To:        Robert.C.Moore-zES+1Ur7hjI@public.gmane.org
Cc:        checkmk-en-qhrM8SXbD5JpaB0eVFyvwnWFp+d4uDoM@public.gmane.org
Date:        05/31/2013 04:27 PM
Subject:        Re: [Check_mk (english)] Problems with check_esxi_hardware.py



On Thu, May 23, 2013 at 3:36 PM, <Robert.C.Moore-zES+1Ur7hjI@public.gmane.org> wrote:
Hello,

I am trying to implement a python plugin for monitoring the hardware of ESXi Hosts, as available here: http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php. I have used this plugin successfully in a previous non-omd, check_mk setup. I am now setting up omd and check_mk, both from git, to use the latest features but when I implement this check, it does not seem to work properly. I can run the check as the omd site user from the command line and get the desired output including exit codes but when run as a check from nagios it fails. The nagios website shows CRIT status with (null) output. Any help or guidance would be greatly appreciated as I have searched the web exhaustively and have not found a working solution.

Not sure if you're still having problems...but if you are, how are you configuring this check? I don't use OMD, but here's how I configure legacy checks with CheckMK. You might be able to use this information to figure it out.

I put all configuration in /etc/check_mk/main.mk - I don't use any other Nagios config.

First I set up the check command:

extra_nagios_conf += r"""

define command {
    command_name    check-mysql-slave
    command_line    $USER1$/check_mysql -H $HOSTADDRESS$ -P $ARG1$ -u nagios -S -w $ARG2$ -c $ARG3$
}

"""

Then I set up a legacy check:

legacy_checks = [
    (('check-mysql-slave!3306!30!60', 'MySQL Status - Slave', False), ['mysql_slave'], ALL_HOSTS),
]

This runs the command on all hosts tagged mysql_slave. That's all I do.

If you think the plugin is failing for some reason, you can also put print statements in the plugin that print to a log file in /tmp. That's what I do some times when I have a custom plugin and it seems to be failing for some reason. Then the plugin will be run as it should be through Nagios, and you can see if it's failing somehow.

Brendon
_______________________________________________
checkmk-en mailing list
checkmk-en@...
http://lists.mathias-kettner.de/mailman/listinfo/checkmk-en

Gmane