Wednesday, July 13, 2016

How to quickly install check_mk agent plugins

Check_mk has many agent plugins that a lot of us are not aware of. Some of them would open up monitoring opportunities that were not even considered about. Best of all, some of these plugins use APIs readily available to talk to applications and services. Theses same APIs are used by other commercial programs so the information gleamed from them is commercial-grade.
The hardest part of installing the application is to copy the plugin. The best option is to use the plugin provided by the monitoring Check_mk system. This ensures that the plugin works with the check_mk agent installed on the host. But it may not be convenient to download the plugin to the PC and upload it back to another server. So this is a really quick way to do this.
  1. First, ssh to the host and go the plugin directory, usually /usr/lib/check_mk_agent/plugins
  2. Open the browser to the WATO-Configuration ==> Monitoring Agents window of your Check_mk / OMD installation. 
  3. Right-click on the plugin you wish to upload to the host and copy the URL
  4. Go to the ssh window and type wget.
  5. Then paste the URL, which should look something like This is for the apache_status plugin.
  6. Since Check_mk / OMD requires a login, edit the line to look like this  http://<Username>:<password>@ and press Enter.
  7. Change the permission of the plugin to be executable using chmod ugo+x apache_status 
That should do the trick. Go to Wato-Configuration ==> Hosts. Select the Host that the plugin was added to. Click on the Services button and activate the (new) missing services. Apply the configuration and the plugin should now be active. Check the services of that Host to see the new services.
Some plugins have specific requirements, like the credentials to access the service it monitors. The apache_status plugin needs a specific configuration to be in the apache configuration file. For example, the mk_mysql agent requires the credentials to be in the /etc/check_mk/mysql.cfg file. The file should look like this (replace with the correct information)

Meet these requirements and  the agent can run and report on the service. Finally, you can go into WATO and check for the Host's Services menu item. The newly discovered services can be enabled here.

Wednesday, July 6, 2016

Check_mk Inventory not updating Solved

If you are just installing the check_mk inventory plugin, please understand the the plugin only run between a set interval times. This is because the inventory process is places a high load on the server and repeating it would impact the performance of the server. The default interval is 4 hours.
You can force an inventory check by doing the following
  1. Find and delete the mk_inventory.last.* file. This is the file that stores the last time the inventory process was run
  2. Go to the check_mk web interface and trigger / refresh the Check_MK HW/SW Inventory service.

Observe the Output of the check plugin entry in the service detail table for Check_MK HW/SW Inventory service. It should read a lot of entries.

Tuesday, June 28, 2016

Setting up the Check_mk Inventory plugin

Check_mk and by extension, OMD have a feature to audit the hardware and software inventory of a server that is being monitored. This can be used to find servers below of a specific specification (e.g RAM too low) or details of an installed software package. To do this, the Check_mk inventory plugin has to be installed. This is a two phase process. First we need to install the check_mk inventory plugin and then we need to setup Check_mk/OMD to start polling the server for inventory information.

Installing the check_mk inventory plugin

The plugin itself is very similar to how other plugins are installed.
  1. Obtain the plugin. This can be found in OMD at Wato Configuration ==> Monitoring agent. Download the file.
  2. Copy the file to the check_mk plugin directory. This can be at either in /usr/lib/check_mk_agent/plugins/ for RedHat/CentOS or in a directory called plugins located in the same directory as the check_mk_agent.exe file.
  3. For Linux hosts, change the file permissions to allow the plugin to be executable.
  4. For Windows hosts, the system account running the check_mk agent has the appropriate permissions to check the service the plugin is for.

Configuring Check_mk to poll for inventory information

Once the plugin is installed, check_mk must be told which servers to poll for the inventory information. Polling for this is done less often than polling for status. It is done via a ruleset.
  1. In Wato Configuration, go to Hosts.
  2. Click on the Rulesets button on the top.
  3. Click on Hardware/Software Inventory button. (bottom left button)
  4. Click on Do hardware/software Inventory
  5. If there are no rules in the folder, click Create rule in folder. Otherwise click on the green pencil icon to edit the existing rule.
  6. Check the box marked Specify explicit host names and enter the hostname of the host to be inventoried. 
  7. If this is an existing rule, understand the current settings and modify accordingly. If you are not sure, go back, create a new rule and repeat rule 6. 

 It will take some time for the hardware and software to be inventoried. Go to View ==> All Hosts. The hosts that are being inventoried have an icon showing a blue window with a CD in front of it.
Click on this icon to show the inventory. The inventory is displayed as a tree, so you need to expand it to show more items. If you are seeing only the hardware inventory showing only RAM information, the plugin is not working or hasn't been run yet. Click the refresh icon in the All Hosts screen to trigger this.
There are more inventory related operation in the Main Menu. Once the inventory is populated, these functions will be useful to discover or find hardware or software installed in the hosts that are being monitored.
If a few hours has passed and the inventory is still not updating, try this to immediately force an inventory check.