Page 1 of 1

ESXi root has special passwords and Nagios isn't taking it

Posted: Sun Mar 24, 2019 6:36 am
by neospazzy
So I created a password on my ESXi host that contains both a dollar sign and an exclamation. I modified the esxi config file. Here is a sample password that has both special characters.

Fakepa$s!

This is what I have for the service definitions.

define service{
use generic-service
host_name ESXi1
service_description ESXi Hardware Check
check_command check_esxi_hardware!root!Fakepa$s!!dell!--perfdata
}


That didn't work so I tried to use "Fakepa$s!" with quotes and 'Fakepa$s!' with single quotes and neither are working. They are coming back with "UNKNOWN: Authentication Error". I even went as far as putting both the single quotes inside the quotes to no avail.

"'FakePa$s!'"

I set up several Nagios boxes using check_esxi_hardware.py on other networks with "regular" passwords that has no special characters just fine so I know what I am doing. It is just this particular ESXi host that has a password that contains both these special characters are causing me headaches.

Any help is appreciated. Thanks.

Re: ESXi root has special passwords and Nagios isn't taking

Posted: Mon Mar 25, 2019 10:46 am
by mcapra
Here's the general purpose "special characters" KB article:
https://support.nagios.com/kb/article.php?id=580

I would suggest storing this password in a macro, then referencing that macro in your service definition. You can define custom macros in a resource file, then reference them in your Nagios Core objects.

An example might be to have the following line in your /usr/local/nagios/etc/resource.cfg file:

Code: Select all

$USER123$=Fakepa$s!
Which you can then reference in your service object like so:

Code: Select all

define service{
  use generic-service
  host_name ESXi1
  service_description ESXi Hardware Check
  check_command check_esxi_hardware!root!$USER123$!dell!--perfdata
}
Be sure to account for any CLI escaping that may be required, based on how your check_esxi_hardware command is defined.

Be sure to restart Nagios Core when you edit the resource.cfg file, or the service definition.

Re: ESXi root has special passwords and Nagios isn't taking

Posted: Mon Mar 25, 2019 2:08 pm
by tgriep
Thanks @mcapra for the help.

@neospazzy, the exclamation mark is used as a delimiter in the Nagios commands so you would have to create a macro in the resource.cfg file to get it to work.