Page 1 of 1
uptime monitor for ESX host
Posted: Thu Feb 10, 2022 11:40 am
by preethu.d
Hi,
Is it possible to monitor uptime for ESX host which is added in Nagios using vmware wizard (user name and password). If yes, how this can be done ?
Regards,
Preethu
Re: uptime monitor for ESX host
Posted: Fri Feb 11, 2022 1:20 pm
by ssax
Please try this command against it:
Code: Select all
/usr/local/nagios/libexec/check_vmware_api.pl -H X.X.X.X -u 'youruser' -p 'yourpassword' -l "uptime"
See here for the -w or -c thresholds if you want to set them:
https://nagios-plugins.org/doc/guidelin ... HOLDFORMAT
Re: uptime monitor for ESX host
Posted: Tue Feb 22, 2022 8:16 am
by preethu.d
Hi,
I tried the command but getting error. below are the screenshots, can you please check.
Regards,
Preethu
Re: uptime monitor for ESX host
Posted: Tue Feb 22, 2022 6:48 pm
by pbroste
Hello
@preethu.d
Appears from the screenshot that the command is unable to read the Auth config let's make sure that the permissions are correct:
Code: Select all
chown nagios:nagios <yourauthfile>
Then list it:
Let us know how that looks,
Perry
Re: uptime monitor for ESX host
Posted: Wed Feb 23, 2022 7:14 am
by preethu.d
Hi Perry,
I have made the changes. But still getting the same error.
For this ESX host, auth file was in the below path.
/usr/local/nagiosxi/etc/components/vmware/
earlier it was "apache nagios", after changing permission it is showing as "nagios nagios"
I did a run check command after making the changes, but it was giving the same error.
Regards,
Preethu
Re: uptime monitor for ESX host
Posted: Wed Feb 23, 2022 6:03 pm
by ssax
If you look at the command from your screenshot at the top you see this defined:
Code: Select all
$USER1$/check_vmware_api.pl -H "$HOSTADDRESS$" -f "$ARG1$" -l "$ARG2$" $ARG3$
The
-f option is to point to an auth file:
Code: Select all
-f, --authfile=<path>
Authentication file with login and password. File syntax :
username=<login>
password=<password>
Taken from the plugin help output:
Code: Select all
/usr/local/nagios/libexec/check_vmware_api.pl
So what the nagios process will do is replace the
$MACRONAME$ macros in the command you have selected with the actual values before running them.
So with everything in
$ARG1$ the command would translate to this which isn't proper:
-
$USER1$ = Taken from
/usr/local/nagios/etc/resource.cfg and points to
/usr/local/nagios/libexec
-
$HOSTADDRESS$ = Will use the hosts Address field that the service is attached to
-
$ARG1$ =
-u 'username' -p 'password' -l "uptime"
Code: Select all
/usr/local/nagios/libexec/check_vmware_api.pl -H "X.X.X.X" -f "-u 'username' -p 'password' -l "uptime"" -l ""
Go edit to the service in Configure > Core Config Manager > Commands and set the $ARGn$ values based on the command that it's using:
Code: Select all
$USER1$/check_vmware_api.pl -H "$HOSTADDRESS$" -f "$ARG1$" -l "$ARG2$" $ARG3$
So you would want:
$ARG1$ =
/usr/local/nagios/libexec/your_auth_file
$ARG2$ =
uptime
Then click
Save,
Apply Configuration, and
Force a check to see if it is now working and let us know the results.
Re: uptime monitor for ESX host
Posted: Thu Mar 03, 2022 3:10 am
by preethu.d
Hi,
Thanks for the help, it is working. You can lock the thread.
Regards,
Preethu