uptime monitor for ESX host

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
preethu.d
Posts: 109
Joined: Wed Nov 25, 2020 11:32 pm

uptime monitor for ESX host

Post 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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: uptime monitor for ESX host

Post 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
preethu.d
Posts: 109
Joined: Wed Nov 25, 2020 11:32 pm

Re: uptime monitor for ESX host

Post by preethu.d »

Hi,

I tried the command but getting error. below are the screenshots, can you please check.

Regards,
Preethu
You do not have the required permissions to view the files attached to this post.
User avatar
pbroste
Posts: 1288
Joined: Tue Jun 01, 2021 1:27 pm

Re: uptime monitor for ESX host

Post 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:

Code: Select all

ls -l
Let us know how that looks,
Perry
preethu.d
Posts: 109
Joined: Wed Nov 25, 2020 11:32 pm

Re: uptime monitor for ESX host

Post 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
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: uptime monitor for ESX host

Post 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.
preethu.d
Posts: 109
Joined: Wed Nov 25, 2020 11:32 pm

Re: uptime monitor for ESX host

Post by preethu.d »

Hi,

Thanks for the help, it is working. You can lock the thread.

Regards,
Preethu
Locked