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  http://192.168.1.100/prod_3f/check_mk/agents/plugins/apache_status. 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>@192.168.1.100/prod_3f/check_mk/agents/plugins/apache_status 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)
 
[client]
user=mysqluser
password=mysqluserpassword


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.

7 comments:

  1. Thank you for this post. It worked great

    ReplyDelete
  2. hi, Hello, if you use the mongodb check, how would it be?

    ReplyDelete
    Replies
    1. I am assuming you are referring to https://mathias-kettner.com/check_mk_exchange_file.php?HTML=&file=mongodb-1.0.mkp?
      This is a WATO plugin that you can configure from the server side. That means the check_mk server will run the check on itself to check the service (ie mongodb) on the target Host. I have not used this myself but I think it should work like the HTTP plugin. Check out the link and the code. It is very easy to read and it shows the relevant parameters.

      Delete
  3. I am trying to add haproxy checkmk agent, but it doesn't work

    ReplyDelete
  4. Hi,

    I want to configure a third party plugin to my check_mk server. How would I do that?

    ReplyDelete
  5. If you have native 3rd party plugin it should come with instructions. If you are trying to use another application to do check, try looking for instructions to create a custom plugin

    ReplyDelete