SCOM 2012 R2 TP3 – Monitoring Apache Web Server

Apache-http-server

Few month ago, Microsoft released management packs for monitoring open source software like Apache HTTP Server or MySQL databases. In this post I would like to have an overview of monitoring Apache web server. So far there have not been many free options to actually monitor this web server, although it is a very common candidate out in the field. This management pack shows clearly Microsoft’s commitment to support open-source software in the SCOM world.

Support

This  current management pack supports version Apache HTTP Server version 2.2 and 2.4 if you install Apache from one of the SCOM supported Linux distributions. Find all supported *nix versions  here https://technet.microsoft.com/en-us/library/hh212713.aspx . In SUSE Linux Enterprise Server 11 there is Apache version 2.2 and in SUSE Linux Enterprise Server 12 there is Apache version 2.4 included. In this example I installed SUSE Enterprise Server 11 SP3.

The Apache management pack is part of the System Center 2016 Technical Preview 2 Management Packs for Open Source Software found here http://www.microsoft.com/en-us/download/details.aspx?id=46924 . Required is at least SCOM 2016 TP2, but SCOM TP2 has already expired few month ago, I will use SCOM 2016 TP3, which also works perfectly fine and can be found here https://technet.microsoft.com/en-gb/evalcenter/dn781241 .

Pre-requisites

First import all management packs for your Linux distribution from the SCOM source itself, depending on your distribution you need to add different MP’s. In my case I will use the SLES (SUSE) MP’s. Make sure you import all depended MP’s also …

image

After some time, you will find in the DownloadedKits directory,  the corresponding shell script bundles for your Linux distributions…

image

You might are used to have *.rpm or *.deb files in this directory, in this current version Microsoft delivers a *.sh package we need to extract later on. Because these are no installer file, I could not use the SCOM agent wizard to deploy these packages. So we need to take some manual steps to install the agent.

Copy this package to your Linux server using e.g. WinSCP https://winscp.net/eng/index.php . WinSCP will allow you to connect to your Linux server from your Windows box and upload any files from your local system…

image

Before we proceed make sure you have configured your Linux monitoring RunAs accounts properly. Please read this post for more details on how to configure the RunAs accounts https://stefanroth.net/2012/03/15/scom-2012-linux-monitoring-lab-part-1-setup-suse-11-1/ , it shows you exactly how to monitor a Linux server.

At this stage you should have the proper Linux distribution MP’s imported, RunAs accounts configured and also the agent source file scx-1.6.0-174.sles.11.x86.sh copied to the Linux server.

Note: We imported these management packs first, because this will place the agent file into the C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\AgentManagement\UnixAgents\DownloadedKits on your SCOM server, which is needed to install the agent.

Install SCOM Linux agent

Log into your Linux box and open a terminal session, in my case I am logged in as root into suse01.services.lab.itnetx.ch and changed to the /tmp directory where I copied the agent source scx-1.6.0-174.sles.11.x86.sh. There are multiple steps you need to execute:

  1. Make the shell file scx-1.6.0-174.sles.11.x86.sh executable by executing the command:  chmod +x scx-1.6.0-174.sles.11.x86.sh
  2. See all options you have for the scx-1.6.0-174.sles.11.x86.sh package: ./scx-1.6.0-174.sles.11.x86.sh – -help
  3. Install the agent only scx-1.6.0-174.sles.11.x86.sh – -Install

4

As you can see the installation routine checks, if Apache is already installed or not. In my case I haven’t installed the web server and therefore we need to take additional steps. I did this on purpose, to see how it works to install the Apache cim-provider. Now you basically have the blank OMI agent installed but there is no “connection” between SCOM and this agent. Therefore we need to run the agent discovery for discovering the Linux box, sign the certificate and finally manage this server. Just run the Linux discovery wizard, as you would install a regular Linux agent. Your wizard should look like this if you configured everything properly…

5

…hit Manage and finally your Linux box is monitored by SCOM…

6

Go to the Monitoring pane and click through the views, you should see some objects popping up after a while …

image

At this point you should have the Linux server monitored and if this is ok we will take the next step and install the Apache HTTP Server.

Install Apache HTTP Server

