Rédiger « OVH/VPC02/idneuf/Nagios » ici. == nagios-plugins et nagios-nrpe-server via Ansible == Fichier playbook : nagios-nrpe.yml {{{ --- - name: nagios-nrpe hosts: - ovh-vpc02-dev become: True vars: nagios_server: 10.242.0.3 tasks: - name: installation Nagios NRPE become: true apt: pkg="{{ item }}" state=latest with_items: - nagios-nrpe-server - nagios-plugins - name: configuration Nagios NRPE become: true replace: dest=/etc/nagios/nrpe.cfg regexp="^allowed_hosts=127\.0\.0\.1$" replace='allowed_hosts=127.0.0.1,{{ nagios_server }}' backup=no - name: create a new file with lineinfile lineinfile: dest=/etc/nagios/nrpe.d/host.cfg regexp='^' line='' state=present create=True - name: create config file blockinfile: dest=/etc/nagios/nrpe.d/host.cfg content=" command[check_users]=/usr/lib/nagios/plugins/check_users -w 5 -c 10\n command[check_load]=/usr/lib/nagios/plugins/check_load -w 15,10,5 -c 30,25,20\n command[check_all_disks]=/usr/lib/nagios/plugins/check_disk -w 20 -c 10\n command[check_zombie_procs]=/usr/lib/nagios/plugins/check_procs -w 5 -c 10 -s Z\n command[check_total_procs]=/usr/lib/nagios/plugins/check_procs -w 150 -c 200\n command[check_swap]=/usr/lib/nagios/plugins/check_swap -w 20 -c 10\n" - name: restart nagios-nrpe-server shell: "systemctl restart nagios-nrpe-server" }}} == check_nginx == Source : [[https://exchange.nagios.org/directory/Plugins/Software/check_nginx-2Esh/details |check_nginx.sh - Nagios Exchange]] 1. Telecharger le plugin dans /usr/lib/nagios/plugins {{{ cd /usr/lib/nagios/plugins wget 'https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=1414&cf_id=24' mv https://exchange.nagios.org/components/com_mtree/attachment.php?link_id=1414&cf_id=24 check_nginx chmod +x check_nginx }}} 2. Ajouter la commende NRPE, ici dans : /etc/nagios/nrpe.d/host.cfg {{{ command[check_nginx]=/usr/lib/nagios/plugins/check_nginx -w 150 -c 250 }}} Les seuils correspondent respectivement a 150 et 250 req/con 3. Definr la commande dans Nagios {{{ define service { hostgroup_name nginx service_description NginX Status check_command check_nrpe_1arg!check_nginx use generic-service notification_interval 0 ; set > 0 if you want to be renotified } }}}