Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
tutorial:adm:server_monitoring [2019/03/25 11:27]
fiserp [Monitoring of server with CzechIdM]
tutorial:adm:server_monitoring [2019/03/25 15:02]
fiserp [Monitoring of server with CzechIdM]
Line 3: Line 3:
 This page will show you how to set up basic monitoring of server with CzechIdM using Nagios NRPE. It is very useful to store monitored values for trend overview (e.g. with Munin). Some monitoring systems (like Zabbix) can store trends and monitor services at once. It is also practical to install ''iostat'', ''vmstat'' and ''sar'' utilities on the server. This page will show you how to set up basic monitoring of server with CzechIdM using Nagios NRPE. It is very useful to store monitored values for trend overview (e.g. with Munin). Some monitoring systems (like Zabbix) can store trends and monitor services at once. It is also practical to install ''iostat'', ''vmstat'' and ''sar'' utilities on the server.
  
-<note>This article is about real-time monitoring of the server and its services. It does not deal with monitoring of the "insides" of CzechIdM.</note>+<note>This article is about real-time monitoring of the server and its services. It does not deal with monitoring of "the insides" of CzechIdM.</note>
  
 **Typical CzechIdM server** **Typical CzechIdM server**
Line 39: Line 39:
 #!/bin/bash #!/bin/bash
  
-# Original version https://exchange.nagios.org/directory/Plugins/System-Metrics/Memory/check_mem-2Esh/details+# Original (GPL-licensed) version https://exchange.nagios.org/directory/Plugins/System-Metrics/Memory/check_mem-2Esh/details
 # Modified for CentOS7/RHEL7 - Petr Fiser, BCV solutions s.r.o. # Modified for CentOS7/RHEL7 - Petr Fiser, BCV solutions s.r.o.
 if [ "$1" = "-w" ] && [ "$2" -gt "0" ] && [ "$3" = "-c" ] && [ "$4" -gt "0" ]; then if [ "$1" = "-w" ] && [ "$2" -gt "0" ] && [ "$3" = "-c" ] && [ "$4" -gt "0" ]; then
Line 87: Line 87:
 yum install nrpe nagios-plugins-nrpe nagios-plugins-swap nagios-plugins-disk nagios-plugins-load nagios-plugins-procs nagios-plugins-ntp nagios-plugins-http nagios-plugins-pgsql yum install nrpe nagios-plugins-nrpe nagios-plugins-swap nagios-plugins-disk nagios-plugins-load nagios-plugins-procs nagios-plugins-ntp nagios-plugins-http nagios-plugins-pgsql
 </code> </code>
-If you use SELinux, we need to permit the check_disk plugin access to the ''/sys/kernel/...''. Easiest way (but not necessarily the most correct) is to set permissive mode for some plugins:+If you use SELinux, we need to permit the check\_disk plugin access to the ''/sys/kernel/...''. Easiest way (but not necessarily the most correct) is to set permissive mode for some plugins:
 <code> <code>
 yum install policycoreutils-python yum install policycoreutils-python
Line 96: Line 96:
 allowed_hosts=127.0.0.1,IPofMonitoringServer allowed_hosts=127.0.0.1,IPofMonitoringServer
 </code> </code>
-Create a configuration of system checks in the file ''/etc/nrpe.d/checks.cfg''. Fill in the ''YOUR_NTP_SERVER'' and ''IDM_SERVICE_DOMAIN_NAME'' accordingly. The ''MONITORING_USER'' and ''MONITORING_USER_PASSWORD'' are values filled with credentials of an user which is capable to log into the PostgreSQL database. **Create separate user just for this purpose**.+Create a configuration of system checks in the file ''/etc/nrpe.d/checks.cfg''. Fill in the ''YOUR\_NTP\_SERVER'' and ''IDM\_SERVICE\_DOMAIN\_NAME'' accordingly. The ''MONITORING\_USER'' and ''MONITORING\_USER\_PASSWORD'' are values filled with credentials of an user which is capable to log into the PostgreSQL database. **Create separate user just for this purpose**.
 <file txt checks.cfg> <file txt checks.cfg>
 command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 50% -c 10% command[check_swap]=/usr/lib64/nagios/plugins/check_swap -w 50% -c 10%
Line 110: Line 110:
 command[check_postgres]=/usr/lib64/nagios/plugins/check_pgsql -H 127.0.0.1 -P 5432 -d template1 -l MONITORING_USER -p MONITORING_USER_PASSWORD -w0.5 -c1 command[check_postgres]=/usr/lib64/nagios/plugins/check_pgsql -H 127.0.0.1 -P 5432 -d template1 -l MONITORING_USER -p MONITORING_USER_PASSWORD -w0.5 -c1
 </file> </file>
-Add the ''check_mem'' script to the ''/usr/lib64/nagios/plugins/'' directory, make it executable:+Add the ''check\_mem'' script to the ''/usr/lib64/nagios/plugins/'' directory, make it executable:
 <code> <code>
 cp check_mem /usr/lib64/nagios/plugins/ cp check_mem /usr/lib64/nagios/plugins/
 chmod 755 /usr/lib64/nagios/plugins/check_mem chmod 755 /usr/lib64/nagios/plugins/check_mem
 </code> </code>
-Create the ''MONITORING_USER'' in the PostgreSQL. Generate some strong password - you can use ''pwgen'' for that.+Create the ''MONITORING\_USER'' in the PostgreSQL. Generate some strong password - you can use ''pwgen'' for that.
 <code> <code>
 create user monitoring password 'somepassword'; create user monitoring password 'somepassword';
Line 124: Line 124:
 systemctl enable nrpe systemctl enable nrpe
 </code> </code>
-To test the probes, you can use ''check_nrpe'' plugin:+To test the probes, you can use ''check\_nrpe'' plugin:
 <code> <code>
 /usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -b 127.0.0.1 -c check_swap /usr/lib64/nagios/plugins/check_nrpe -H 127.0.0.1 -b 127.0.0.1 -c check_swap
Line 133: Line 133:
 This is a sample configuration for the Nagios server. It is meant more as an inspiration, feel free to adapt it to your Nagios deployment. This is a sample configuration for the Nagios server. It is meant more as an inspiration, feel free to adapt it to your Nagios deployment.
  
-Configure the ''check_nrpe'' command (you probably already have this in your Nagios configuration):+Configure the ''check\_nrpe'' command (you probably already have this in your Nagios configuration):
 <code> <code>
 define command{ define command{
  • by urbanl