Blog

Windows: Agentless Monitoring using Opsview 4.0

webteam's pictureAdministrator |

Introduction

Opsview provides both agentless and agent-based monitoring of Windows, Linux, and Unix systems, as well as network equipment - including operating system metrics, service state, process state, file system usage, and more.

Agentless technologies like WMI and SNMP allow IT administrator to deploy monitoring solutions without having to install agent software on each monitored system. Effective agentless monitoring offers a number of benefits including improved server, services and application availability, fast detection of server and operating system failures and reduced deployment time.

In this blog post we outline how to set up agentless monitoring for a Windows server.

*NOTE: For Opsview 4.2 (Enterprise and Pro), WMI Agentless monitoring is out of the box. As such, you will not need to complete the below steps. Please follow the howto guide here instead.

Pre-requisites

We need to install an open source WMI Client, as previous versions (Ubuntu packaged .deb versions of WMI-Client, for example) do not work with newer versions of Windows (2008, 7, etc).

We also need to install the check_wmi_plus.pl script, which requires some configuration, along with some modules via CPAN/APT.

Background Information

In the example environment used for this setup, we have a Ubuntu 10.04 x64 server, however aside from the plugins/packages downloaded by APT (which can be downloaded via alternatives package managers) the steps are nearly identical.

 

WMI
Click to enlarge

 

Installation

Firstly, we must install some pre-requisite packages on our server. These are “gcc”, “automake” and “DateTime.pm” (A perl module required):

sudo apt-get install autoconf gcc libdatetime-perl

Once done, we will now install the underlying WMI client. Firstly, change directory to /home/user (or wherever you would like the config work to be done, however this is all relative).

Secondly, download the source from the link below and extract:

wget http://www.opsview.com/sites/default/files/wmi-1.3.16.tar_.bz2

bunzip2 wmi-1.3.16.tar_.bz2

tar -xvf wmi-1.3.16.tar_

cd wmi-1.3.16/

Now we are in the wmi folder, we will need to set the location of our “../bin/python” directory; in our case using Ubuntu, it is in /usr, so:

export ZENHOME=/usr

This tells the program to look for /bin/python in /usr, i.e. /usr/bin/python (the fqdn).

Next, we will need to edit “GNUmakefile” as below, and find and comment out / delete the line “USE_BREAKPAD=1”:

nano GNUmakefile

And comment out the line, so it looks like “#USE_BREAKPAD=1”.

Finally, we need to run “make” and the compilation will begin, this can take up to 10 minutes.

Lastly, we will need to move the newly created wmic into /bin, using the command below:

cp /home/ubuntu/wmi/wmi-1.3.16/Samba/source/bin/wmic /bin

Next we will need to install some Perl modules required:

perl -MCPAN -e shell

cpan>o conf urllist http://ppm.activestate.com/CPAN http://cpan.perl.org

cpan>o conf commit cpan>o conf prerequisites_policy follow

cpan>o conf commit cpan>install Config::IniFiles

Once done, we will next need to download the check_wmi_plus plugin and compile. To do this, we must first download and extract using the commands:

wget http://edcint.co.nz/checkwmiplus/sites/default/files/check_wmi_plus.v1.52.tar.gz

tar -zxvf check_wmi_plus.v1.52.tar.gz

You should “cd ….” again to a suitable location to extract and work on the plugin. Once extracted, we will need to copy/rename the sample config, so we have a copy we are working on, as below:

cp check_wmi_plus.conf.sample check_wmi_plus.conf

Once done, we will need to edit the new config using nano/vim etc:

nano check_wmi_plus.conf

There are a few items we need to edit:

  1. $base_dir="home/ubuntu/wmi/”; << This needs to be the folder where we extracted wmi, i.e. where the folder “wmi-1.3.16” lives.
  2. $wmic_command="/bin/wmic"; << This should be ok if you followed instructions, as this is where we moved our newly compiled “wmic” to.
  3. $wmi_ini_file='/home/ubuntu/wmi/check_wmi_plus.d/check_wmi_plus.ini'; << This should be where the “check_wmi_plus.ini” file lives, normally within the extracted “check_wmi_plus.d” folder.
  4. $wmi_ini_dir="/home/ubuntu/wmi/check_wmi_plus.d/" << As above.

Once this file is edited and tailored per your system/install, we should be almost ready to test. Finally, we need to edit the plugin itself and edit the value, so:

nano check_wmi_plus.pl my $conf_file='/home/ubuntu/wmi/check_wmi_plus.conf';

To point to our newly created/edited config file at /home/ubuntu/wmi/.

Wrap-up

So now we should have the wmic program downloaded and compiled, the required Perl modules downloaded and installed, and the check_wmi_plus plugin downloaded, compiled and customised.

We can test our plugin against a WMI enabled Windows machine (WMI enabled means someone has gone into the server, “start > run > services.msc (enter) >” scrolled down to “WMI Performance Adapter” and “started” it.

To test, run a command similar to below:

root@devvm:/home/ubuntu/wmi# ./check_wmi_plus.pl -H 192.168.11.107 -u root -p opsview -m checkcpu

OK (Sample Period 489 sec) - Average CPU Utilisation 6.69%|'Avg CPU Utilisation'=6.69%;

Where “-H” is for host, “-u” is for user, and “-p” is for password. “-m” is the mode (“-s” is where we add the sub-mode). If the command works, you should see an output as above.

Conclusion

If you see the output as above, congratulations - your Opsview server is now monitoring a Windows server without an agent!

Administrator |