Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check snapshots age and number
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
The script was inspired by "minuti_keytech"'s script check_esx_snapshot.
Usage: $0 [esxi_hostname] [warn] [crit] [snapage]
where [warn] and [crit] are the allowed numbers of snapshots and [snapage] is how old a snapshot is allowed to be.
Reviews (5)
byareasistemi, April 21, 2021
I tried it on esxi 6.5 nodes and it works successfully.
As per instructions, it is necessary to configure a ssh certificate in order to allow the connection from the nagios server to the esxi nodes.
It only checks if snapshots are present, and it is not possible to filter the checked VMs.
As per instructions, it is necessary to configure a ssh certificate in order to allow the connection from the nagios server to the esxi nodes.
It only checks if snapshots are present, and it is not possible to filter the checked VMs.
bymartinh, February 8, 2021
Hi,
I just tried this on VMWare 7.0U1, still working :)
I just tried this on VMWare 7.0U1, still working :)
I have ESXi 5.5. If i run this script in console it works great. But in nagios it is always OK status, even i have critical value. What can i do, to fix this?
bymwill, November 2, 2014
btw - the script is also compatible with esxi 5.x
#!/bin/bash
# Author Stefan Nonchev
# Nagios script for checking the number of existing snapshots and how old are these.
# The script should work with any ESXi 5.x
# Installation notes:
# On your nagios server execute:
#
# #sudo nagios
# #ssh-keygen
# copy the public certificate into /etc/ssh/keys-root/authorized_keys on each ESXi host that will be monitored
debug=1
sshparameter=""
print_usage() {
echo ""
echo "Usage: $0 [esxi_hostname] [warn] [crit] [snapage]"
echo "where"
echo "- [warn] and [crit] are the allowed numbers of all snapshots (summarized)"
echo "- [snapage] is how old a snapshot is allowed to be (days)"
exit 3
}
case "$1" in
--help)
print_usage
;;
-h)
print_usage
;;
esac
if [ "$#" -ne "4" ]; then
print_usage
fi
function date2stamp () {
date --utc --date "$1" +%s
}
function dateDiff () {
sec=86400
dte1=$(date2stamp $1)
dte2=$(date2stamp $2)
diffSec=$((dte2-dte1))
if ((diffSec $4 days ) snapshots on: $vmstr"
exit 2
fi
if [ $total -le $warn ] ; then
echo "OK - $total snapshots found (warn=$warn)"
exit 0
fi
if [ $total -ge $crit ] ; then
echo "CRITICAL - $total snapshots found (crit=$crit)"
exit 2
fi
if [ $total -ge $warn ] ; then
echo "WARN - $total snapshots found (warn=$warn)"
exit 1
fi
#!/bin/bash
# Author Stefan Nonchev
# Nagios script for checking the number of existing snapshots and how old are these.
# The script should work with any ESXi 5.x
# Installation notes:
# On your nagios server execute:
#
# #sudo nagios
# #ssh-keygen
# copy the public certificate into /etc/ssh/keys-root/authorized_keys on each ESXi host that will be monitored
debug=1
sshparameter=""
print_usage() {
echo ""
echo "Usage: $0 [esxi_hostname] [warn] [crit] [snapage]"
echo "where"
echo "- [warn] and [crit] are the allowed numbers of all snapshots (summarized)"
echo "- [snapage] is how old a snapshot is allowed to be (days)"
exit 3
}
case "$1" in
--help)
print_usage
;;
-h)
print_usage
;;
esac
if [ "$#" -ne "4" ]; then
print_usage
fi
function date2stamp () {
date --utc --date "$1" +%s
}
function dateDiff () {
sec=86400
dte1=$(date2stamp $1)
dte2=$(date2stamp $2)
diffSec=$((dte2-dte1))
if ((diffSec $4 days ) snapshots on: $vmstr"
exit 2
fi
if [ $total -le $warn ] ; then
echo "OK - $total snapshots found (warn=$warn)"
exit 0
fi
if [ $total -ge $crit ] ; then
echo "CRITICAL - $total snapshots found (crit=$crit)"
exit 2
fi
if [ $total -ge $warn ] ; then
echo "WARN - $total snapshots found (warn=$warn)"
exit 1
fi
bycaramia, August 26, 2014
Hi, i'm tring to use your plugin but i can't embed my credential on check command, also if i use it from cli on nagios server il stuck on password.
I'm wrong in the syntax?
./check_VM_snapshots 172.17.85.1 10 20 10
thanks
I'm wrong in the syntax?
./check_VM_snapshots 172.17.85.1 10 20 10
thanks
Owner's reply
Hi, sorry for the late reply mate.
If you are able to ssh successfully from nagios to ESXi server without prompting you for a password - the script should work. I'm not using any passwords to run the script in my environment. I guess you have to google how to configure ssh without using a password.