Add start of script to update zabbix
This commit is contained in:
52
update-zabbix-backup-status.sh
Executable file
52
update-zabbix-backup-status.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# script to send info about a backup to zabbix.
|
||||
# Usage:
|
||||
# update-zabbix-backup-status.sh [-sf] HOSTNAME SERVICE_NAME [DURATION] [SIZE]
|
||||
# parameters:
|
||||
# -s Backup succeeded (required if not failed)
|
||||
# -f Backup failed (required if not succeeded)
|
||||
# HOSTNAME hostname of the host that performed the backup
|
||||
# SERVICE_NAME name of the service that was backed up
|
||||
# DURATION duration of the backup
|
||||
# SIZE Size in bytes of the transfered files
|
||||
|
||||
function print_help
|
||||
{
|
||||
echo "script to send info about a backup to zabbix."
|
||||
echo "Usage:"
|
||||
echo " update-zabbix-backup-status.sh [-sf] HOSTNAME SERVICE_NAME [DURATION] [SIZE]"
|
||||
echo "parameters:"
|
||||
echo " -s Backup succeeded (required if not failed)"
|
||||
echo " -f Backup failed (required if not succeeded)"
|
||||
echo " -h Show this message"
|
||||
echo " HOSTNAME hostname of the host that performed the backup"
|
||||
echo " SERVICE_NAME name of the service that was backed up"
|
||||
echo " DURATION duration of the backup. Only needed if succeeded"
|
||||
echo " SIZE Size in bytes of the transfered files. Only needed if succeeded"
|
||||
}
|
||||
|
||||
if [ -z $1 ]
|
||||
then
|
||||
echo "Please provide arguments. Use -h to show help"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "-h" ]
|
||||
then
|
||||
print_help
|
||||
fi
|
||||
|
||||
if ! command -v zabbix_sender >/dev/null 2>&1
|
||||
then
|
||||
echo "zabbix_sender could not be found. Is it and the zabbix_agent2 installed?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# TODO implement sending items to zabbix
|
||||
# Use zabbix_sender directly? (for some reason not installed on games vm) https://www.zabbix.com/documentation/current/en/manual/concepts/sender
|
||||
|
||||
# Or create python script and use python library? https://www.zabbix.com/documentation/current/en/devel/python
|
||||
# if using python script I can run the rsync backup command using subprocess, and catch the output of that
|
||||
# then I can check the bytes sent to calculate the size
|
||||
|
||||
Reference in New Issue
Block a user