In this step we will install a plane Apache HTTP Server using the SUSE package installer. Go to Install/Remove Software and search for Apache…

image

The search result will show up with all Apache modules and packages, I selected the following (some depended packages are selected automatically)…

image

…some dependencies are resolved…

8

After installation we need to switch to the terminal window and create a default index.html file, because there is no such file per default installed. Of course this step is optional, but I want to check if my web server works 🙂 and therefore I want to show a default website. Change into the /srv/www/htdocs directory and create a index.html file…

10

…add some content to the index.html file…

image

Save the file and start the Apache service…

9

If you open http://localhost you should see the default site like this…

image

At this stage we have Apache HTTP server installed and running.

Import Apache HTTP Server  management packs

Next we need to import the management packs for monitoring the Apache HTTP Server itself. The management pack can be found here http://www.microsoft.com/en-us/download/details.aspx?id=46924 and contains also the MP for MySQL, which we don’t need. Import the following two files Microsoft.ApacheHTTPServer.Library.mp and Microsoft.Oss.Library.mp

image

If you meet all dependencies, the import will succeed…

14

Configure CIM Provider

The last step is to configure the CIM Provider. The Apache CIM Provider package is automatically deployed during the installation of the Linux agent Operations Manager, if Apache HTTP Server is detected at that time. This detection and automatic installation occurs when installing the Linux agent for the first time on a computer, and it also occurs when upgrading a previous agent version to the current version. If the Apache HTTP Server is installed to the Linux computer after the Operations Manager agent is installed, the CIM Provider can be manually installed through the following mechanisms. Open a terminal window and change to /temp where uploaded the scx-1.6.0-174.sles.11.x86.sh  package.Then execute these steps…

  1. Extract the scx-1.6.0-174.sles.11.x86.sh  package : sudo sh ./scx-1.6.0-174.sles.11.x86.sh  – -extract
  2. Change into the directory: cd scxbundle.20141/
  3. Extract the CIM Provider package: sudo ./apache-cimprov-1.0.0-545.universal.1.i686.sh – -extract
  4. Change the directory: cd apache_22/
  5. Run the installation: rpm –I apache-cimprov-1.0.0-545.universal.1.i686.rpm
  6. Restart the agent: scxadmin –restart
  7. Restart apache service: service apache2 restart

15c

At this point the CIM Provider is installed and running. In order to load the module into Apache HTTP Server we need to modify the sudoers file. When you are monitoring *nix systems you need to modify the sudoers file which basically sets permission for the specific RunAs accounts we define in SCOM. For monitoring Apache HTTP Server we need to add an additional line…

  1. Open the file: sudo visudo
  2. Change to insert mode: press i
  3. Scroll at the end of the file and insert the following line, assuming your monitoring account is called monuser. This allows your privileged monitoring account to execute the apache_config.sh script, which we will start from the SCOM console:
    monuser ALL=(root) NOPASSWD: /opt/microsoft/apache-cimprov/bin/apache_config.sh
  4. Press Esc-key to leave vi editor
  5. Type :wq! to write and quit

18

Open the SCOM console and change to the Apache view, where you should see a not monitored object in the Apache HTTP Server view…

image

Click the Load Monitoring Module task, this will open this dialog…

17

…click Run, which will load the module into the web server using the privileged RunAs account. After a short time the task should finish successfully…

19

After some time you will see data dropping in…

Apache HTTP Servers…

image

Apache Virtual Hosts…

image

Performance counters…

image

Summary

There are multiple steps you need to take to monitor Apache HTTP Server. First monitor the basic Linux OS, if Apache has not been installed before, you need to install the CIM Provider afterwards. For monitoring Apache HTTP Server import the Apache MP’s and load the module apache-cimprov into the web server by executing the Load Monitoring Module SCOM task. At the end you get a pretty well monitored Apache HTTP Server having the most common performance counters out of the box. Be aware the discoveries run every 4 hours and the rule collect data every 5 minutes. If you need to know what exactly is being monitored and which data is collected read the MP guide provided here http://www.microsoft.com/en-us/download/details.aspx?id=46924 . The intention here was to play around with the Apache monitoring and therefore this procedure might does not exactly meet the production requirements. I hope you get an impression how things play together.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s