INT 21h

Hi, I am Vladimir Smagin, SysAdmin. Telegram Email GPG / Микроблог

Zabbix: monitor bash script results

№ 9533 В разделе "Администрирование" от November 10th, 2018,

Install zabbix-agent (sometimes zabbix-sender) package to your server that contains zabbix_sender. Now add some exit codes checks after every monitored command.

source /etc/profile
cd /tmp
weekday=$(date '+%w') # 7 days history
monthday=$(date '+%d') # whole month


pg_dump postgresql://postgres@| gzip > db_backup_$history.sql.gz
if [ $? -ne 0 ]
    echo "pg_dump failed to dump"
    /usr/bin/zabbix_sender -z -s pg2-server -k pgdumper.dump -o failed
    rm -f db_backup_$history.sql.gz
    exit 1
    /usr/bin/zabbix_sender -z -s pg2-server -k pgdumper.dump -o successful
    curl -u ftp_login:ftp_password$history/db_backup_$history.sql.gz \
         --ftp-create-dirs -T db_backup_$history.sql.gz
    if [ $? -ne 0 ]
            echo "curl failed to upload dumped file"
            /usr/bin/zabbix_sender -z -s pg2-server -k pgdumper.upload -o failed
            rm -f db_backup_$history.sql.gz
            exit 1
    /usr/bin/zabbix_sender -z -s pg2-server -k pgdumper.upload -o successful
    rm -f db_backup_$history.sql.gz

Create template

Add your monitored items

And add triggers to raise exceptions

You can combine items in one trigger

Do not forget to activate email notices.

Нет комментариев »

Leave a Reply

Your email address will not be published. Required fields are marked *


Микроблог перейти

# 2018-11-26 09:15:41

Обнаружил в kubedb код google analytics UA-62096468-20, слежка включена по умолчанию.

# 2018-11-24 23:30:12

Несложно смог контейнеризовать nginx unit с предзагрузкой конфигурации перед стартом контейнера

© Vladimir Smagin, 2005-2018. Копирование материалов без разрешения запрещено. GPG 0x29AE91B1A37721C3

Fortune cookie: "If a person's personal religious beliefs are sacred, they should not be peddled door-to-door like Girl Scout Cookies." [Marilyn Burge]