Simple nagios check script to monitor pve-zsync included

mailinglists

Renowned Member
Mar 14, 2012
641
68
93
I just took 5 minutes and wrote this, as there are no nagios plugins existing for monitoring pve-zsync jobs.
Haven't really tested it yet, just sent it to my coworker, but I guess it should work as expected.
Feel free to make it more advanced, share your mods back or just use as is.
Code:
root@fer:/usr/local/nagios/libexec# cat check_pveZsync.sh
#!/bin/bash
# Poop simple script to check Proxmox pve-zsync.
# ExitCode:
# 0 = Ok
# 1 = Warning
# 2 = Critical
# 4 = Ok (No replicatons configured)

if [ ! "`pve-zsync list | awk '{print $3}' | grep -v ok | grep -v syncing | grep -v STATE`" ]
    then
    echo "OK: No pve-zsync jobs or all in OK / syncing state."
    exit 0

        elif [ "`pve-zsync list | awk '{print $3}' | grep stopped | grep -v STATE`" ]
        then
            echo "WARNING: Some jobs are in a stopped state. Please check."
            exit 1
        elif [ "`pve-zsync list | awk '{print $3}' | grep -v stopped | grep -v ok | grep -v syncing | grep -v STATE`" ]
        then
            echo "CRITICAL: Some jobs are in a failed state! Please check."
            exit 2
        fi
fi
root@fer:/usr/local/nagios/libexec# ./check_pveZsync.sh
OK: No pve-zsync jobs or all in OK / syncing state.
 
  • Like
Reactions: Moayad and guletz
Did something happen on copy/paste? The if statement is nested at 'elsif' and has two 'fi' for closing the statement.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!