Icinga module for vsphere and alerts

Just installed and configured the official vcenterdb module for icinga2.


It is great! However, it seems this is relatively new, and there is not much documentation.

I have a few vcenters plugged in and it is gathering info as expected. Great. But now how can I create service alerts for this data? ie. If datastore fails, or datastore approaches certain threshold, critical alert.

Anybody have any documentation or information to point me in the right direction?

Hi,

the module is waiting for its 1.2.0 release, but already has a CLI command ā€¦ try something like icingacli vspheredb --help. Upon this you can construct specific checks, if I read the code correctly.

Cheers,
Michael

You have 6 options for service checks with this module:

# icingacli vspheredb check
datastore   datastores  host        hosts       vm          vms

The ones ending with an s are overall checks.
The others, datastore, host, vm require a specific object with the parameter --name,
icingacli vspheredb check host --name hostname

1 Like

Thanks guys. Definitely moves me in the right direction. I see these are direct checks from the CLI. So to create checks for icingaweb2 I would bash script this? Or is there a better way?

Additionally, what can we expect in the 1.2.0 release? Is upgrading the module as simple as replacing the files?

Is there a way to get all the output, as opposed to listing a few followed by ā€˜and X moreā€™

icingacli vspheredb check datastores

[WARNING] Overall status is ā€œyellowā€ for EQL1-vds18-ds, EQL1-xxx-ds18, EQL1-xxx-ds23, EQL1-xxx-ds25, EQL1-xxx-ds26 and 25 more

*EDIT: Nevermind. I edited /usr/share/icingaweb2/modules/vspheredb/application/clicommands and increased line 151 to 50 from 5 $showMax = 50;

cd /usr/share/icingaweb2/modules/vspheredb
git fetch -t
git checkout <version tag>

Same goes for any other icingaweb2 module (that is installed via git)

This might stop the above procedure from working, as you changed a file and git wants you to commit it first.

1 Like

Such things will be overridden on upgrade, please create a feature request/pull request so that this can be incorporated upstream :slight_smile:

In terms of a CheckCommand - it doesnā€™t exist yet, but you can create one following the other examples with icingacli already inside the ITL. Please name the command icingacli-vspheredb and maybe create an upstream PR for integrating it.

Hereā€™s an updated guide for creating check commands.

Cheers,
Michael

1 Like

Thanks guys. Will check this out. I created a bash script and a check command within icinga. Not 100% what im looking for but will suffice for now

Iā€™m a little confused on thisā€¦ I canā€™t locate documentation on the CLI commands for how ā€œNAMEā€ is to be called out. Anyone get beyond this?

[user@icinga01 ~ 12369]$ sudo icingacli vspheredb check

===================
Available actions:

datastore Check Datastore Health
datastores Check all Datastores
host Check Host Health
hosts Check all Hosts
vm Check Virtual Machine Health
vms Check all Virtual Machines

Show help on a specific action: icingacli help vspheredb check

[user@icinga01 ~ 12370]$ sudo icingacli vspheredb check host
[UNKNOWN] Required parameter ā€˜nameā€™ missing

Entered a ā€œNameā€

[user@icinga01 ~ 12371]$ sudo icingacli vspheredb check host redacted
[UNKNOWN] Required parameter ā€˜nameā€™ missing

Tried with ā€œNameā€ optionā€¦

[user@icinga01 ~ 12372]$ sudo icingacli vspheredb check host name redacted
[UNKNOWN] Required parameter ā€˜nameā€™ missing

Tried with equal ???

[user@icinga01 ~ 12373]$ sudo icingacli vspheredb check host name=redacted
[UNKNOWN] Required parameter ā€˜nameā€™ missing

Found itā€¦ peeked inside the /usr/share/icingaweb2/modules/vspheredb/application/clicommands/CheckCommand.php file.

Its "--name"

icingacli vspheredb check host [ --name ]

Would be nice if this was part of the output with "icingacli vspheredb check" is performed

[user@icinga01 clicommands 12384]$ sudo icingacli vspheredb check vm --name icinga01
Overall status is ā€œgreenā€
[WARNING] System booted 3m 16s ago