Check ESXI Hardware

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
michaelpn
Posts: 54
Joined: Fri Jul 14, 2017 12:12 am

Check ESXI Hardware

Post by michaelpn »

Hi Nagios,
I use Nagios 4.3.2 version. I have configure that the site can monitor my VMWare hosts. It works fine :) Please see attachment. Now I only monitor "host_alive":

# my example


###############################################################################
#
# BELOW HOST FOR GROUP DEFINITIONS
#
###############################################################################

define hostgroup{
hostgroup_name vmware-servers ; The name of the hostgroup
alias vmware servers ; Long name of the group
members VMWARE6,VMWARE7,VMWARE8,VMWARE9
}


define host {
host_name VMWARE6
use linux-server
alias VMWARE6
address xxx.xx.xx.xx
hostgroups vmware-servers
max_check_attempts 3
check_period 24x7
check_command check-host-alive
notification_interval 60
notification_period 24x7
}

aso.....



###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################


define service{
use generic-service
host_name VMWARE6
service_description Host Alive
check_command check-host-alive
}


Now I would like monitor the hardware of my ESXI/HOSTS. I have already the Nagios Plugin and "Monitoring Plugin: check_esxi_hardware.py" and python-pywhem installed. How should I configure this ? Below you see what I already have:

# my example

# 'check_esxi_hardware' command definition
define command{
command_name check_esxi_hardware
command_line $USER1$/check_esxi_hardware.py -H $HOSTADDRESS$ -U $ARG1$ -P $ARG2$ -V $ARG3$
}


Do I have to configure a group definition for those meaning esx6,esx7,esx8,esx9 and a serrcvice definition for those ? I mean - they use the same ip.

Could any tell me how this works. We use Fujitsu Simens RX2540M1 Sercver for our VMWare.

Please see my attachments.
Attachments
Hardware Check.odt
(1.01 MiB) Downloaded 232 times
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
dwasswa

Re: Check ESXI Hardware

Post by dwasswa »

Hi @michaelpn,

You can just do the same thing you did earlier. Just put them in a host-group as ESXI servers.

If they are using the same IP address is also fine.

Here is another interesting thing you can do to create those host,service definitions if you want to save time. Use object inheritance.

Take a look at this Object inheritance

Also,if you are using

Code: Select all

check_esxi_hardware 
plugin to monitor ESXI servers make sure the ports

Code: Select all

open ports 443 and 5989
are open.

Let us know if you have any questions.
michaelpn
Posts: 54
Joined: Fri Jul 14, 2017 12:12 am

Re: Check ESXI Hardware

Post by michaelpn »

Hi dwasswa,

It works fine with the ESXI hosts and I get all 4 up on on the site but I still have a small issue. I get this warning from ESX6 Host where I have created this service:

# my example warning from Nagios Services

ESX6 ESX Hardware Check WARNING 10-06-2017 14:32:35 0d 1h 11m 0s 3/3 (No output on stdout) stderr: Traceback (most recent call last):

# my example warning from Nagios Services end


# my example from Nagios Service State Information

WARNING
(for 0d 1h 12m 49s)
Status Information: (No output on stdout) stderr: Traceback (most recent call last):
File "/usr/local/nagios/libexec/check_esxi_hardware.py", line 685, in <module>
instance_list = wbemclient.EnumerateInstances(classe)
File "/usr/local/lib/python2.7/dist-packages/pywbem/cim_operations.py", line 1585, in EnumerateInstances
**extra)
File "/usr/local/lib/python2.7/dist-packages/pywbem/cim_operations.py", line 914, in _imethodcall
recorder=self.operation_recorder)
File "/usr/local/lib/python2.7/dist-packages/pywbem/cim_http.py", line 768, in wbem_request
raise ConnectionError("Socket error: %s" % exc)
pywbem.exceptions.ConnectionError: Socket error: [Errno -2] Name or service not known

# my example end

This is my commands.cfg file:

# 'check_esxi_hardware' command definition
define command{
command_name check_esxi_hardware
command_line $USER1$/check_esxi_hardware.py -H xxx.xx.x.xx -U root $ARG1$ -P 'xxxxxxxx' $ARG2$ -CV FujitsuSiemens $ARG3$
}

This is my hostgroups.cfg file:

###############################################################################
###############################################################################
#
# HOST GROUP DEFINITIONS
#
###############################################################################
###############################################################################

define hostgroup{
hostgroup_name esx-servers ; The name of the hostgroup
alias esx servers ; Long name of the group
members ESX6,ESX7,ESX8,ESX9
}


###############################################################################
#
# BELOW HOST FOR GROUP DEFINITIONS
#
###############################################################################

