Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorial:adm:server_monitoring [2019/03/25 11:26] fiserp [Implementation] |
tutorial:adm:server_monitoring [2020/06/30 12:27] urbanl [Server preparation - Server monitoring] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
Automatic monitoring of production system is crucial for bussiness continuity. Monitoring is recommended also for the testing environment, | Automatic monitoring of production system is crucial for bussiness continuity. Monitoring is recommended also for the testing environment, | ||
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 '' | 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 '' | ||
- | < | + | < |
- | **Typical CzechIdM | + | **Example |
- | This is a typical configuration of a production server for a small company. These parameters | + | Table with example monitoring |
* RHEL7-flavoured system. | * RHEL7-flavoured system. | ||
- | * About 80GB HDD. | + | * About 100GB HDD. |
- | * At least 6GB RAM. | + | * At least 8GB RAM. |
* At least 2x2GHz CPU. | * At least 2x2GHz CPU. | ||
+ | When implementing server monitoring adjust monitored parameters for your particular deployment. | ||
===== Monitored parameters ===== | ===== Monitored parameters ===== | ||
Line 35: | Line 36: | ||
* NRPE daemon will listen on 5666\tcp (its default port). Open the port in your iptables by adding the rule: '' | * NRPE daemon will listen on 5666\tcp (its default port). Open the port in your iptables by adding the rule: '' | ||
* All probes are located in their default installation location ''/ | * All probes are located in their default installation location ''/ | ||
- | * We use one external probe check\_mem which can be downloaded here: [[https:// | + | * We use one external probe check\_mem which can be downloaded here: [[https:// |
- | <file shell check_mem> | + | |
- | # | + | |
- | + | ||
- | # Original version | + | |
- | # Modified for CentOS7/RHEL7 - Petr Fiser, BCV solutions s.r.o. | + | |
- | if [ " | + | |
- | + | ||
- | memTotal_b=`free -b |grep Mem |awk ' | + | |
- | memFree_b=`free -b |grep Mem |awk ' | + | |
- | memBuffer_b=`free -b |grep Mem |awk ' | + | |
- | + | ||
- | memTotal_m=`free -m |grep Mem |awk ' | + | |
- | memFree_m=`free -m |grep Mem |awk ' | + | |
- | memBuffer_m=`free -m |grep Mem |awk ' | + | |
- | + | ||
- | memUsed_b=$(($memTotal_b-$memFree_b-$memBuffer_b)) | + | |
- | memUsed_m=$(($memTotal_m-$memFree_m-$memBuffer_m)) | + | |
- | + | ||
- | memUsedPrc=$((($memUsed_b*100)/$memTotal_b)) | + | |
- | + | ||
- | + | ||
- | if [ " | + | |
- | echo " | + | |
- | $(exit 2) | + | |
- | elif [ " | + | |
- | echo " | + | |
- | $(exit 1) | + | |
- | else | + | |
- | echo " | + | |
- | $(exit 0) | + | |
- | fi | + | |
- | + | ||
- | else | + | |
- | echo " | + | |
- | echo "" | + | |
- | echo " | + | |
- | echo " | + | |
- | echo "" | + | |
- | echo " | + | |
- | echo "" | + | |
- | echo " | + | |
- | exit | + | |
- | fi | + | |
- | </ | + | |
**Deployment** | **Deployment** | ||
Line 87: | Line 44: | ||
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 | ||
</ | </ | ||
- | If you use SELinux, we need to permit the check_disk | + | If you use SELinux, we need to permit the check\_disk |
< | < | ||
yum install policycoreutils-python | yum install policycoreutils-python | ||
Line 96: | Line 53: | ||
allowed_hosts=127.0.0.1, | allowed_hosts=127.0.0.1, | ||
</ | </ | ||
- | Create a configuration of system checks in the file ''/ | + | Create a configuration of system checks in the file ''/ |
<file txt checks.cfg> | <file txt checks.cfg> | ||
command[check_swap]=/ | command[check_swap]=/ | ||
Line 110: | Line 67: | ||
command[check_postgres]=/ | command[check_postgres]=/ | ||
</ | </ | ||
- | Add the '' | + | Add the '' |
< | < | ||
cp check_mem / | cp check_mem / | ||
chmod 755 / | chmod 755 / | ||
</ | </ | ||
- | Create the '' | + | Create the '' |
< | < | ||
create user monitoring password ' | create user monitoring password ' | ||
Line 124: | Line 81: | ||
systemctl enable nrpe | systemctl enable nrpe | ||
</ | </ | ||
- | To test the probes, you can use '' | + | To test the probes, you can use '' |
< | < | ||
/ | / | ||
Line 133: | Line 90: | ||
This is a sample configuration for the Nagios server. It is meant more as an inspiration, | This is a sample configuration for the Nagios server. It is meant more as an inspiration, | ||
- | Configure the '' | + | Configure the '' |
< | < | ||
define command{ | define command{ |