Konfigurasi Dasar Nagios Core 4
Setelah melakukan instalasi nagios core langkah selanjutnya adalah melakukan konfigurasi dasar. Pada artikel sebelumnya yang berjudul Cara Instal Nagios 4 di Ubuntu dan Debian kita sudah berhasil menginstal nagios core beserta pluginnya hingga bisa diakses menggunakan browser. Nagios yang kita instal masih berupa kosongan belum ada konfigurasi dan hostnya.
Pada tahap ini kita akan melakukan konfigurasi dasar yang dibutuhkan oleh nagios agar bisa digunakan untuk memonitoring host. Ada beberapa file konfigurasi yang perlu anda ingat sebelum anda mulai memonitoring perangkat-perangkat yang ingin anda monitoring. yang pertama adalah file konfigursi utama nagios yaitu nagios.cfg yang berada pada direktori /usr/local/nagios/etc
File ini adalah file utama yang terkait dengan file-file yang lain. pada file inilah settingan untuk mengaktifkan atau menonaktifkan service service atau host yang akan di monitor. seperti mengaktifkan Service pada Printer, Switch, Router, Linux Server, Windows Server dll.
Saya menggunakan filezilla client untuk mengakses file konfigurasinya agar mudah dalam proses menambah dan mengedit file. Anda juga bisa menggunakan putty untuk mengakses nagios via SSH.
Langkah 1 : Membuat Folder dan File Konfigurasi
Secara default, semua folder dan file konfigurasi berada di folder /usr/local/nagios/etc. Namun untuk mempermudah dalam pengorganisasian perangkat-perangkat ke depan saya akan membuat folder dan file konfigurasi sendiri yang saya buat di /etc/nagios.Jalankan perintah berikut untuk membuat folder dan file konfigurasi nagios :
#cd /etc
#mkdir nagios
#cd nagios
#mkdir objects
#mkdir private
#touch hostgroup.cfg
#touch router.cfg
#touch server.cfg
#touch objects/commands.cfg
#touch objects/contacts.cfg
#touch objects/timeperiods.cfg
#touch objects/templates.cfg
#touch objects/services.cfg
#mkdir nagios
#cd nagios
#mkdir objects
#mkdir private
#touch hostgroup.cfg
#touch router.cfg
#touch server.cfg
#touch objects/commands.cfg
#touch objects/contacts.cfg
#touch objects/timeperiods.cfg
#touch objects/templates.cfg
#touch objects/services.cfg
Cek status folder dan file yang kita buat pada langkah diatas dengan perintah ls -l
root@lucky-connect:/etc/nagios# ls -l total 28 -rw-r--r-- 1 root root 314 Jan 25 01:03 hostgroup.cfg drwxr-xr-x 2 root root 4096 Jan 30 19:09 objects drwxr-xr-x 2 root root 4096 Jan 24 00:05 private -rw-r--r-- 1 root root 8817 Jan 24 23:38 router.cfg -rw-r--r-- 1 root root 4006 Jan 25 01:01 server.cfg
Langkah 2 : Menghubungkan File dan Folder Konfigurasi dengan Konfigurasi Utama Nagios
Buka file konfigurasi utama nagios dengan perintah nano /usr/local/nagios/etc/nagios.cfg .m############################################################################## # # NAGIOS.CFG - Sample Main Config File for Nagios 4.4.6 # # Read the documentation for more information on this configuration # file. I've provided some comments here, but things may not be so # clear without further explanation. # # ############################################################################## # LOG FILE # This is the main log file where service and host events are logged # for historical purposes. This should be the first option specified # in the config file!!! log_file=/usr/local/nagios/var/nagios.log # OBJECT CONFIGURATION FILE(S) # These are the object configuration files in which you define hosts, # host groups, contacts, contact groups, services, etc. # You can split your object definitions across several config files # if you wish (as shown below), or keep them all in a single config file. # You can specify individual object config files as shown below: # Menentukan konfigurasi dari folder dan file yang dibuat sendiri cfg_file=/etc/nagios/objects/commands.cfg cfg_file=/etc/nagios/objects/contacts.cfg cfg_file=/etc/nagios/objects/timeperiods.cfg cfg_file=/etc/nagios/objects/templates.cfg cfg_file=/etc/nagios/objects/services.cfg cfg_file=/etc/nagios/hostgroup.cfg cfg_file=/etc/nagios/server.cfg cfg_file=/etc/nagios/router.cfg # Beri tanda pagar untuk menonaktifkan konfigurasi bawaan # Definitions for monitoring the local (Linux) host #cfg_file=/usr/local/nagios/etc/objects/localhost.cfg # Definitions for monitoring a Windows machine #cfg_file=/usr/local/nagios/etc/objects/windows.cfg # Definitions for monitoring a router/switch #cfg_file=/usr/local/nagios/etc/objects/switch.cfg # Definitions for monitoring a network printer #cfg_file=/usr/local/nagios/etc/objects/printer.cfg # You can also tell Nagios to process all config files (with a .cfg # extension) in a particular directory by using the cfg_dir # directive as shown below: #cfg_dir=/usr/local/nagios/etc/servers #cfg_dir=/usr/local/nagios/etc/printers #cfg_dir=/usr/local/nagios/etc/switches #cfg_dir=/usr/local/nagios/etc/routers
Langkah 3 : Mengisi File Konfigurasi Objects
Pada langkah pertama kita menentukan file dan folder sendiri untuk konfigurasi nagios. File-file tersebut yang berlokasi di folder objects masih kosong belum ada isiya. Kita bisa copy isi file konfigurasi objects bawaan nagios yang berada di /usr/local/nagios/etc/objects untuk kemudian kita paste di file konfigurasi object yang kita buat di folder /etc/nagios/objects. Berikut adalah isi dari masing-masing file kongigurasi yang berada di folder /etc/nagios/objects .1. commands.cfg
############################################################################### # COMMANDS.CFG - SAMPLE COMMAND DEFINITIONS FOR NAGIOS 4.4.5 # # # NOTES: This config file provides you with some example command definitions # that you can reference in host, service, and contact definitions. # # You don't need to keep commands in a separate file from your other # object definitions. This has been done just to make things easier to # understand. # ############################################################################### ################################################################################ # # SAMPLE NOTIFICATION COMMANDS # # These are some example notification commands. They may or may not work on # your system without modification. As an example, some systems will require # you to use "/usr/bin/mailx" instead of "/usr/bin/mail" in the commands below. # ################################################################################ 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$ } ################################################################################ # # SAMPLE HOST CHECK COMMANDS # ################################################################################ # This command checks to see if a host is "alive" by pinging it # The check must result in a 100% packet loss or 5 second (5000ms) round trip # average time to produce a critical error. # Note: Five ICMP echo packets are sent (determined by the '-p 5' argument) define command { command_name check-host-alive command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5 } ################################################################################ # # SAMPLE SERVICE CHECK COMMANDS # # These are some example service check commands. They may or may not work on # your system, as they must be modified for your plugins. See the HTML # documentation on the plugins for examples of how to configure command definitions. # # NOTE: The following 'check_local_...' functions are designed to monitor # various metrics on the host that Nagios is running on (i.e. this one). ################################################################################ define command { command_name check_local_disk command_line $USER1$/check_disk -w $ARG1$ -c $ARG2$ -p $ARG3$ } define command { command_name check_local_load command_line $USER1$/check_load -w $ARG1$ -c $ARG2$ } define command { command_name check_local_procs command_line $USER1$/check_procs -w $ARG1$ -c $ARG2$ -s $ARG3$ } define command { command_name check_local_users command_line $USER1$/check_users -w $ARG1$ -c $ARG2$ } define command { command_name check_local_swap command_line $USER1$/check_swap -w $ARG1$ -c $ARG2$ } define command { command_name check_local_mrtgtraf command_line $USER1$/check_mrtgtraf -F $ARG1$ -a $ARG2$ -w $ARG3$ -c $ARG4$ -e $ARG5$ } ################################################################################ # NOTE: The following 'check_...' commands are used to monitor services on # both local and remote hosts. ################################################################################ define command { command_name check_ftp command_line $USER1$/check_ftp -H $HOSTADDRESS$ $ARG1$ } define command { command_name check_hpjd command_line $USER1$/check_hpjd -H $HOSTADDRESS$ $ARG1$ } define command { command_name check_snmp command_line $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$ } define command { command_name check_http command_line $USER1$/check_http -I $HOSTADDRESS$ $ARG1$ } define command { command_name check_ssh command_line $USER1$/check_ssh $ARG1$ $HOSTADDRESS$ } define command { command_name check_dhcp command_line $USER1$/check_dhcp $ARG1$ } define command { command_name check_ping command_line $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5 } define command { command_name check_pop command_line $USER1$/check_pop -H $HOSTADDRESS$ $ARG1$ } define command { command_name check_imap command_line $USER1$/check_imap -H $HOSTADDRESS$ $ARG1$ } define command { command_name check_smtp command_line $USER1$/check_smtp -H $HOSTADDRESS$ $ARG1$ } define command { command_name check_tcp command_line $USER1$/check_tcp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$ } define command { command_name check_udp command_line $USER1$/check_udp -H $HOSTADDRESS$ -p $ARG1$ $ARG2$ } define command { command_name check_nt command_line $USER1$/check_nt -H $HOSTADDRESS$ -p 12489 -v $ARG1$ $ARG2$ } ################################################################################ # # SAMPLE PERFORMANCE DATA COMMANDS # # These are sample performance data commands that can be used to send performance # data output to two text files (one for hosts, another for services). If you # plan on simply writing performance data out to a file, consider using the # host_perfdata_file and service_perfdata_file options in the main config file. # ################################################################################ define command { command_name process-host-perfdata command_line /usr/bin/printf "%b" "$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n" >> /var/log/nagios/host-perfdata.out } define command { command_name process-service-perfdata command_line /usr/bin/printf "%b" "$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n" >> /var/log/nagios/service-perfdata.out }
############################################################################### # CONTACTS.CFG - SAMPLE CONTACT/CONTACTGROUP DEFINITIONS # # # NOTES: This config file provides you with some example contact and contact # group definitions that you can reference in host and service # definitions. # # You don't need to keep these definitions in a separate file from your # other object definitions. This has been done just to make things # easier to understand. # ############################################################################### ############################################################################### # # CONTACTS # ############################################################################### # Just one contact defined by default - the Nagios admin (that's you) # This contact definition inherits a lot of default values from the # 'generic-contact' template which is defined elsewhere. # contact nagios #define contact { # contact_name nagiosadmin ; Short name of user # use generic-contact ; Inherit default values from generic-contact template (defined above) # alias Nagios Admin ; Full name of user # email nagios@localhost ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ****** #} define contact{ contact_name nagiosadmin alias Nagios Admin service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,r service_notification_commands notify-service-by-email host_notification_commands notify-host-by-email email bastian_luthfi@luckytex.com } # Contact Telegram #define contact { # contact_name telegramgroup ; Short name of user # use generic-contact ; Inherit default values from generic-contact template (defined above) # alias Telegram Group ; Full name of user # _telegroup -614898207 ; <<***** CHANGE THIS TO YOUR GroupID Telegram ****** #} ############################################################################### # # CONTACT GROUPS # ############################################################################### # We only have one contact in this simple configuration file, so there is # no need to create more than one contact group. # Group Nagios define contactgroup { contactgroup_name admins alias Nagios Administrators members nagiosadmin } #Group Telegram #define contactgroup { # contactgroup_name admins # alias Nagios Administrators # members nagiosadmin #}
############################################################################### # LOCALHOST.CFG - SAMPLE OBJECT CONFIG FILE FOR MONITORING THIS MACHINE # # # NOTE: This config file is intended to serve as an *extremely* simple # example of how you can create configuration entries to monitor # the local (Linux) machine. # ############################################################################### ############################################################################### # # HOST DEFINITION # ############################################################################### # Define a host for the local machine define host { use linux-server ; Name of host template to use ; This host definition will inherit all variables that are defined ; in (or inherited by) the linux-server host template definition. host_name localhost alias localhost address 127.0.0.1 } ############################################################################### # # HOST GROUP DEFINITION # ############################################################################### # Define an optional hostgroup for Linux machines #define hostgroup { # hostgroup_name linux-servers ; The name of the hostgroup # alias Linux Servers ; Long name of the group # members localhost ; Comma separated list of hosts that belong to this group #} ############################################################################### # # SERVICE DEFINITIONS # ############################################################################### # Define a service to "ping" the local machine define service { use local-service ; Name of service template to use host_name localhost service_description PING check_command check_ping!100.0,20%!500.0,60% } # Define a service to check the disk space of the root partition # on the local machine. Warning if < 20% free, critical if # < 10% free space on partition. define service { use local-service ; Name of service template to use host_name localhost service_description Root Partition check_command check_local_disk!20%!10%!/ } # Define a service to check the number of currently logged in # users on the local machine. Warning if > 20 users, critical # if > 50 users. define service { use local-service ; Name of service template to use host_name localhost service_description Current Users check_command check_local_users!20!50 } # Define a service to check the number of currently running procs # on the local machine. Warning if > 250 processes, critical if # > 400 processes. define service { use local-service ; Name of service template to use host_name localhost service_description Total Processes check_command check_local_procs!250!400!RSZDT } # Define a service to check the load on the local machine. define service { use local-service ; Name of service template to use host_name localhost service_description Current Load check_command check_local_load!5.0,4.0,3.0!10.0,6.0,4.0 } # Define a service to check the swap usage the local machine. # Critical if less than 10% of swap is free, warning if less than 20% is free define service { use local-service ; Name of service template to use host_name localhost service_description Swap Usage check_command check_local_swap!20%!10% } # Define a service to check SSH on the local machine. # Disable notifications for this service by default, as not all users may have SSH enabled. define service { use local-service ; Name of service template to use host_name localhost service_description SSH check_command check_ssh notifications_enabled 0 } # Define a service to check HTTP on the local machine. # Disable notifications for this service by default, as not all users may have HTTP enabled. define service { use local-service ; Name of service template to use host_name localhost service_description HTTP check_command check_http notifications_enabled 0 }
4. templates.cfg
############################################################################### # TEMPLATES.CFG - SAMPLE OBJECT TEMPLATES # # # NOTES: This config file provides you with some example object definition # templates that are referred by other host, service, contact, etc. # definitions in other config files. # # You don't need to keep these definitions in a separate file from your # other object definitions. This has been done just to make things # easier to understand. # ############################################################################### ############################################################################### # # CONTACT TEMPLATES # ############################################################################### # Generic contact definition template # This is NOT a real contact, just a template! define contact { name generic-contact ; The name of this contact template service_notification_period 24x7 ; service notifications can be sent anytime host_notification_period 24x7 ; host notifications can be sent anytime service_notification_options w,u,c,r,f,s ; send notifications for all service states, flapping events, and scheduled downtime events host_notification_options d,u,r,f,s ; send notifications for all host states, flapping events, and scheduled downtime events service_notification_commands notify-service-by-email ; send service notifications via email host_notification_commands notify-host-by-email ; send host notifications via email register 0 ; DON'T REGISTER THIS DEFINITION - ITS NOT A REAL CONTACT, JUST A TEMPLATE! } ############################################################################### # # HOST TEMPLATES # ############################################################################### # Generic host definition template # This is NOT a real host, just a template! define host { name generic-host ; The name of this host template notifications_enabled 1 ; Host notifications are enabled event_handler_enabled 1 ; Host event handler is enabled flap_detection_enabled 1 ; Flap detection is enabled process_perf_data 1 ; Process performance data retain_status_information 1 ; Retain status information across program restarts retain_nonstatus_information 1 ; Retain non-status information across program restarts notification_period 24x7 ; Send host notifications at any time register 0 ; DON'T REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! } # Linux host definition template # This is NOT a real host, just a template! define host { name linux-server ; 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 5 ; Actively check the host every 5 minutes retry_interval 1 ; Schedule host check retries at 1 minute intervals max_check_attempts 10 ; Check each Linux host 10 times (max) check_command check-host-alive ; Default command to check Linux hosts notification_period workhours ; 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 admins ; Notifications get sent to the admins by default register 0 ; DON'T REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! } # Windows host definition template # This is NOT a real host, just a template! define host { name windows-server ; The name of this host template use generic-host ; Inherit default values from the generic-host template check_period 24x7 ; By default, Windows servers are monitored round the clock check_interval 5 ; Actively check the server every 5 minutes retry_interval 1 ; Schedule host check retries at 1 minute intervals max_check_attempts 10 ; Check each server 10 times (max) check_command check-host-alive ; Default command to check if servers are "alive" notification_period 24x7 ; Send notification out at any time - day or night notification_interval 30 ; Resend notifications every 30 minutes notification_options d,r ; Only send notifications for specific host states contact_groups admins ; Notifications get sent to the admins by default hostgroups windows-servers ; Host groups that Windows servers should be a member of register 0 ; DON'T REGISTER THIS - ITS JUST A TEMPLATE } # We define a generic printer template that can # be used for most printers we monitor define host { name generic-printer ; The name of this host template use generic-host ; Inherit default values from the generic-host template check_period 24x7 ; By default, printers are monitored round the clock check_interval 5 ; Actively check the printer every 5 minutes retry_interval 1 ; Schedule host check retries at 1 minute intervals max_check_attempts 10 ; Check each printer 10 times (max) check_command check-host-alive ; Default command to check if printers are "alive" notification_period workhours ; Printers are only used during the workday notification_interval 30 ; Resend notifications every 30 minutes notification_options d,r ; Only send notifications for specific host states contact_groups admins ; Notifications get sent to the admins by default statusmap_image printer.png register 0 ; DON'T REGISTER THIS - ITS JUST A TEMPLATE } # Define a template for switches that we can reuse define host { name generic-switch ; The name of this host template use generic-host ; Inherit default values from the generic-host template check_period 24x7 ; By default, switches are monitored round the clock check_interval 5 ; Switches are checked every 5 minutes retry_interval 1 ; Schedule host check retries at 1 minute intervals max_check_attempts 10 ; Check each switch 10 times (max) check_command check-host-alive ; Default command to check if routers are "alive" notification_period 24x7 ; Send notifications at any time notification_interval 30 ; Resend notifications every 30 minutes notification_options d,r ; Only send notifications for specific host states contact_groups admins ; Notifications get sent to the admins by default statusmap_image switch.png register 0 ; DON'T REGISTER THIS - ITS JUST A TEMPLATE } # Define a template for routers that we can reuse define host{ name generic-router ; The name of this host template use generic-switch ; Inherit default values from the generic-host template statusmap_image router.png register 0 ; DONT REGISTER THIS - ITS JUST A TEMPLATE } ############################################################################### # # SERVICE TEMPLATES # ############################################################################### # Generic service definition template # This is NOT a real service, just a template! define service { name generic-service ; The 'name' of this service template active_checks_enabled 1 ; Active service checks are enabled passive_checks_enabled 1 ; Passive service checks are enabled/accepted parallelize_check 1 ; Active service checks should be parallelized (disabling this can lead to major performance problems) obsess_over_service 1 ; We should obsess over this service (if necessary) check_freshness 0 ; Default is to NOT check service 'freshness' notifications_enabled 1 ; Service notifications are enabled event_handler_enabled 1 ; Service event handler is enabled flap_detection_enabled 1 ; Flap detection is enabled process_perf_data 1 ; Process performance data retain_status_information 1 ; Retain status information across program restarts retain_nonstatus_information 1 ; Retain non-status information across program restarts is_volatile 0 ; The service is not volatile check_period 24x7 ; The service can be checked at any time of the day max_check_attempts 3 ; Re-check the service up to 3 times in order to determine its final (hard) state check_interval 10 ; Check the service every 10 minutes under normal conditions retry_interval 2 ; Re-check the service every two minutes until a hard state can be determined contact_groups admins ; Notifications get sent out to everyone in the 'admins' group notification_options w,u,c,r ; Send notifications about warning, unknown, critical, and recovery events notification_interval 60 ; Re-notify about service problems every hour notification_period 24x7 ; Notifications can be sent out at any time register 0 ; DON'T REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE! } # Local service definition template # This is NOT a real service, just a template! define service { name local-service ; The name of this service template use generic-service ; Inherit default values from the generic-service definition max_check_attempts 4 ; Re-check the service up to 4 times in order to determine its final (hard) state check_interval 5 ; Check the service every 5 minutes under normal conditions retry_interval 1 ; Re-check the service every minute until a hard state can be determined register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL SERVICE, JUST A TEMPLATE! }
############################################################################### # TIMEPERIODS.CFG - SAMPLE TIMEPERIOD DEFINITIONS # # # NOTES: This config file provides you with some example timeperiod definitions # that you can reference in host, service, contact, and dependency # definitions. # # You don't need to keep timeperiods in a separate file from your other # object definitions. This has been done just to make things easier to # understand. # ############################################################################### ############################################################################### # # TIMEPERIOD DEFINITIONS # ############################################################################### # This defines a timeperiod where all times are valid for checks, # notifications, etc. The classic "24x7" support nightmare. :-) define timeperiod { name 24x7 timeperiod_name 24x7 alias 24 Hours A Day, 7 Days A Week sunday 00:00-24:00 monday 00:00-24:00 tuesday 00:00-24:00 wednesday 00:00-24:00 thursday 00:00-24:00 friday 00:00-24:00 saturday 00:00-24:00 } # This defines a timeperiod that is normal workhours for # those of us monitoring networks and such in the U.S. define timeperiod { name workhours timeperiod_name workhours alias Normal Work Hours monday 09:00-17:00 tuesday 09:00-17:00 wednesday 09:00-17:00 thursday 09:00-17:00 friday 09:00-17:00 } # This defines the *perfect* check and notification # timeperiod define timeperiod { name none timeperiod_name none alias No Time Is A Good Time } # Some U.S. holidays # Note: The timeranges for each holiday are meant to *exclude* the holidays from being # treated as a valid time for notifications, etc. You probably don't want your pager # going off on New Year's. Although your employer might... :-) define timeperiod { name us-holidays timeperiod_name us-holidays alias U.S. Holidays january 1 00:00-00:00 ; New Years monday -1 may 00:00-00:00 ; Memorial Day (last Monday in May) july 4 00:00-00:00 ; Independence Day monday 1 september 00:00-00:00 ; Labor Day (first Monday in September) thursday 4 november 00:00-00:00 ; Thanksgiving (4th Thursday in November) december 25 00:00-00:00 ; Christmas } # This defines a modified "24x7" timeperiod that covers every day of the # year, except for U.S. holidays (defined in the timeperiod above). define timeperiod { name 24x7_sans_holidays timeperiod_name 24x7_sans_holidays alias 24x7 Sans Holidays use us-holidays ; Get holiday exceptions from other timeperiod sunday 00:00-24:00 monday 00:00-24:00 tuesday 00:00-24:00 wednesday 00:00-24:00 thursday 00:00-24:00 friday 00:00-24:00 saturday 00:00-24:00 }
systemctl restart nagios
Sampai disini konfigurasi dasar nagios sudah bisa digunakan. Pada artikel selanjutnya kita akan membahas cara menambahkan host dan group host untuk monitoring di nagios.