BaldMansMojo / check_vmware_esx

chech_vmware_esx Fork of check_vmware_api.pl
GNU General Public License v2.0
124 stars 67 forks source link

Add feature to request VM snapshots (enhanced/fixed lausser version) #140

Closed bb-Ricardo closed 5 years ago

bb-Ricardo commented 6 years ago

Hi,

this PR contains all commits I did to fix and enhance the --select=snaphots commit from @lausser.

This is now being used in our production environment and works quite well so far.

The Description

Snapshots
-------------
-S, --select=snapshots              List vm's wich have snapshots older or bigger than a certain threshold
-w, --warning=<threshold>           Warning threshold.
-c, --critical=<threshold>          Critical threshold.
-B, --exclude=<black_list>          Blacklist VMs.
-W, --include=<white_list>          Whitelist VMs.

                                    Use blacklist OR(!) whitelist. Using both in one statement
                                    is not allowed.

    --isregexp                      Whether to treat blacklist and whitelist as regexp
    --listall                       List all VMs with all snapshots.
    --poweredonly                   List only VMs which are powered on.
    --multiline                     Multiline output in overview. This mean technically that
                                    a multiline output uses a HTML <br> for the GUI instead of
                                    Be aware that your messing connections (email, SMS...) must use
                                    a filter to file out the <br>. A sed oneliner like the following
                                    will do the job: sed 's/<[^<>]*>//g'
or with
-s, --subselect=age                 Shows age of snapshots in days.
or
-s, --subselect=count               Counts the number of snapshots of VMs.

I've fixed a few problems with multiline output and added an option to only report snapshots of runnign VMs.