Page 3 of 4

Re: VMware Plugin Issue

Posted: Fri Mar 02, 2018 3:04 pm
by cdienger
Also check the permissions on the files under /usr/share/perl5/VMware and edit /usr/local/nagios/libexec/check_esx3.pl, changing the second line from:

# nagios: +epn

to:

# nagios: -epn

This is a permissions issue but for the life of me I haven't been able to reproduce it. Do you have any additional security on the machine like selinux enabled:

sestatus

?

Re: VMware Plugin Issue

Posted: Fri Mar 02, 2018 3:14 pm
by benjohns
# ls -al /usr/share/perl5/VMware/
total 3448
drwxr-xr-x. 3 root root 4096 Feb 23 13:14 .
drwxr-xr-x. 54 root root 4096 Feb 23 13:14 ..
-r--r--r--. 1 root root 6605 Feb 23 13:14 LookupService.pm
drwxr-xr-x. 2 root root 4096 Feb 23 13:14 pyexe
-r-xr-xr-x. 1 root root 3356 Feb 23 13:14 SSOConnection.pm
-r--r--r--. 1 root root 90818 Feb 23 13:14 VICommon.pm
-r--r--r--. 1 root root 41509 Feb 23 13:14 VICredStore.pm
-r--r--r--. 1 root root 27760 Feb 23 13:14 VIExt.pm
-r--r--r--. 1 root root 23736 Feb 23 13:14 VILib.pm
-r--r--r--. 1 root root 234786 Feb 23 13:14 VIM25Runtime.pm
-r--r--r--. 1 root root 2225566 Feb 23 13:14 VIM25Stub.pm
-r--r--r--. 1 root root 87988 Feb 23 13:14 VIM2Runtime.pm
-r--r--r--. 1 root root 741859 Feb 23 13:14 VIM2Stub.pm
-r--r--r--. 1 root root 2150 Feb 23 13:14 VIMRuntime.pm
-r--r--r--. 1 root root 498 Feb 23 13:14 VIRuntime.pm


Changed check_esx3.pl:

#!/usr/bin/perl -w
# nagios: -epn


SELinux is enabled, but is in permissive mode:

# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: permissive
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28

Re: VMware Plugin Issue

Posted: Fri Mar 02, 2018 3:23 pm
by benjohns
Running the check command as the nagios user still errors out: ESX3 CRITICAL - HOST CPU Unknown error

Re: VMware Plugin Issue

Posted: Fri Mar 02, 2018 4:25 pm
by npolovenko
@benjohns, Please try using the updated plugin that I've attached to this post. Don't forget to give it the permissions:

Code: Select all

chmod +x 777 check_esx3.pl

Re: VMware Plugin Issue

Posted: Fri Mar 02, 2018 5:01 pm
by benjohns
Installed the new plugin:

-rwxr-xr-x. 1 apache nagios 169439 Mar 2 15:54 check_esx3.pl

Then ran chmod:

-rwxrwxrwx. 1 apache nagios 169439 Mar 2 15:54 check_esx3.pl


Now XI is throwing this error when trying to run the check:

(No output on stdout) stderr: Can't locate Nagios/Plugin/Functions.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/nagios
BEGIN failed--compilation aborted at /usr/local/nagios/libexec/check_esx3.pl line 40.

Re: VMware Plugin Issue

Posted: Mon Mar 05, 2018 10:39 am
by npolovenko
@benjohns, Please try the following command to install the missing module:

Code: Select all

yum install perl-Nagios-Plugin

Re: VMware Plugin Issue

Posted: Mon Mar 05, 2018 2:05 pm
by benjohns
After installing perl-Nagios-Plugin, the checks are again timing out from within XI:

(Service check timed out after 180.01 seconds)

Running the check command from within CCM yields the following output:

[nagios@HOST ~]$ /usr/local/nagios/libexec/check_esx3.pl -H "ESXi IP" -f "/usr/local/nagiosxi/etc/components/vmware/ESXiFQDN_auth.txt" -l "CPU"

I am testing these checks each time against multiple ESXi hosts; all of our ESXi hosts are on the same VMware build.

Re: VMware Plugin Issue

Posted: Tue Mar 06, 2018 4:16 pm
by tgriep
First, disable selinux and see if that fixes the issue.
Sometimes permissive mode causes issues.

Second, verify that the username and password in the auth file is correct.

Code: Select all

/usr/local/nagiosxi/etc/components/vmware/ESXiFQDN_auth.txt
Third, verify that the permissions for the auth file is correct.
This is an example of how they should be set.

Code: Select all

-rw-r--r-- 1 apache nagios   esx_auth.txt
Let us know if any of the above is causing the issue.

Re: VMware Plugin Issue

Posted: Tue Mar 06, 2018 5:46 pm
by benjohns
1 - $ sestatus
SELinux status: disabled

2 - Credentials are correct

3 - -rw-r--r--. 1 apache nagios 37 Feb 27 15:00 [HOST]_auth.txt

I disabled SELinux, then verified the other two. Service checks are still timing out:

(Service check timed out after 180.01 seconds)

Re: VMware Plugin Issue

Posted: Wed Mar 07, 2018 12:17 pm
by tgriep
Let's turn on debugging in Nagios so we can see what the issue is when the check is ran.
Edit the /usr/local/nagios/etc/nagios.cfg file and change the following options to the values in the example below.

Code: Select all

debug_level=-1
debug_verbosity=1
Save the changes and restart nagios by running

Code: Select all

service nagios restart
Then, let the check run notmally in the XI GUI and when it times out, look in the debug file

Code: Select all

/usr/local/nagios/var/nagios.debug
And post any information on how the check was ran and any errors.

FYI, the debug file fills up quickly so if you miss the entries, you may have to try again.