Editing
Adding Linux Host in Nagios
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Adding Unix host to Nagios: 1. Connect to Nagios server #cd /usr/local/etc/nagios/objects/machines #vi apoyar.cfg (depending on whether we are adding host for Apoyar or other customers) 2. We did for apoyar unix server hostname (test-Linux) 3. Copy the configuration format for linux server added before and e.dit the hostname and address for new host. 4. Add the host name in member list to recognize Nagios probe for checks Save file (:wq!) and exit vi editor Go to below path • cd /usr/local/etc/nagios/objects • vi services.cfg 5. Add the new hostname to the services, which we need for new server in Nagios, for those services, which we need to monitor. 6. Go to that particular service configuration and enter new server name manually Save file (:wq!) and exit vi editor Note: Host machine should ping from Nagios server to confirm that servers are communicating each other. One more thing that it can be SSH to test-Linux server from Nagios server without password. 7. Connect from test-Linux server from Nagios server using Nagios user account with password. 8. If user account is existing in test-Linux server it will access else it will not (due to Nagios user account doesn’t exist) 9. Once configuration changes done on Nagios server, connect machine which you are adding to Nagios (test-Linux) server. 10. Need to create user name with home folder for user #adduser nagios Set password for nagios to access from Nagios server #password nagios #cd /home/nagios #mkdir .ssh #mkdir bin 11. After that need to change owner of those folder which is created by root. #chown nagios:nagios .ssh/ -R #chown nagios:nagios bin –R 12. Run below command from Nagios server to copy public key file to access server password authentication less. #scp .ssh/id_rsa.pub user@remotehost:~/.ssh/authorized_keys 13. Once key file copied into test-Linux server. 14. Need to install nagios packages on host machine #dpkg –l | grep nagios # to check which packages to be installed Monitoring-plugins Nagios-plugins Using below commands # apt-get install nagios-plugins # apt-get install monitoring-plugins 15. But we don’t copy those checks files into bin folder, because whenever doing updates it will use latest versions of plugins it will create on issue. So just will create soft links from actual installed folder to newly created bin folder on Nagios folder path. # ln –s /usr/lib/nagios/plugins/check_load /home/nagios/bin/ # ln –s /usr/lib/nagios/plugins/check_users /home/nagios/bin/ # ln –s /usr/lib/nagios/plugins/check_uptime /home/nagios/bin/ # ln –s /usr/lib/nagios/plugins/check_disk /home/nagios/bin/ # ln –s /usr/lib/nagios/plugins/check_swap /home/nagios/bin/ # ln –s /usr/lib/nagios/plugins/check_procs /home/nagios/bin/ 16. After that we need to copy some files from nagios server plugins folder path to hosted server into bin folder. Connect nagios server #su – nagios #cd plugins #scp check_debian_packages check_mem.pl check_uptime.sh test-Linux:/home/nagios/bin Once all these done change Nagios user account password on test-Linux server which we don’t use future as well it is more secure with password generator. 17. It will start checking service checks. If you want to add more services for monitoring like, Nginx, php, disk io status. 18. Copy check files from nagios server to test-Linux server bin path like above. #scp check_nginx_status.pl check_phpfpm_status.pl check_diskio.pl test-Linux:/home/nagios/bin 19. Once copied into test-Linux sevrer Execute those files # cd /home/nagios/bin #./check_nginx_status.pl # .pl extension means perl programing language #./check_phpfpm_status.pl #./check_diskio.pl # might be it will throw errors which is not installed supporting packages. Error will be Array/unique.pm missing # apt-cache search perl number::format # to find pm extension packages list search using the above command format. # apr-cache search perl array::unique It will list package names and install it that. Similar way finds the missing packages and install it until there are no errors reported. # apt-get install libarray-unique-perl # ./check_diskio.pl # without any error message it has to execute. 20. If Host server is using multi cores we have to copy check_cpu.py file from nagios to test-linux server #cd /home/nagios/bin/ #. /check_cpu.py # py extension means python packages If the errors are reporting due to missing python packages install it. # apt-get install python-psutil Then it will be ok to monitor multiple cores which we did for Bleckmann MySQL which is having 32 cores.
Summary:
Please note that all contributions to Apoyar Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Apoyar Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
British English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Apoyar Infrastructure
Active Directory
Recent changes
Random page
Upload file
Tools
What links here
Related changes
Special pages
Page information