If you don’t have working Nagios installation fell free to follow Nagios – New installation on Debian 9 link.
We will need to add folder structure (for better organization) to nagios config file:
# edit nagios.cfg mcedit /usr/local/nagios/etc/nagios.cfg # lets add out root dir that will store our config files for device/network # this way we don't need to type cfg_file for each .cfg file out there cfg_dir=/usr/local/nagios/etc/devices # save file and create proper directory mkdir /usr/local/nagios/etc/devices cd /usr/local/nagios/etc/devices
Not everyone have luxury to always use smart switches around network – those make live a lot easier, but life is not a dream 🙂
Let us make a template for non-smart aka no-ping switches:
define host{ name noping-host ; The name of this host template notifications_enabled 1 event_handler_enabled 1 flap_detection_enabled 1 process_perf_data 1 retain_status_information 1 retain_nonstatus_information 1 notification_interval 0 notification_period 24x7 notification_options d,u,r contact_groups admins max_check_attempts 5 address 127.0.0.1 ; Just so we don't have to write it all the time register 0 }
Now we can define few switches like this:
define host{ use noping-host host_name switch-number-1 alias Switch Number 1 icon_image switch40.png statusmap_image switch40.gd2 parent name_of_parent_host_name ; use this to make tree on map initial_status u }
You can most variables put to template file so there will be even less writing
Most common type of templete is: linux-server (you can check others in /usr/local/nagios/etc/objects/templates.cfg )
After making few .cfg files inside our directory remamber to chown nagios:nagios -R /usr/local/nagios/etc/devices/ to avoid erros and restart nagios