giovedì, novembre 28, 2013

Nagios Monitor Qmail - qmailtoaster & qmailmrtg

- post<li> - Permalink

Monitor server infrastructure is today a life-safer activity, for example, react immediately to a mail-password-steal can preserve you to be listed in spammer lists (aka blacklists) :D .

To monitor a CentOS mailserver with qmailtoaster using nagios the step are:

  • Install Nagios Plugin and NRPE on target mailserver

  1. /usr/sbin/useradd nagios
  2. passwd nagios
  3. mkdir /download
  4. cd download
  5. wget https://www.nagios-plugins.org/download/nagios-plugins-1.5.tar.gz
  6. tar zxvf nagios-plugins-1.5.tar.gz
  7. cd nagios-plugins-1.5
  8. ./configure
  9. make
  10. make install
  11. chown nagios.nagios /usr/local/nagios
  12. chown -R nagios.nagios /usr/local/nagios/libexec
  13. cd ..
  14. wget http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz 
  15.  tar zxvf nrpe-2.15.tar.gz
  16.  cd nrpe-2.15
  17. ./configure
  18. make all
  19. make install-plugin
  20. make install-daemon
  21. make install-daemon-config
  22. make install-xinetd
  23. Edit the /etc/xinetd.d/nrpe file and add the IP address of the monitoring server to the only_from directive.
    only_from = 127.0.0.1 <nagios_ip_address>
  24. Add the following entry for the NRPE daemon to the /etc/services file:
    nrpe 5666/tcp # NRPE
  25. service xinetd restart
  26. Add the following entry for the NRPE daemon to the /etc/sysconfig/iptables file:
    # NRPE
    -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
  27. service iptables restart
  28. Edit the /usr/local/nagios/etc/nrpe.cfg file and add the follow lines in the # COMMAND DEFINITIONS section
    command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10
    command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20
    command[check_disk]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /dev/mapper/VolGroup00-LogVol00
    command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z
    command[check_total_procs]=/usr/local/nagios/libexec/check_procs -w 150 -c 200
    command[check_qq]=/usr/local/nagios/libexec/check_mrtg -F /usr/share/toaster/htdocs/mrtg/queue-size.log -a MAX -v 1 -w 300 -c 500 -l 'Messages in queue'
    command[check_smtp]=/usr/local/nagios/libexec/check_mrtg -F /usr/share/toaster/htdocs/mrtg/smtp.log -a MAX -v 1 -w 19 -c 20 -l 'Concurrent Smtp'
    

  • Configure Nagios on monitor

  1. Edit the /usr/local/nagios/etc/objects/commands.cfg adding:
    define command{
            command_name check_nrpe
            command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
    }
    
  2. Edit the /usr/local/nagios/etc/servers/mailserver.cfg adding:
    define service{
            use             generic-service,srv-pnp         ; Inherit default values from a template
            host_name               mailserver
            service_description     SSH
            check_command   check_ssh
            }
    
    define service{
            use             generic-service,srv-pnp         ; Inherit default values from a template
            host_name               mailserver
            service_description     SMTP
            check_command   check_smtp!-t 60
            }
    
    define service{
            use             generic-service,srv-pnp         ; Inherit default values from a template
            host_name               mailserver
            service_description     POP3
            check_command   check_pop!-t 60
            }
    
    define service{
            use             generic-service,srv-pnp         ; Inherit default values from a template
            host_name               mailserver
            service_description     DISK            
            check_command           check_nrpe!check_disk
            }
    
    define service{
            use             generic-service,srv-pnp         ; Inherit default values from a template
            host_name               mailserver
            service_description     LOAD            
            check_command           check_nrpe!check_load
            }
    
    define service{
            use             generic-service,srv-pnp         ; Inherit default values from a template
            host_name               mailserver
            service_description     QmailserverQueue              
            check_command           check_nrpe!check_qq
            }
    
    define service{
            use             generic-service,srv-pnp         ; Inherit default values from a template
            host_name               mailserver
            service_description     ConcurrentSMTP          
            check_command           check_nrpe!check_smtp
            }
    
  3. service nagios restart
If all ok you'll be must view in your nagios interface something as in the top image :D

My nightmare is the qmailqueue and your?

Byez

"If the brain were so simple we could understand it, we would be so simple we couldn't."

Nessun commento:

Articoli correlati divisi per etichetta



Widget by Hoctro