Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

check_VMSnapShot

Rating
0 votes
Favoured:
0
Hits
86113
Nagios CSP

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!
#!/bin/bash

if [ $# -lt 1 ]
then
echo "Aufruf mit: $0 "
exit 3
fi

# Variablen dekleration
LAUF=1 # selbsterklärend
MAX=0 # Maximum Snapshots
AKT=0 # Nr. von Snapshots für den jeweiligen server
ERG="|" # Formatierung für Performance Daten
LIST=$(find /vmfs/volumes/ -name '*.vmsn'| cut -c 51- |sed -e s"//.*$/"/)
LAST=$LIST
FIRST=0

LAST=$(echo $LAST |awk '{print $1}')
#echo DEBUG:LAST=$LAST
#echo DEBUG:LIST=$LIST
#für jeden Snapshot den du findest:
for X in $LIST
do
#echo "DEBUG: Erg: $X"

#Handelt es sich bei dem Durchlauf um den selben Server wie beim letzten ?
if [ "$LAST" = "$X" ]
then
AKT=$(($AKT + 1))
if [ $AKT -gt $MAX ]
then
MAX=$AKT
fi
else
if [ $FIRST -eq 0 ]
then
ERG=$(echo $ERG$LAST=$AKT)
FIRST=1
else
ERG=$(echo "$ERG, $LAST=$AKT")
fi
AKT=1
fi
LAST=$X
done

if [ $MAX -gt $1 ]
then
#echo "DEBUG: Max ist: $MAX, Schwellwert: $1"
echo "ERROR - Gefunden: $MAX, Schwellwert: $1"
echo $ERG
exit 2
fi

if [ $MAX -lt $1 ]
then
#echo "DEBUG: Max ist: $MAX, Schwellwert: $1"
echo "OK - Gefunden: $MAX, Schwellwert: $1"
echo $ERG
exit 0
fi

if [ $MAX -eq $1 ]
then
#echo "DEBUG: Max ist: $MAX, Schwellwert: $1"
echo "WARNING - Gefunden: $MAX, Schwellwert: $1"
echo $ERG
exit 1
fi