Last active
December 9, 2015 22:59
-
-
Save rodrigolang/4341352 to your computer and use it in GitHub Desktop.
Exemplo de script para enviar dados aos items configurados como "Zabbix trapper".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Autor: Rodrigo Lang | |
# Data: 02/01/2013 | |
SENDER='/usr/local/zabbix/bin/zabbix_sender' | |
HOST='Zabbix server' | |
IP='127.0.0.1' | |
ALL_DBS=$(psql --dbname postgres -Atc "SELECT pg_database.datname, PG_DATABASE_SIZE(pg_database.datname) AS SIZE FROM pg_database") | |
for i in $ALL_DBS; do | |
DB_NAME=$(echo $i | cut -d'|' -f1) | |
DB_SIZE=$(echo $i | cut -d'|' -f2) | |
$SENDER -s"$HOST" -z"$IP" -k"pgsql.db.size[$DB_NAME]" -o"$DB_SIZE" >/dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment