Tuesday, August 15, 2017

Install check_mk agent on Centos 7

This is an update to the other check_mk client instructions which is more general.There are 3 major steps: a. installing the required package repository, b.installing the client package and c. configuring systemd and the firewall to start and allow the check-mk server to access it.

1. For this you need to install the epel repository by installing the epel package available from EPEL. Then, you can search the repository to verify that it does have the check-mk client.
yum search check-mk-agent
2. The above command should show the current version of the agent available to be installed. To install it: yum install check-mk-agent
3. Change to the systemd service directory: cd /etc/systemd/system
4. Copy the check-mk agent socket file: cp /usr/lib/systemd/system/check_mk.socket .
5. Create a link for the check-mk agent service file: ln -s /usr/lib/systemd/system/check_mk@.service .
6. Enable the check-mk agent service: systemctl enable check_mk.socket . Then start it: systemctl start check_mk.socket.This can be verified with the command systemctl status check_mk.socket. Look for the line beginning with "Active" which should say "active (listening)".
7. Open the port in the firewall: firewall-cmd --zone=public --add-port=6556/tcp --permanent . The --permanent option will save the rule and make it permanent, even if the server is rebooted.
 After this, add the server at the OMD or check_mk server and you're done.
For Extra Credit: Be aware of where the locations for the plugins are by running rpm -ql check-mk-agent to see all the files installed and where the plugins are. Copy and configure those that you need to /usr/share/check-mk-agent/plugins to be activated and used by the agent.

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.

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.