User Tools

Site Tools


nagios

How to Install Nagios 4 in Ubuntu and Debian

https://exchange.nagios.org/directory/Addons/Notifications/Telegram-Notifications/details

https://www.unixmen.com/install-nagvis-add-on-for-icinga-on-ubuntu/

https://www.itzgeek.com/how-tos/linux/debian/how-to-install-nagios-on-debian-9-stretch.html

  • /usr/local/nagios/etc/objects# vi host.cfg

define host{

      use                     xxx-bank    ; Name of host template to use
      host_name               xxx_Savar
      alias                   xxx_Savar
      address                 10.255.xxx.118
      contact_groups          noc
      notification_interval           0
      }

define hostgroup{

      hostgroup_name  xxx-bank   ; The name of the hostgroup
      alias           xxx-bank   ; Long name of the group
      members         xxx_Savar ; Comma separated list of hosts that belong to this group
      }
      ----

define service{

      use                            local-service         ; Name of service template to use
      host_name                       localhost,xxx_Savar;
      service_description             PING
      check_command                   check_ping!100.0,20%!500.0,60%
      }

* usr/local/nagios/etc/objects# vi contacts.cfg

define contact{

      contact_name                    Aminul    ; Short name of user
      use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
      alias                           BDCOM VIEW              ; Full name of user
      email                           monitoring@xxx.com    ;  CHANGE THIS TO YOUR EMAIL ADDRESS 

}


define contactgroup{

      contactgroup_name       noc
      alias                   Nagios view
      members                 Aminul
      }
----
  • /usr/local/nagios/etc/objects# vi commands.cfg

define command {

  command_name    notify-host-by-email
  command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$

}


define command {

  command_name    notify-service-by-email
  command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$

}


* /usr/local/nagios/etc# vi nagios.cfg ( Add below path to nagios.cfg )

cfg_file=/usr/local/nagios/etc/objects/host.cfg

*/usr/local/nagios/etc/objects# vi templates.cfg


define host{

      name                            xxx-bank       ; The name of this host template
      use                             generic-host    ; This template inherits other values from the generic-host template
      check_period                    24x7            ; By default, Linux hosts are checked round the clock
      check_interval                  10      ; Actively check the host every 5 minutes
      retry_interval                  1               ; Schedule host check retries at 1 minute intervals
      max_check_attempts              50      ; Check each Linux host 10 times (max)
      check_command                   check-host-alive ; Default command to check Linux hosts
      notification_period             24x7            ; Linux admins hate to be woken up, so we only notify during the day
                                                      ; Note that the notification_period variable is being overridden from
                                                      ; the value that is inherited from the generic-host template!
      notification_interval           120            ; Resend notifications every 2 hours
      notification_options            d,u,r           ; Only send notifications for specific host states
      contact_groups                  noc     ; Notifications get sent to the admins by default
      register                        0               ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
      first_notification_delay        5
      }

—-

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

nagios.txt · Last modified: 2023/03/06 11:31 by 127.0.0.1