check_vmware_snapshots

Posted on October 29th, 2012 by simon

check_vmware_snapshots

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.

Das Plugin fußt auf der Idee von Sebastian Kayser, der eine erste Version des Scriptes hier auf ConSol* Labs vorgestellt hat. 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. Mit Version 0.13 kam der Parameter –separator hinzu, mit welchem/n Zeichen zum Verketten der einzelnen Snapshot/VM-Meldungen angegeben werden, um z.B. der besseren Übersicht wegen Zeilenumbrüche einzubauen. Weitere Vorschläge nehme ich gerne entgegen!

Download

check_vmware_snapshots_0.13.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 Alter”:

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-).*'
    ...
    }

Beispielhafter Output:

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

4 Responses to “check_vmware_snapshots”

  1. Andreas Seemueller Says:
    March 13th, 2013 at 11:39

    Dear consol team,

    Thank you for this very good plugin. What I am missing is a switch to specifiy the name / IP address of a virtual machine and check only this VM. Because for reporting / operations in splitted teams this would make more sense even if it generates higher loads.

    Would this be an idea for a new release?

    With best regards

    Andi

    [Reply]

  2. simon Says:
    April 18th, 2013 at 20:52

    Hi Andi, thanks for your suggestion. I have added –whitelist and –blacklist to version 0.12 as an option to select/deselect virtual machines with regular expression. Regards, Simon

    [Reply]

  3. Reinhard Weh Says:
    May 3rd, 2013 at 9:41

    Hallo Simon, was genau für ein SKD / Toolkit benötige ich denn um dieses Plugin zu nutzen ich vermute http://communities.vmware.com/community/vmtn/developer/forums/vsphere_sdk_perl

    oder ist das zu oversized. Grüße Reinhard

    [Reply]

    simon Reply:

    Hallo Reinhard, genau das ist es. Grüße! – Simon

    [Reply]

Leave a Reply