Thursday, August 25, 2016

Unattented mysql installation under Debian for scripts

export DEBIAN_FRONTEND=noninteractive && apt-get -y -f install mysql-server-5.6 && mysqladmin -u root password XXXXXXXXX
#create mysql database and user
mysql -uroot -pXXXXXXXXX -e'create database YYYYYYYY;'
mysql -uroot -pXXXXXXXXX -e'GRANT ALL PRIVILEGES ON YYYYYYYY.* TO "user"@"localhost" IDENTIFIED BY "ZZZZZZZZZzz"';'

Saturday, August 6, 2016

[Zabbix] How to monitor single processes

It is very simple to monitor processes. Just add a new template, or use any, create an item and a respective trigger for that item. The trigger should use trigger alarm on last value !=0. We will use exit 0 as all OK, exit 1 as issue!

Then put something like this in a .conf file in zabbix_conf.d/ directory

UserParameter=processes.postfix, if pgrep smtpd >/dev/null 2>&1; then echo 0 ;else echo 1; fi
UserParameter=processes.bind9, if pgrep named >/dev/null 2>&1; then echo 0 ;else echo 1; fi
UserParameter=processes.blacklist, if ps aux | grep [b]lacklist >/dev/null 2>&1; then echo 0 ;else echo 1; fi