Mit check_vmware_snapshots lassen sich Alter und Anzahl der Snapshots überwachen, die in einer ESXi/vSphere-Umgebung vorhanden sind. Der Check wird dabei direkt ans vCenter gerichtet und hangelt sich durch alle virtuellen Maschinen; je nach gewähltem Plugin Modus (age/count) wird dabei entweder alarmiert, wenn entweder das Alter eines/mehrerer Snapshots oder die Anzahl der erlaubten Snapshots pro VM überschritten wird.

check_vmware_snapshots

check_vmware_snapshots is a plugin to check the age and count fo VM snapshots in a VMWare ESXi/vSphere environment. It checks the vCenter’s database and is able to list all snapshots which are older than X days or more than the allowed count per virtual machine.

The plugin is based on the idea of Sebastian Kayser, who presented the first version here on ConSol Labs.
With version 0.12 you can also define a whitelist/blackist to select/exclude virtual machines.
Version 0.12 ermöglicht es, mit White/Blacklisting-Ausdrücken VMs von der Prüfung auszuschließen oder nur eine Teilmenge zu prüfen.
Version 0.13 includes parameter –separator, which you can use to define a separator string for the message concatenation, for example if you want to insert a newline after each message.
Version 0.15 introduces the parameter –match_snapshot_names, which allows you to black/whitelist also certain snapshots with their name.
Please feel free to contact me for any further development.

Download

check_vmware_snapshots.pl_0.15.tar

Definition

Command:

define command{
command_name check_vmware_snapshots
     command_line $USER1$/check_vmware_snapshots.pl --server $HOSTADDRESS$ --username $ARG1$ --password $ARG2$ --mode $ARG3$ --critical $ARG4$ --warning $ARG5$
}

Service “Snapshot age “:

define service{
    service_description Snapshot Age
    check_command check_vmware_snapshots!$USER4$!$USER5$!age!7!30
    ...
}

Service “Snapshot Count”:

define service{
    service_description Snapshot Count
    check_command check_vmware_snapshots!$USER4$!$USER5$!count!1!2
    ...
}

Service “Snapshot Count for all DWH VMs”:

define service{
    service_description            Snapshot Count for all DWH VMs
    check_command                  check_vmware_snapshots!$USER4$!$USER5$!count!1!2!--whitelist 'emDWH.*'
    ...
    }

Service “Snapshot Count for all but not dev and test machines”:

define service{
    service_description            Snapshot Count
    check_command                  check_vmware_snapshots!$USER4$!$USER5$!count!1!2!--blacklist '^(dev-|test-).*'
    ...
    }

Service “Snapshot Count, excluding QA snapshots”

define service{
    service_description            Snapshot Count
    check_command                  check_vmware_snapshots!$USER4$!$USER5$!count!1!2!--blacklist '^snapshot_(dev-|test-).*' --match_snapshot_names=1
    ...
    }

Output example:

CRITICAL - 8 outdated VM snapshots found!, Snapshot "130416_1700" (VM: 'vCenter') is 9 days old, Snapshot "01_vcenter frisch installiert" (VM: 'vCenter') is 9 days old, Snapshot "FooSnap" (VM: 'linux02') is 7 days old, Snapshot "Foo2snaps" (VM: 'linux02') is 7 days old, Snapshot "130416_1700" (VM: 'linux02') is 9 days old, Snapshot "130416_1700" (VM: 'linux03') is 9 days old, Snapshot "130416_1700" (VM: 'linux04') is 9 days old, Snapshot "130416_1700" (VM: 'linux01') is 9 days old | outdated_snapshots=8snapshots;2;4
WARNING - 2 VMs with too much snapshots!, VM "vCenter" has 2 snapshots, VM "linux02" has 3 snapshots | snapshot_count=2snapshots;1;4