define host {
host_name ESX6
use linux-server
alias ESX6
address xxx.xx.x.xx
hostgroups esx-servers
max_check_attempts 3
check_period 24x7
check_command check-host-alive
notification_interval 60
notification_period 24x7
}



###############################################################################
###############################################################################
#
# SERVICE DEFINITIONS
#
###############################################################################
###############################################################################



# Create a service for monitoring the esx hardware check and Client Version of the server
# Change the host_name to match the name of the host you defined above


define service{
use generic-service
host_name ESX6
service_description ESX Hardware Check
check_command check_esxi_hardware!root!xxxxxxxx!FujisuSiemens
}


# my qustions for you:

1: why this warning ?

2: what do I have to change ?


Please attachment:)
Attachments
ESXI.odt
(294.5 KiB) Downloaded 211 times
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
dwasswa

Re: Check ESXI Hardware

Post by dwasswa »

You mad some errors in:

Code: Select all

define service{
use generic-service
host_name ESX6
service_description ESX Hardware Check
check_command check_esxi_hardware!root!xxxxxxxx!FujisuSiemens
}
Please change:

Code: Select all

check_command check_esxi_hardware!root!xxxxxxxx!FujisuSiemens
to:

Code: Select all

check_command check_esxi_hardware.py
since you already defined the command.

Also,lets make sure the command works;please test it on your remote host(ESXI server) locally by:

Go to your ESXI sever in:

Code: Select all

/usr/local/nagios/libexec
Run your command:

Code: Select all

check_esxi_hardware.py -H xxx.xx.x.xx -U root $ARG1$ -P 'xxxxxxxx' $ARG2$ -CV FujitsuSiemens $ARG3$
michaelpn
Posts: 54
Joined: Fri Jul 14, 2017 12:12 am

Re: Check ESXI Hardware

Post by michaelpn »

Hi dwasswa,

Know I have solved the challenge with this statement:

# 'check_esxi_hardware' command definition
define command{
command_name check_esxi_hardware.py
command_line $USER1$/check_esxi_hardware.py -H 172.31.1.12 -U root $ARG1$ -P 'xperd4zzz' $ARG2$ -C 5989 $ARG3$
}

define service{
use generic-service
host_name ESX6
service_description ESX Hardware Check
check_command check_esxi_hardware.py
}
I get this from:

Current Status:
OK
(for 0d 0h 34m 52s)
Status Information: OK - Server: FUJITSU PRIMERGY RX2540 M1 s/n: YLVT016881 System BIOS: V5.0.0.9 R1.31.0 for D3289-A1x 2017-01-20

Question:

1: how should I add the others ?
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
dwasswa

Re: Check ESXI Hardware

Post by dwasswa »

Hi @michaelpn,

By others do you mean hosts ESX7,ESX8,ESX9 or you mean services.
michaelpn
Posts: 54
Joined: Fri Jul 14, 2017 12:12 am

Re: Check ESXI Hardware

Post by michaelpn »

Hi dwassawa,

I mean define command:

# 'check_esxi_hardware' command definition
define command{
command_name check_esxi_hardware.py
command_line $USER1$/check_esxi_hardware.py -H xxx.xx.x.xx -U root $ARG1$ -P 'xxxxxxx' $ARG2$ -C 5989 $ARG3$
}

If you look at IP-adress it is for esx6. What about 7,8,9 how do I add them? Do I add the ip behinds the -H or how ?

If I add the # 'check_esxi_hardware' command definition twice in the command.cfg with the IP from ESX7 behind the -H xxx.xx.x.xx file I get this failure:

# my example

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for command 'check_esxi_hardware.py' (config file '/usr/local/nagios/etc/objects/commands.cfg', starting on line 134)
Error: Could not add object property in file '/usr/local/nagios/etc/objects/commands.cfg' on line 135.
Error processing object config files!


# my example END

If I add the IP from ESX7 and add it to the # 'check_esxi_hardware' command definition behind the -H xxx.xx.x.xx I get this failure:

# my example

[10-10-2017 10:58:35] SERVICE ALERT: ESX7;ESX Hardware Check;WARNING;SOFT;2;(No output on stdout) stderr: Traceback (most recent call last):

... and I get this for both ESX6 and ESX7..... But if I delete the IP for ESX7 it turns green again for ESX6. Of course I remember to add ESX7 in the hostgroups.cfg file regarding the above example but it doesn’t not help!!

# my example END

What do I wrong ?
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
michaelpn
Posts: 54
Joined: Fri Jul 14, 2017 12:12 am

Re: Check ESXI Hardware

Post by michaelpn »

Hi, I have solved myself ;)
Michael Pierre
Forenede Gruppeliv
2500 Valby
Copenhagen
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Check ESXI Hardware

Post by scottwilkerson »

Glad to hear this is resolved.

Locking
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked