VmWare ESX Monitoring(1)

image_pdfimage_print

берем скрипт. ставим пакет и качаем его, подробнее тут — https://habrahabr.ru/company/simnetworks/blog/241605/

Скрипт написан на языке программирования Python, требует библиотеку PyWBEM. Под ОС Linux Debian и Ubuntu она устанавливается через стандартные системные репозитории:
apt-get install python-pywbem

Синтаксис запуска «check_esxi_hardware.py» весьма прост:
check_esxi_hardware.py -H XXX.YYY.WWW.ZZZ -U root -P XXXXXXXX

В ответ вы получите краткий отчет о состоянии здоровья сервера:
OK - Server: Supermicro X9DR3-F s/n: 0123456789 System BIOS: 3.0a 2013-07-31

описание работы самого скрипта тут: https://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php#CommandDefinition

Definition of the parameters

Short Long Description
-H —host Hostname or IP address of ESX/ESXi server
-U —user Username to check (must be a local user on target host)
Note: If you don’t want to use your root user, use this workaround
Use file:/path/to/.file to use first string as username
-P —password Password for given user
Use file:/path/to/.file to use second string as password — this won’t show the password in servers process list
-C —cimport CIM port (default 5989)
-V —vendor (hw_type) Define the vendor of the server: auto, dell, hp, ibm, intel, unknown (default)
auto Plugin tries to determine hardware itself by using CIM entries
dell For DELL servers use dell as hw/vendor type
hp For HP servers use hp as hw/vendor type
ibm For IBM servers use ibm as hw/vendor type
intel For some servers using Intel motherboards this might be needed
unknown If no hw/vendor type was given, unknown will be used (like auto)
-i —ignore Ignore given list (comma separated) of elements
-v —verbose Verbose/detailled output for debugging
-p —perfdata Include server perfdata for graphics like PNP4Nagios or Nagiosgraph
-I —html Add web-links to hardware manuals for Dell servers (use your country extension)

————

Usage

./check_esxi_hardware.py -H esxi-server-ip -U username -P mypass [-C -V -i -v -p -I xx]

./check_esxi_hardware.py —host esxi-server-ip —user username —password mypass [—cimport —vendor —ignore —verbose —perfdata —html xx]

./check_esxi_hardware.py -H esxi-server-ip -U -P file:/path/to/.passwdfile [—vendor —ignore —verbose —perfdata —html xx]

./check_esxi_hardware.py -H esxi-server-ip -U file:/path/to/.passwdfile -P file:/path/to/.passwdfile [—vendor -i -v -p —html xx]

Examples:

./check_esxi_hardware.py -H 10.0.0.200 -U root -P mypass -V dell -p -I de
./check_esxi_hardware.py —host esxiserver1 —user root —password mypass —vendor hp —perfdata
./check_esxi_hardware.py —host esxiserver2 —user root —password mypass —vendor dell —html us
./check_esxi_hardware.py -H esxiserver1 -U root -P file:/root/.esxipass -V dell
./check_esxi_hardware.py -H esxiserver1 -U file:/root/.esxipass -P file:/root/.esxipass -V dell
./check_esxi_hardware.py -H esxiserver1 -U root -P mypass -V dell -i «IPMI SEL»

————

Command definition in your commands.cfg:

# ‘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$
}

Command definition in your commands.cfg with optional parameter:

# ‘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$ $ARG4$
}

Command definition in your commands.cfg with password read from file:

# ‘check_esxi_hardware’ command definition
define command{
command_name check_esxi_hardware
command_line $USER1$/check_esxi_hardware.py -H $HOSTADDRESS$ -U $ARG1$ -P file:$ARG2$ -V $ARG3$ $ARG4$
}

Command definition in your commands.cfg with user and password read from file:

# ‘check_esxi_hardware’ command definition
define command{
command_name check_esxi_hardware
command_line $USER1$/check_esxi_hardware.py -H $HOSTADDRESS$ -U file:$ARG1$ -P file:$ARG2$ -V $ARG3$ $ARG4$
}

————

Service check on a HP Server:

# Check HP Server hardware
define service{
use generic-service
host_name esxi1
service_description Hardware
check_command check_esxi_hardware!root!mypass!hp
}

Service check on a DELL Server:

# Check DELL Server hardware
define service{
use generic-service
host_name esxi2
service_description Hardware
check_command check_esxi_hardware!root!mypass!dell
}

Service check on a DELL Server with perfdata:

# Check DELL Server hardware
define service{
use generic-service
host_name esxi2
service_description Hardware
check_command check_esxi_hardware!root!mypass!dell!—perfdata
}

Service check on a DELL Server with password read from file:

# Check DELL Server hardware
define service{
use generic-service
host_name esxi2
service_description Hardware
check_command check_esxi_hardware!root!/home/nagios/.esxipass!dell
}

Service check on a HP Server with user and password read from file:

# Check HP Server hardware
define service{
use generic-service
host_name esxi1
service_description Hardware
check_command check_esxi_hardware!/home/nagios/.esxipass!/home/nagios/.esxipass!hp
}

Service check on an IBM Server:

# Check IBM Server hardware
define service{
use generic-service
host_name esxi3
service_description Hardware
check_command check_esxi_hardware!root!mypass!ibm
}

Service check on an IBM Server where System Event Log alerts should be ignored :

# Check IBM Server hardware
define service{
use generic-service
host_name esxi3
service_description Hardware
check_command check_esxi_hardware!root!mypass!ibm!-i «IPMI SEL»
}

————

File handling for user and password (for better security!)
Since version 20110505 it is possible to use a file as password-source. The string in the given file is used as password.
Since version 20110614 the file can be used for both username and password.
This is a big security advantage, because the process on the Nagios server won’t show the username or password in cleartext. If no file is used, these values will be shown in cleartext in the processlist.

Please watch out for the correct usage!

Example 1: You want to use a file (/home/nagios/.esxipass) which contains username and password. Note that two strings are separated by a space:

# cat /home/nagios/.esxipass
root mypass123

# ./check_esxi_hardware.py -H 172.17.16.131 -U file:/home/nagios/.esxipass -P file:/home/nagios/.esxipass -V dell

Example 2: You only want to use a file for the password. Note that there is only one string in the file:

# cat /home/nagios/.esxipass
mypass123

# ./check_esxi_hardware.py -H 172.17.16.131 -U root -P file:/home/nagios/.esxipass -V dell

 

Оставьте комментарий

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.