Installation
NOTE: For the legacy information refer to Installation (Legacy)
This is only some basic information. I’m going to assume that if you are even looking at adding plugins to Nagios that you have some idea of what you are doing.
Prerequisites
Check WMI Plus requires the WMIC Server which is part of the aiowmi project. To install that simply change into the directory where you want it installed and git clone https://github.com/cesbit/aiowmi
. The github page for WMIC Server contains information on how to install that. In summary, you create a long running API server that accepts WMI queries from Check WMI Plus. WMIC Server forwards the WMI queries to the target Windows host.
Test the WMIC Server following the sample usage instructions
You will need the following Perl modules. Development uses the versions shown. If you use any other version you may experience errors. Let us know about errors that might be version related as it may be possible to code the plugin around them. You will need to be prepared to help test any fixes.
Installation of the perl modules might depend on your Linux distribution. For Fedora, they are all installed with Perl itself or available as packages (perl-Config-IniFiles
, perl-DateTime
, perl-Scalar-List-Utils
and perl-Number-Format
,
perl-JSON
). The other way to install perl modules is to use the cpan command eg cpan install Config::IniFiles
You can find your own module versions by running
check_wmi_plus.pl -d -d | head -n 25
--------------------- Module Versions ---------------------
MODULE_NAME INSTALLED_VERSION STATUS DESIRED_VERSION
HTTP::Request::Common ok 0
JSON ok 0
Scalar::Util 1.62 ok 1.22
Getopt::Long 2.52 ok 2.38
Perl Version 5.034001 ok 5.01
Config::IniFiles 3.000003 ok 2.58
Storable 3.25 ok 2.22
LWP::UserAgent ok 0
Number::Format 1.75 ok 1.73
DateTime 1.57 ok 0.66
Data::Dumper 2.183 ok 2.125
If you want to use the ini file you will need the Config::IniFiles
Perl module.
There are other Perl Modules used, but these are very often installed along with Perl:
Getopt::Long
(to read the command line parameters)
Data::Dumper
(for debug mode)
DateTime
(for checks where we need to know time eg checkfileage, checkeventlog)
Scalar::Util
(for testing if valid data is returned from WMI query)
Storable
(for keeping state)
Number::Format
(for formatting numbers)
Plugin Configuration
We run the plugin from a specific directory and we have Nagios installed in certain directories. The plugin wants to know what these directories are. So if yours don’t match the defaults, you will need to change them.
Version 1.60 and later
Untar the download bundle to a temporary directory before moving the files to their final locations.
The download bundle contains all the executable files at the top level of the bundle. You will want to copy these files to a folder such as /usr/local/bin.
An etc folder is also contained in the bundle. This etc folder should be copied to /etc as this is now the default location for the config file and ini files.
Rename check_wmi_plus.conf.sample to check_wmi_plus.conf
Edit check_wmi_plus.conf and set all the directory locations. Hopefully, you will only need to do this the very first time you install Check WMI Plus
Make sure the config files are all readable and writable by the Nagios user)
Remove the temporary folder
There is a chance that you might need to edit the plugin itself as it relies on being able to find utils.pm from your nagios installation.
If you get errors complaining about utils.pm or %ERROR then you may need to change the lines:
use lib "/usr/lib/nagios/plugins";
use lib "/usr/lib64/nagios/plugins";
Testing
The plugin has been tested with the following other software versions:
Version 1.67 and later
Fedora 36 with Perl 5.34, Nagios 4.4.6 and pnp4nagios v0.6.25.
Tested with the following Windows versions:
Windows XP SP3 (32 bit)
Windows 7 (32 bit) (not tested very often)
Windows 10 Pro 64 bit
Windows Server 2003 R2 64 bit (Thanks to Grant Davies for the license)
Windows Server 2008 R2 64 bit
Windows Server 2012 (some testing performed – anyone want to give us a license so more testing can be done?)
Also, reported to largely work with Windows 2000.
We have done a lot of testing, but we bet we have not found everything that can go wrong. Let us know if you find something that needs fixing.