Archive for the ‘Zabbix’ Category
Monitor Varnish with Zabbix
Add the following to the end of /etc/zabbix/zabbix_agentd.conf
# Varnish Keys
UserParameter=varnish.stat[*],(test -f /usr/bin/varnishstat && varnishstat -1 -f $1 | awk ‘{print $$2}’)
Restart the Zabbix agent
/etc/init.d/zabbix-agent restart
Monitor SELinux with Zabbix
Add the following to the end of /etc/zabbix/zabbix_agentd.conf
# SELinux Keys
UserParameter=selinux.status,/usr/sbin/sestatus | grep status | awk ‘{print $NF}’ | sed s/enabled/1/ | sed s/disabled/0/
UserParameter=selinux.mode,if [[ $(/usr/sbin/sestatus | egrep “status.*enabled”) ]]; then /usr/sbin/sestatus | grep mode | awk ‘{print $NF}’ | sed s/enforcing/1/ | sed s/permissive/0/; else echo 2; fi
UserParameter=selinux.boolean[*],if [[ $(/usr/sbin/sestatus | egrep “status.*enabled”) ]]; then /usr/sbin/sestatus -b | grep “^$1 ” | awk ‘{print $NF}’ | sed s/off/0/ | sed s/on/1/; else echo 2; fi
Restart the Zabbix agent
/etc/init.d/zabbix-agent restart
Monitor PostgreSQL with Zabbix
Submitted by bchavet on Mon, 01/16/2012 – 17:33
# PostgreSQL Keys
UserParameter=psql.version,/usr/bin/psql –version | head -n 1
UserParameter=psql.size,/usr/bin/psql -t -c “select sum(pg_database_size(datid)) as total_size from pg_stat_database”
UserParameter=psql.stat[*],/usr/bin/psql -t -c “select sum($1) from pg_stat_database”
‹ Monitor Nginx with Zabbix
Monitor Nginx with Zabbix
Configure a new nginx server listening on an alternate port (61709 in this example). This allows access to this information to be controlled.
server {
listen 61709;
location / {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
Reload Nginx
/etc/init.d/nginx reload
Add the following to the end of /etc/zabbix/zabbix_agentd.conf
#Nginx Keys
# NginX Keys
UserParameter=nginx.active[*],wget -O- -q $1:$2 | awk ‘/^Active/ {print $NF}’
UserParameter=nginx.reading[*],wget -O- -q $1:$2 | awk ‘/Reading/ {print $$2}’
UserParameter=nginx.writing[*],wget -O- -q $1:$2 | awk ‘/Writing/ {print $$4}’
UserParameter=nginx.waiting[*],wget -O- -q $1:$2 | awk ‘/Waiting/ {print $$6}’
UserParameter=nginx.accepted[*],wget -O- -q $1:$2 | awk ‘/^[ \t]+[0-9]+[ \t]+[0-9]+[ \t]+[0-9]+/ {print $$1}’
UserParameter=nginx.handled[*],wget -O- -q $1:$2 | awk ‘/^[ \t]+[0-9]+[ \t]+[0-9]+[ \t]+[0-9]+/ {print $$2}’
UserParameter=nginx.requests[*],wget -O- -q $1:$2 | awk ‘/^[ \t]+[0-9]+[ \t]+[0-9]+[ \t]+[0-9]+/ {print $$3}’
Restart the Zabbix agent
/etc/init.d/zabbix-agent restart
To use these UserParameters, set the host (localhost) and port (61709) in the key
nginx.active[localhost,61709]
Monitor Memcached with Zabbix
Insert the following to the end of /etc/zabbix/zabbix_agentd.conf.d/memcached.conf
UserParameter=memcached.stats[*],(echo stats; sleep 0.1) | telnet localhost 11211 2>&1 | awk ‘/STAT $1/ {print $NF}’
ZTC (Zabbix Templates Collection) – the simple way to use the templates of zabbix – Linux, PostgreSQL, Slony, Nginx, Apache2, Mongo etc.
These the instruction are correct for the version of package 12.0.
Now, we describe step by step all the process in the very simple form:
1. Download the archive tar.gz ztc-12.01.1.tar.gz and save to any the temporary directory, for example – /tmp. (CLIENT SIDE!!)
Monitor Apache2 with zabbix-agentd with the help UserParameters.
Enable mod_status
a2enmod status
Configure mod_status (/etc/apache2/mods-enabled/status.conf on Debian)
Read the rest of this entry »
Monitor MySQL with zabbix-agentd with the help UserParameters.
For the use Zabbix’s template with the name Template App MySQL neccessary create the file:
localhost:/etc/zabbix/zabbix-agentd.conf.d # ll -rw-r--r-- 1 root root 418 Oct 31 15:07 userparameter_mysql.conf localhost:/etc/zabbix/zabbix-agentd.conf.d #
How to make Zabbix 2.0 – quick start up server (DATABASE+PHP) on OpenSuSe 12.1.
First step:
mysql -u root -p create database zabbix character set utf8; create user 'zabbix'@'localhost' identified by 'XXX'; grant all privileges on zabbix.* to 'zabbix'@'localhost'; mysql -u root -p zabbix < /usr/share/doc/packages/zabbix-server/mysql/schema.sql mysql -u root -p zabbix < /usr/share/doc/packages/zabbix-server/mysql/images.sql mysql -u root -p zabbix < /usr/share/doc/packages/zabbix-server/mysql/data.sql
Second step:
/etc/php5/apache2/php.ini file: post_max_size = 16M max_execution_time = 300 max_input_time = 300 date.timezone = "Europe/Minsk"