This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
сервис_nagios [2022/02/26 06:19] val |
сервис_nagios [2024/06/20 15:32] (current) val [Настройка nagios на использование check_snmp] |
||
---|---|---|---|
Line 16: | Line 16: | ||
# a2enmod authz_groupfile | # a2enmod authz_groupfile | ||
+ | |||
+ | # a2enmod cgid | ||
# systemctl restart apache2 | # systemctl restart apache2 | ||
Line 26: | Line 28: | ||
* [[https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/dependencies.html|Host and Service Dependencies]] | * [[https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/3/en/dependencies.html|Host and Service Dependencies]] | ||
+ | * [[https://www.zarrelli.org/blog/nagios-notification-escalations-made-easy/comment-page-1/|Nagios notification escalations made easy]] | ||
<code> | <code> | ||
Line 128: | Line 131: | ||
use my-templ-service-ping | use my-templ-service-ping | ||
host_name switch3 | host_name switch3 | ||
+ | } | ||
+ | |||
+ | #--- For next labs --- | ||
+ | |||
+ | define host{ | ||
+ | use my-templ-host | ||
+ | host_name cisco-router | ||
+ | alias Cisco 7200 | ||
+ | address router | ||
} | } | ||
</code> | </code> | ||
Line 133: | Line 145: | ||
==== Тестирование конфигурации и запуск ==== | ==== Тестирование конфигурации и запуск ==== | ||
- | * [[http://server/nagios4/]] | + | * [[http://192.168.X.10/nagios4/]] |
<code> | <code> | ||
Line 199: | Line 211: | ||
# mkdir /usr/var | # mkdir /usr/var | ||
- | # /usr/lib/nagios/plugins/check_snmp -H router -C public -o ifInOctets.2,ifOutOctets.2 --rate -w 62500,62500 -c 125000,125000 | + | # /usr/lib/nagios/plugins/check_snmp -H router -C public -o ifInOctets.5,ifOutOctets.5 --rate -w 62500,62500 -c 125000,125000 |
- | # rm -r /usr/var/* | + | # chown -R nagios:nagios /usr/var/ |
- | + | ||
- | # chown -R nagios /usr/var/ | + | |
</code> | </code> | ||
Line 215: | Line 225: | ||
command_name check_snmp_band | command_name check_snmp_band | ||
command_line $USER1$/check_snmp --rate -H $HOSTADDRESS$ -C $ARG1$ -o $ARG2$ -w $ARG3$ -c $ARG4$ | command_line $USER1$/check_snmp --rate -H $HOSTADDRESS$ -C $ARG1$ -o $ARG2$ -w $ARG3$ -c $ARG4$ | ||
- | } | ||
- | |||
- | define host{ | ||
- | use my-templ-host | ||
- | host_name cisco-router | ||
- | alias Cisco 7200 | ||
- | address router | ||
} | } | ||
Line 227: | Line 230: | ||
use generic-service | use generic-service | ||
host_name cisco-router | host_name cisco-router | ||
- | service_description int LAN bandwidth | + | service_description int LAN bandwidth SNMP |
+ | flap_detection_enabled 0 | ||
check_command check_snmp_band!public!ifInOctets.2,ifOutOctets.2!62500,62500!125000,125000 | check_command check_snmp_band!public!ifInOctets.2,ifOutOctets.2!62500,62500!125000,125000 | ||
+ | # check_command check_snmp_band!public!ifInOctets.5,ifOutOctets.5!62500,62500!125000,125000 | ||
} | } | ||
</code> | </code> | ||
Line 239: | Line 244: | ||
<code> | <code> | ||
server# /usr/lib/nagios/plugins/check_mrtgtraf -F /var/www/html/mrtg/router_fa0_0.log -a MAX -w 125000,125000 -c 62500,62500 -e 10 | server# /usr/lib/nagios/plugins/check_mrtgtraf -F /var/www/html/mrtg/router_fa0_0.log -a MAX -w 125000,125000 -c 62500,62500 -e 10 | ||
- | |||
- | server# /usr/lib/nagios/plugins/check_mrtg -F /var/www/html/mrtg/dhcp-stat.log -a MAX -v 2 -w 6 -c 8 | ||
server# less /etc/nagios4/objects/commands.cfg | server# less /etc/nagios4/objects/commands.cfg | ||
+ | |||
+ | server# /usr/lib/nagios/plugins/check_mrtg -F /var/www/html/mrtg/dhcp-stat.log -a MAX -v 2 -w 6 -c 8 | ||
server# cat corpX.cfg | server# cat corpX.cfg | ||
</code><code> | </code><code> | ||
... | ... | ||
+ | |||
+ | # --- int WAN bandwidth MRTG --- | ||
+ | |||
define service{ | define service{ | ||
use generic-service | use generic-service | ||
host_name cisco-router | host_name cisco-router | ||
service_description int WAN bandwidth MRTG | service_description int WAN bandwidth MRTG | ||
+ | flap_detection_enabled 0 | ||
check_command check_local_mrtgtraf!/var/www/html/mrtg/router_fa0_0.log!AVG!62500,62500!125000,125000!10 | check_command check_local_mrtgtraf!/var/www/html/mrtg/router_fa0_0.log!AVG!62500,62500!125000,125000!10 | ||
+ | } | ||
+ | |||
+ | # --- check dhcp stat --- | ||
+ | |||
+ | define command { | ||
+ | command_name my-check_mrtg | ||
+ | command_line $USER1$/check_mrtg -F $ARG1$ -a $ARG2$ -v $ARG3$ -w $ARG4$ -c $ARG5$ | ||
+ | } | ||
+ | |||
+ | define service{ | ||
+ | use generic-service | ||
+ | host_name cisco-router | ||
+ | service_description check dhcp stat | ||
+ | check_command my-check_mrtg!/var/www/html/mrtg/dhcp-stat.log!MAX!2!6!8 | ||
} | } | ||
</code> | </code> | ||
Line 265: | Line 288: | ||
#CMD='rsh router show ip dhcp binding | grep 192.168 | wc -l' | #CMD='rsh router show ip dhcp binding | grep 192.168 | wc -l' | ||
- | #MAX=99 | + | #MAX=9 |
#CUR=`eval $CMD` | #CUR=`eval $CMD` | ||