Zabbix Agent 1.8¶
preliminary note¶
this is mostly taken from http://www.torservers.net/wiki/setup/zabbix
Firewall¶
In case you use iptables you need to open port 10050 on the client side and 10050 and 10051 on the server side (or any other port of course if you configured Zabbix to use non-standard ports). As an alternative you can also use Active Checks which don't require open Ports on the Nodes that are to be monitored and also help to reduce load on the Server side, since the Client does all the work itself in this case.
Advanced¶
stunnel¶
UserParameter=hdd.sda.temperature,/etc/zabbix/scripts/get_smart_value.sh /dev/sda Temperature_Celsius
UserParameter=hdd.sda.raw_read_error_rate,/etc/zabbix/scripts/get_smart_value.sh /dev/sda Raw_Read_Error_Rate
UserParameter=hdd.sda.reallocated_sector_count,/etc/zabbix/scripts/get_smart_value.sh /dev/sda Reallocated_Sector_Ct
UserParameter=hdd.sdb.temperature,/etc/zabbix/scripts/get_smart_value.sh /dev/sdb Temperature_Celsius
UserParameter=hdd.sdb.raw_read_error_rate,/etc/zabbix/scripts/get_smart_value.sh /dev/sdb Raw_Read_Error_Rate
UserParameter=hdd.sdb.reallocated_sector_count,/etc/zabbix/scripts/get_smart_value.sh /dev/sdb Reallocated_Sector_Ct
Custom Scripts "md"¶
Here is a small script for monitoring md. It can only monitor Raid1 systems so far, since we don't have the need to monitor Raid5 or anything else. Feel free to expand this in case you need it.
#!/bin/bash
if [ $# -ne 1 ];
then
echo "Usage: $0 "
exit
fi
var_mdnum="$1"
if [[ "$var_mdnum" != md* ]]
then
var_mdnum=`echo $var_mdnum | sed 's/\/[a-z]*\/md*/md/'`
fi
if [ `cat /proc/mdstat | grep -C 1 $var_mdnum | grep -o UU` == "UU" ]
then
echo 0
exit
else
echo 1
exit
fi
Put something like
UserParameter=raid.md0.status, /etc/zabbix/scripts/get_md_status.sh md0
in your zabbix_agentd.conf to use this and configure an Item for it on the Zabbix Server for the node you wish to use this for or in its underlying template.
Custom Scripts "Smart"¶
#!/bin/bash
if [ $# -ne 2 ];
then
echo "Usage: $0 <device> <parameter>"
exit
fi
sudo smartctl -A $1 | grep $2 | tr -s ' ' | sed "s/^[[:space:]]*\(.*\)[[:space:]]*$/\1/" | cut -d " " -f 10
Make sure smartmontools are installed and accessible for Zabbix.
You might need something like
%zabbix ALL= NOPASSWD: /usr/sbin/smartctl
in your sudoers file.
Here are my UserParameters:
UserParameter=hdd.sda.temperature,/etc/zabbix/scripts/get_smart_value.sh /dev/sda Temperature_Celsius
UserParameter=hdd.sda.raw_read_error_rate,/etc/zabbix/scripts/get_smart_value.sh /dev/sda Raw_Read_Error_Rate
UserParameter=hdd.sda.reallocated_sector_count,/etc/zabbix/scripts/get_smart_value.sh /dev/sda Reallocated_Sector_Ct
UserParameter=hdd.sdb.temperature,/etc/zabbix/scripts/get_smart_value.sh /dev/sdb Temperature_Celsius
UserParameter=hdd.sdb.raw_read_error_rate,/etc/zabbix/scripts/get_smart_value.sh /dev/sdb Raw_Read_Error_Rate
UserParameter=hdd.sdb.reallocated_sector_count,/etc/zabbix/scripts/get_smart_value.sh /dev/sdb Reallocated_Sector_Ct
FPing¶
When using Active Checks you might still want to Monitor a hosts uptime. For this you need to install fping on the Server and do a chown root:zabbix on its binary for zabbix to be able to use it.
Von Jeremias Keihsler vor fast 8 Jahren aktualisiert · 1 Revisionen