Page 1 of 2

Error Nagios plugin vmware

Posted: Fri Nov 02, 2018 7:12 am
by alex3105
Dear,

I have Nagios Core 4.4.1 installed in Centos 7 with which I want to monitor Dell and Cisco servers which host virtual servers. These teams are in vcenter, I have tried to monitor them but I have errors so I would appreciate your help.

With the plugin check_vmware_api.pl I have the error (Return code of 255 for service 'VMware CPU Usage' on host 'Blade1' was out of bounds)
and with the other plugin check_esx and I have another error Usage: check_esx -D <data_center>

This is the content of my file resource.cfg

# Sets $USER1$ to be the path to the plugins
$USER1$=/usr/local/nagios/libexec

# Sets $USER2$ to be the path to event handlers
#$USER2$=/usr/local/nagios/libexec/eventhandlers

# Store some usernames and passwords (hidden from the CGIs)
$USER11$=root
$USER12$=Passw0rd

I would appreciate your support to solve it

Best regards.

Re: Error Nagios plugin vmware

Posted: Fri Nov 02, 2018 2:27 pm
by scottwilkerson
So here is the service definition

Code: Select all

define service{
#        use					generic-service
		use						generic-service
		hostgroup_name			vmware-esx
		service_description		VMware CPU Usage
		check_command			check_vmware_api_dc_host_cpu_usage!90!95
		}
Which would execute this command

Code: Select all

define command{
  command_name check_vmware_api_dc_host_cpu_usage
  command_line $USER1$/check_vmware_api.pl -u $USER11$ -p $USER12$ -H $HOSTADDRESS$ -l cpu -s usage -w $ARG2$ -c $ARG3$
}
Your command

Code: Select all

check_command			check_vmware_api_dc_host_cpu_usage!90!95
has an $ARG1$ and $ARG2$ but NOT and $ARG3$

So this would be the command executed which would error

Code: Select all

/usr/local/nagios/libexec/check_vmware_api.pl  -u root -p Passw0rd -H IP_ADDRESS -l cpu -s usage -w 90 -c

Re: Error Nagios plugin vmware

Posted: Fri Nov 02, 2018 3:03 pm
by alex3105
Sorry Scottwilkerson ... I do not understand what you wrote ..

Re: Error Nagios plugin vmware

Posted: Fri Nov 02, 2018 3:34 pm
by npolovenko
In this statement, you're calling the check_vmware_api_dc_host_cpu_usage command, then you're passing 90 as $ARG1$ and 95 as $ARG2$.
check_vmware_api_dc_host_cpu_usage!90!95
According to your command, 95 will go after -w, and there's no argument after -c
-w $ARG2$ -c $ARG3$
Please run the following command from the command line and show me the output. Don't forget to replace the hostname and the password.
/usr/local/nagios/libexec/check_vmware_api.pl -u root -p password -H hostname -l cpu -s usage -w 90 -c 95

Re: Error Nagios plugin vmware

Posted: Fri Nov 02, 2018 4:00 pm
by alex3105
Here is the result:

[root@localhost libexec]# ./check_vmware_api.pl -u root -p Passw0rd -H 192.168.32.7 -l cpu -s usage -w 90 -c 95
CHECK_VMWARE_API.PL OK - cpu usage=1.82 % | cpu_usage=1.82%;90;95

Re: Error Nagios plugin vmware

Posted: Mon Nov 05, 2018 10:14 am
by scottwilkerson
To resolve the issue change this

Code: Select all

check_command         check_vmware_api_dc_host_cpu_usage!90!95
to this

Code: Select all

check_command         check_vmware_api_dc_host_cpu_usage!!90!95

Re: Error Nagios plugin vmware

Posted: Mon Nov 12, 2018 12:09 pm
by alex3105
Dear Scott, after making the suggested changes, the error appeared:Socket timeout after 60 seconds

But following the same case, try to solve it in another way so I would appreciate your support. I decided to investigate how to monitor my servers using the attached link, basically what I want to monitor is the state of the network interfaces. It should be noted that by the Vsphere Client I visualize that each team has two physical NICs, however they list me 6

https://www.vcloudnine.de/how-to-monito ... with-snmp/

[root@localhost libexec]# snmpwalk -O fn -m ALL -c public -v 2c mi_ip_adress IF-MIB::ifDescr
.1.3.6.1.2.1.2.2.1.2.1 = STRING: Device vmnic0 at 06:00.0 enic
.1.3.6.1.2.1.2.2.1.2.2 = STRING: Device vmnic1 at 07:00.0 enic
.1.3.6.1.2.1.2.2.1.2.3 = STRING: Traditional Virtual VMware switch: vSwitch0
.1.3.6.1.2.1.2.2.1.2.4 = STRING: Traditional Virtual VMware switch: vSwitch1
.1.3.6.1.2.1.2.2.1.2.5 = STRING: Virtual interface: vmk0 on vswitch vSwitch0 portgroup: Management Network
.1.3.6.1.2.1.2.2.1.2.6 = STRING: Virtual interface: vmk1 on vswitch vSwitch1 portgroup: vMotion

[root@localhost libexec]# snmpwalk -O fn -m ALL -c public -v 2c mi_ip_adress IF-MIB::ifOperStatus
.1.3.6.1.2.1.2.2.1.8.1 = INTEGER: up(1)
.1.3.6.1.2.1.2.2.1.8.2 = INTEGER: up(1)
.1.3.6.1.2.1.2.2.1.8.3 = INTEGER: up(1)
.1.3.6.1.2.1.2.2.1.8.4 = INTEGER: up(1)
.1.3.6.1.2.1.2.2.1.8.5 = INTEGER: up(1)
.1.3.6.1.2.1.2.2.1.8.6 = INTEGER: up(1)

Then with the following command I got two interfaces

[root@localhost libexec]# snmpwalk -O fn -m ALL -c belice -v 2c 10.1.100.120 HOST-RESOURCES-MIB::hrDeviceStatus
HOST-RESOURCES-MIB::hrDeviceDescr.58 = STRING: NIC vmnic0, driver enic, version 2.3.0.10, 0000:006:00.0
HOST-RESOURCES-MIB::hrDeviceDescr.59 = STRING: NIC vmnic1, driver enic, version 2.3.0.10, 0000:007:00.0

snmpwalk -m ALL -c belice -v 2c 10.1.100.120 HOST-RESOURCES-MIB::hrDeviceStatus

HOST-RESOURCES-MIB::hrDeviceStatus.58 = INTEGER: unknown(1)
HOST-RESOURCES-MIB::hrDeviceStatus.59 = INTEGER: unknown(1)

My query is: The commands would be well defined taking into account the first results seen, unfortunately I can not turn off the equipment because it is in production.


define command{
command_name check_vmware_int1
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ --oid ifOperStatus.1
}

define command{
command_name check_vmware_int2
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C $ARG1$ --oid ifOperStatus.2
}

Re: Error Nagios plugin vmware

Posted: Mon Nov 12, 2018 12:45 pm
by scottwilkerson
This looks correct, it is likely vmnic0 and vmnic1 that you want to monitor. The others are virtual switch and management interfaces.

Re: Error Nagios plugin vmware

Posted: Mon Nov 12, 2018 3:05 pm
by alex3105
It is correct, I want to monitor the state of the physical interfaces.

Re: Error Nagios plugin vmware

Posted: Mon Nov 12, 2018 4:42 pm
by scottwilkerson
alex3105 wrote:It is correct, I want to monitor the state of the physical interfaces.
May we close the thread?