DROP ALL TABLES в MySQL

The heading at this note is a bit wrong. In MySQL there is no such command, and it would be desirable, that it was. Sometimes there are problems in which we want to remove all tables of a DB, but not her (that there were its parametres, such as access rights, codings, etc.). To solve such problem it is possible with the help command:

a=name;b=pass;c=base;mysqldump -u$a -p$b --add-drop-table --no-data $c|grep ^DROP|mysql -u$a -p$b $c

The first command of the conveyor we create «dump» the databases, consisting of every possible DROP TABLE, but without the data. The second command we choose only the lines beginning with DROP, and at last, we fill in the received commands in MySQL.

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

Scroll to top