Installation (Legacy)
NOTE: This is the legacy page which refers to the legacy wmic command line binary. For information using the new wmic_server, refer to Installation
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 WMI client, wmic from Zenoss.
The information on how to get wmic up and running was originally available on Matthieu Thibault’s site but that appears to have now disappeared. There is a comprehensive installation example here.
We actually found an RPM containing wmic on rpm.pbone.net (search for wmic). It worked but I did choose to download the source from Zenoss and compile my own as it end up being smaller.
Update: Seems the source is missing from the zenoss.org site, maybe they have moved it somewhere else. There is a copy of it here.
Update 2021: You will most likely want this version of the wmic source since this one works with Windows 10 v2004 and above.
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.49 and earlier
Fedora 14 with Perl 5.12, Nagios 3.2.3 and pnp4nagios v0.4.14.
Version 1.50 and later
Fedora 16 with Perl 5.14, Nagios 3.3.1 and pnp4nagios v0.4.14.
Version 1.60 and later
Fedora 22 with Perl 5.20, Nagios 3.5.1 and pnp4nagios v0.6.22.
Version 1.61 and later
Fedora 24 with Perl 5.22, Nagios 4.0.8 and pnp4nagios v0.6.25.
Version 1.64 and later
Fedora 28 with Perl 5.26, Nagios 4.3.4 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.