{"id":377,"date":"2014-03-06T13:28:52","date_gmt":"2014-03-06T13:28:52","guid":{"rendered":"http:\/\/www.confianzit.com\/cit-blog\/?p=377"},"modified":"2022-10-31T17:53:33","modified_gmt":"2022-10-31T17:53:33","slug":"how-to-use-nagios-to-monitor-your-server-and-services","status":"publish","type":"post","link":"https:\/\/www.confianzit.com\/cit-blog\/how-to-use-nagios-to-monitor-your-server-and-services\/","title":{"rendered":"How to use Nagios to monitor your server and services"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;3.22&#8243;][et_pb_row _builder_version=&#8221;4.9.4&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; hover_enabled=&#8221;0&#8243; column_structure=&#8221;3_5,2_5&#8243; sticky_enabled=&#8221;0&#8243;][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_text _builder_version=&#8221;4.9.4&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; hover_enabled=&#8221;0&#8243; module_class=&#8221;blog-left-content&#8221; sticky_enabled=&#8221;0&#8243;]<\/p>\n<p dir=\"ltr\">Nagios is a host and service monitor designed to inform you of network problems before your clients, end-users or managers do. It has been designed to run under the Linux operating system. The monitoring daemon runs intermittent checks on hosts and services you specify using external &#8220;plugins&#8221; which return status information to Nagios. When problems are encountered, the daemon can send notifications out to \u00a0administrative contacts.Current status information, historical logs, and reports can all be accessed via a web browser.<\/p>\n<p dir=\"ltr\">Naigos can be installed with the following command in ubuntu<\/p>\n<p dir=\"ltr\">\u201capt-get install nagios3\u201d<\/p>\n<div>\u00a0<a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/01.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-388\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/01-300x168.png\" alt=\"01\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/01-300x168.png 300w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/01-1024x575.png 1024w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/01.png 1309w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/div>\n<div>\n<p>\u00a0Enter the nagiosadmin password and complete the installation process.<\/p>\n<p><a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/02.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-387\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/02-300x168.png\" alt=\"02\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/02-300x168.png 300w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/02-1024x575.png 1024w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/02.png 1309w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p dir=\"ltr\">There are a couple of directories containing Nagios configuration and check files.<\/p>\n<ul>\n<li dir=\"ltr\">\n<p dir=\"ltr\">\/etc\/nagios3: contains configuration files for the operation of the nagios daemon, CGI files, hosts, etc.<\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\">\/etc\/nagios-plugins: houses configuration files for the service checks.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li dir=\"ltr\">\n<p dir=\"ltr\">\/etc\/nagios: on the remote host contains the nagios-nrpe-server configuration files.<\/p>\n<\/li>\n<li dir=\"ltr\">\n<p dir=\"ltr\">\/usr\/lib\/nagios\/plugins\/: where the check binaries are stored. To see the options of a check use the -h option.<\/p>\n<\/li>\n<\/ul>\n<p>For example: \/usr\/lib\/nagios\/plugins\/check_dhcp -h<\/p>\n<p dir=\"ltr\">After successful installation, there will be a localhost.cfg file in \/etc\/nagios3\/ \u00a0that will be monitoring \u00a0disk space, number of user etc, in the system. It can be viewed by logging into \u00a0the web interface of nagios.The following url can be used to log in to nagios web interface, the user name will be nagiosadmin and the password is the one entered during installation<\/p>\n<p dir=\"ltr\"><b id=\"docs-internal-guid-4836defd-9782-91f6-8f76-0704fa5dc387\"><br \/>http:\/\/ip-of-server\/nagios3<\/b><\/p>\n<div><a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/03.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-386\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/03-300x168.png\" alt=\"03\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/03-300x168.png 300w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/03-1024x575.png 1024w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/03.png 1309w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/div>\n<div>\n<p dir=\"ltr\">Configuring Nagios for checking processes \u00a0that need to be monitored.<\/p>\n<p>\/usr\/lib\/nagios\/plugins contains binaries which can be used to for figuring out process checks.<b><b><br \/><\/b><\/b><\/p>\n<p>For example:<\/p>\n<p dir=\"ltr\">Here is how to check if \u201capache\u201d \u00a0is running or not<\/p>\n<p>\/usr\/lib\/nagios\/plugins\/check_procs -c 1: -C apache2<\/p>\n<p>In the above command<br \/>-c = Generate critical state if metric is outside this range-C = Only scan for exact matches of COMMAND<\/p>\n<p dir=\"ltr\"><a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/04.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-385\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/04-300x168.png\" alt=\"04\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/04-300x168.png 300w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/04-1024x575.png 1024w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/04.png 1309w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<\/div>\n<p dir=\"ltr\">Here is another example to check CPU: nagios will indicate warning if the % cpu \u00a0utilized by any process is greater than 70% and will indicate \u00a0critical alert if the % cpu is greater that 80%<\/p>\n<p dir=\"ltr\">\/usr\/lib\/nagios\/plugins\/check_procs -w 70 -c 80 -m CPU -t 20<\/p>\n<p><b><b>\u00a0<\/b><\/b>In the above command,<\/p>\n<p>-w = Generate warning state if metric is outside this range<br \/>-c = Generate critical state if metric is outside this range<br \/>-m = Check thresholds against metric<br \/>-t = Seconds before connection times out<\/p>\n<p dir=\"ltr\">Once the process checks are figured out , it will be added to \/etc\/nagios-plugin\/config . The above defined commands are updated accordingly in the file<\/p>\n<p>For example<\/p>\n<p>Edit \u00a0proc.cfg(in this case) in \/etc\/nagios-plugin\/config \u00a0to define a customized \u00a0command \u00a0and add the following for the process check we described above. Save proc.cfg.<\/p>\n<p>define command{<br \/>command_name check_service<br \/>command_line \/usr\/lib\/nagios\/plugins\/check_procs -c 1: -C &#8216;$ARG1$&#8217;<br \/>}<\/p>\n<p>define command{<br \/>command_name check_cpu<br \/>command_line \/usr\/lib\/nagios\/plugins\/check_procs -w &#8216;$ARG1$&#8217; -c &#8216;$ARG2$&#8217; -m CPU -t 20<br \/>}<\/p>\n<p dir=\"ltr\">$ARGx$ indicates the arguments that we pass for checking using the command_name<\/p>\n<div>\u00a0<a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/05.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-384\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/05-300x168.png\" alt=\"05\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/05-300x168.png 300w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/05-1024x575.png 1024w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/05.png 1309w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/div>\n<div><b><b>\u00a0<\/b><\/b><\/div>\n<p dir=\"ltr\">Once the customised \u00a0commands are updated in the \/etc\/nagios-plugin\/config, edit \/etc\/nagios3\/config\/localhost.cfg \u00a0and create check for the processes.<\/p>\n<p>Add the following lines in localhost.cfg for checking apache and cpu<\/p>\n<p>define service{<br \/>use generic-service ; Name of service template to use<br \/>host_name localhost<br \/>service_description CPU<br \/>check_command check_cpu!70!80<br \/>}<\/p>\n<p>define service{<br \/>use generic-service ; Name of service template to use<br \/>host_name localhost<br \/>service_description Apache<br \/>check_command check_service!apache2<br \/>}<\/p>\n<\/div>\n<p>Save the file and restart nagios.<b id=\"docs-internal-guid-4836defd-9785-ee6f-b3af-cd182d76faf3\"> <\/b><\/p>\n<p><a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/06.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-383\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/06-300x168.png\" alt=\"06\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/06-300x168.png 300w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/06-1024x575.png 1024w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/06.png 1309w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><b><b>\u00a0<\/b><\/b>Nagios can be restarted using the following command<\/p>\n<p dir=\"ltr\">\/etc\/init.d\/nagios3 restart<\/p>\n<p><b id=\"docs-internal-guid-4836defd-9786-78f4-b609-e1c27ea792e3\"><br \/><\/b>Once we opt nagios for restart, the above process checks will be shown in the web\u00a0interface<\/p>\n<p><a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/07.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-382\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/07-300x168.png\" alt=\"07\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/07-300x168.png 300w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/07-1024x575.png 1024w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/07.png 1309w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p dir=\"ltr\">Configuring Nagios to send email notifications<\/p>\n<p dir=\"ltr\">Edit \/etc\/nagios3\/conf.d\/contact.cfg to \u00a0add a contact \u00a0and define it contact group. Restart Nagios<\/p>\n<p dir=\"ltr\">For example<b><b>\u00a0<\/b><\/b><\/p>\n<p>define contact{<br \/>contact_name rahul<br \/>alias Rahul<br \/>service_notification_period 24&#215;7<br \/>host_notification_period 24&#215;7<br \/>service_notification_options w,u,c,r<br \/>host_notification_options d,r<br \/>service_notification_commands notify-service-by-email<br \/>host_notification_commands notify-host-by-email<br \/>email rahul.nair@confianzit.biz<br \/>}<\/p>\n<p>define contactgroup{<br \/>contactgroup_name admins<br \/>alias Nagios Administrators<br \/>members rahul<br \/>}<\/p>\n<div><\/div>\n<div><a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/08.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-381\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/08-300x168.png\" alt=\"08\" width=\"300\" height=\"168\" srcset=\"https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/08-300x168.png 300w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/08-1024x575.png 1024w, https:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/08.png 1309w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div>Nagios would now send alert on the specified arguments we defined, if it encounters any issues with the process .<\/div>\n<div><\/div>\n<div><span><\/span><\/div>\n<div><span><\/span><\/div>\n<div><span>Confianz\u00a0Global Inc. is an established\u00a0<\/span><a href=\"https:\/\/www.confianzit.com\/\" class=\"rank-math-link\">Software development company<\/a><span>\u00a0and a leading provider of end to end IT services in the United States. We provide custom development solutions across Software Development,\u00a0<\/span><a href=\"https:\/\/www.confianzit.com\/mobile-app-development\" class=\"rank-math-link\">Mobile App Development<\/a><span>,\u00a0<\/span><a href=\"https:\/\/www.confianzit.com\/openerp-customization\" class=\"rank-math-link\">Odoo ERP customization<\/a><span>\u00a0&amp; Implementation and\u00a0<\/span><a href=\"https:\/\/www.confianzit.com\/web-design-development-company\" class=\"rank-math-link\">Responsive Web Design &amp; Development<\/a><span>\u00a0Services.<\/span><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<div><\/div>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;3.25&#8243; custom_padding=&#8221;|||&#8221; custom_padding__hover=&#8221;|||&#8221;][et_pb_code _builder_version=&#8221;4.9.4&#8243; _module_preset=&#8221;default&#8221; locked=&#8221;off&#8221; global_module=&#8221;2151&#8243;]<\/p>\n<div class=\"blog-floating-form\"><!-- [et_pb_line_break_holder] -->  <\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_62 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.confianzit.com\/cit-blog\/how-to-use-nagios-to-monitor-your-server-and-services\/#Talk_to_our_experts_now\" title=\"    Talk to our experts now  \">    Talk to our experts now  <\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.confianzit.com\/cit-blog\/how-to-use-nagios-to-monitor-your-server-and-services\/#Talk_To_Our_Experts_Now\" title=\"Talk To Our Experts Now\n\t\">Talk To Our Experts Now\n\t<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"Talk_to_our_experts_now\"><\/span><!-- [et_pb_line_break_holder] -->    Talk to our experts now<!-- [et_pb_line_break_holder] -->  <span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p><!-- [et_pb_line_break_holder] -->  \n<div class=\"wpcf7 no-js\" id=\"wpcf7-f1888-o1\" lang=\"en-US\" dir=\"ltr\">\n<div class=\"screen-reader-response\"><p role=\"status\" aria-live=\"polite\" aria-atomic=\"true\"><\/p> <ul><\/ul><\/div>\n<form action=\"\/cit-blog\/wp-json\/wp\/v2\/posts\/377#wpcf7-f1888-o1\" method=\"post\" class=\"wpcf7-form init\" aria-label=\"Contact form\" novalidate=\"novalidate\" data-status=\"init\">\n<div style=\"display: none;\">\n<input type=\"hidden\" name=\"_wpcf7\" value=\"1888\" \/>\n<input type=\"hidden\" name=\"_wpcf7_version\" value=\"5.8.6\" \/>\n<input type=\"hidden\" name=\"_wpcf7_locale\" value=\"en_US\" \/>\n<input type=\"hidden\" name=\"_wpcf7_unit_tag\" value=\"wpcf7-f1888-o1\" \/>\n<input type=\"hidden\" name=\"_wpcf7_container_post\" value=\"0\" \/>\n<input type=\"hidden\" name=\"_wpcf7_posted_data_hash\" value=\"\" \/>\n<input type=\"hidden\" name=\"_wpcf7_recaptcha_response\" value=\"\" \/>\n<\/div>\n<div class=\"form-block\" style=\"    background: #fff;\">\n\t<h3 style=\"    background: #0C2464;\n    border-bottom: 5px solid #cecece;\n    border-radius: 5px 5px 90px 90px;\n    margin: 0 auto;\n    text-align: center;\n    padding: 20px;\n    color: #fff;    margin-bottom: 15px;\"><span class=\"ez-toc-section\" id=\"Talk_To_Our_Experts_Now\"><\/span><b>Talk To Our Experts Now<\/b>\n\t<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\t<div style=\"padding:20px;\">\n\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"your-name\"><input size=\"40\" class=\"wpcf7-form-control wpcf7-text wpcf7-validates-as-required your-name\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Name\" value=\"\" type=\"text\" name=\"your-name\" \/><\/span>\n\t\t<\/p>\n\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"your-email\"><input size=\"40\" class=\"wpcf7-form-control wpcf7-email wpcf7-validates-as-required wpcf7-text wpcf7-validates-as-email your-email\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Email\" value=\"\" type=\"email\" name=\"your-email\" \/><\/span>\n\t\t<\/p>\n\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"your-number\"><input size=\"40\" class=\"wpcf7-form-control wpcf7-tel wpcf7-validates-as-required wpcf7-text wpcf7-validates-as-tel your-number\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Phone Number\" value=\"\" type=\"tel\" name=\"your-number\" \/><\/span>\n\t\t<\/p>\n\t\t<p><span class=\"wpcf7-form-control-wrap\" data-name=\"message\"><textarea cols=\"40\" rows=\"10\" class=\"wpcf7-form-control wpcf7-textarea wpcf7-validates-as-required form-message\" aria-required=\"true\" aria-invalid=\"false\" placeholder=\"Message\" name=\"message\"><\/textarea><\/span>\n\t\t<\/p>\n\t<span class=\"wpcf7-form-control-wrap recaptcha\" data-name=\"recaptcha\"><span data-sitekey=\"6LfFkQATAAAAAIYlZ_UH9UozO-OLkpAaWPWx6QtM\" class=\"wpcf7-form-control wpcf7-recaptcha g-recaptcha\"><\/span>\r\n<noscript>\r\n\t<div class=\"grecaptcha-noscript\">\r\n\t\t<iframe loading=\"lazy\" src=\"https:\/\/www.google.com\/recaptcha\/api\/fallback?k=6LfFkQATAAAAAIYlZ_UH9UozO-OLkpAaWPWx6QtM\" frameborder=\"0\" scrolling=\"no\" width=\"310\" height=\"430\">\r\n\t\t<\/iframe>\r\n\t\t<textarea name=\"g-recaptcha-response\" rows=\"3\" cols=\"40\" placeholder=\"reCaptcha Response Here\">\r\n\t\t<\/textarea>\r\n\t<\/div>\r\n<\/noscript>\r\n<\/span>\n\t\t<div class=\"form-buttons\">\n\t\t\t<p><input class=\"wpcf7-form-control wpcf7-submit has-spinner\" type=\"submit\" value=\"Get a free quote\" \/>\n\t\t\t<\/p>\n\t\t<\/div>\n\t<\/div>\n<\/div><div class=\"wpcf7-response-output\" aria-hidden=\"true\"><\/div>\n<\/form>\n<\/div>\n<!-- [et_pb_line_break_holder] --><\/div>\n<p>[\/et_pb_code][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nagios is a host and service monitor designed to inform you of network problems before your clients, end-users or managers do. It has been designed to run under the Linux operating system. The monitoring daemon runs intermittent checks on hosts and services you specify using external &#8220;plugins&#8221; which return status information to Nagios. When problems [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":391,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"<p dir=\"ltr\">Nagios is a host and service monitor designed to inform you of network problems before your clients, end-users or managers do. It has been designed to run under the Linux operating system. The monitoring daemon runs intermittent checks on hosts and services you specify using external \"plugins\" which return status information to Nagios. When problems are encountered, the daemon can send notifications out to &nbsp;administrative contacts.Current status information, historical logs, and reports can all be accessed via a web browser.<\/p>\n<p dir=\"ltr\">Naigos can be installed with the following command in ubuntu<\/p>\n<p dir=\"ltr\">\u201capt-get install nagios3\u201d<\/p>\n\n<div>&nbsp;<a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/01.png\"><img class=\"alignnone size-medium wp-image-388\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/01-300x168.png\" alt=\"01\" width=\"300\" height=\"168\"><\/a><\/div>\n<div>\n\n&nbsp;Enter the nagiosadmin password and complete the installation process.\n\n<a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/02.png\"><img class=\"alignnone size-medium wp-image-387\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/02-300x168.png\" alt=\"02\" width=\"300\" height=\"168\"><\/a>\n<p dir=\"ltr\">There are a couple of directories containing Nagios configuration and check files.<\/p>\n\n<ul>\n \t<li dir=\"ltr\">\n<p dir=\"ltr\">\/etc\/nagios3: contains configuration files for the operation of the nagios daemon, CGI files, hosts, etc.<\/p>\n<\/li>\n \t<li dir=\"ltr\">\n<p dir=\"ltr\">\/etc\/nagios-plugins: houses configuration files for the service checks.<\/p>\n<\/li>\n<\/ul>\n<ul>\n \t<li dir=\"ltr\">\n<p dir=\"ltr\">\/etc\/nagios: on the remote host contains the nagios-nrpe-server configuration files.<\/p>\n<\/li>\n \t<li dir=\"ltr\">\n<p dir=\"ltr\">\/usr\/lib\/nagios\/plugins\/: where the check binaries are stored. To see the options of a check use the -h option.<\/p>\n<\/li>\n<\/ul>\nFor example: \/usr\/lib\/nagios\/plugins\/check_dhcp -h\n<p dir=\"ltr\">After successful installation, there will be a localhost.cfg file in \/etc\/nagios3\/ &nbsp;that will be monitoring &nbsp;disk space, number of user etc, in the system. It can be viewed by logging into &nbsp;the web interface of nagios.The following url can be used to log in to nagios web interface, the user name will be nagiosadmin and the password is the one entered during installation<\/p>\n<p dir=\"ltr\"><b id=\"docs-internal-guid-4836defd-9782-91f6-8f76-0704fa5dc387\">\nhttp:\/\/ip-of-server\/nagios3<\/b><\/p>\n\n<div><a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/03.png\"><img class=\"alignnone size-medium wp-image-386\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/03-300x168.png\" alt=\"03\" width=\"300\" height=\"168\"><\/a><\/div>\n<div>\n<p dir=\"ltr\">Configuring Nagios for checking processes &nbsp;that need to be monitored.<\/p>\n\/usr\/lib\/nagios\/plugins contains binaries which can be used to for figuring out process checks.<b><b>\n<\/b><\/b>\n\nFor example:\n<p dir=\"ltr\">Here is how to check if \u201capache\u201d &nbsp;is running or not<\/p>\n\/usr\/lib\/nagios\/plugins\/check_procs -c 1: -C apache2\n\nIn the above command\n-c = Generate critical state if metric is outside this range-C = Only scan for exact matches of COMMAND\n<p dir=\"ltr\"><a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/04.png\"><img class=\"alignnone size-medium wp-image-385\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/04-300x168.png\" alt=\"04\" width=\"300\" height=\"168\"><\/a><\/p>\n\n<\/div>\n<p dir=\"ltr\">Here is another example to check CPU: nagios will indicate warning if the % cpu &nbsp;utilized by any process is greater than 70% and will indicate &nbsp;critical alert if the % cpu is greater that 80%<\/p>\n<p dir=\"ltr\">\/usr\/lib\/nagios\/plugins\/check_procs -w 70 -c 80 -m CPU -t 20<\/p>\n<b><b>&nbsp;<\/b><\/b>In the above command,\n\n-w = Generate warning state if metric is outside this range\n-c = Generate critical state if metric is outside this range\n-m = Check thresholds against metric\n-t = Seconds before connection times out\n<p dir=\"ltr\">Once the process checks are figured out , it will be added to \/etc\/nagios-plugin\/config . The above defined commands are updated accordingly in the file<\/p>\nFor example\n\nEdit &nbsp;proc.cfg(in this case) in \/etc\/nagios-plugin\/config &nbsp;to define a customized &nbsp;command &nbsp;and add the following for the process check we described above. Save proc.cfg.\n\ndefine command{\ncommand_name check_service\ncommand_line \/usr\/lib\/nagios\/plugins\/check_procs -c 1: -C '$ARG1$'\n}\n\ndefine command{\ncommand_name check_cpu\ncommand_line \/usr\/lib\/nagios\/plugins\/check_procs -w '$ARG1$' -c '$ARG2$' -m CPU -t 20\n}\n<p dir=\"ltr\">$ARGx$ indicates the arguments that we pass for checking using the command_name<\/p>\n\n<div>&nbsp;<a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/05.png\"><img class=\"alignnone size-medium wp-image-384\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/05-300x168.png\" alt=\"05\" width=\"300\" height=\"168\"><\/a><\/div>\n<div><b><b>\n<\/b><\/b><\/div>\n<p dir=\"ltr\">Once the customised &nbsp;commands are updated in the \/etc\/nagios-plugin\/config, edit \/etc\/nagios3\/config\/localhost.cfg &nbsp;and create check for the processes.<\/p>\nAdd the following lines in localhost.cfg for checking apache and cpu\n\ndefine service{\nuse generic-service ; Name of service template to use\nhost_name localhost\nservice_description CPU\ncheck_command check_cpu!70!80\n}\n\ndefine service{\nuse generic-service ; Name of service template to use\nhost_name localhost\nservice_description Apache\ncheck_command check_service!apache2\n}\n\n<\/div>\nSave the file and restart nagios.<b id=\"docs-internal-guid-4836defd-9785-ee6f-b3af-cd182d76faf3\"> <\/b>\n\n<a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/06.png\"><img class=\"alignnone size-medium wp-image-383\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/06-300x168.png\" alt=\"06\" width=\"300\" height=\"168\"><\/a>\n\n<b><b>&nbsp;<\/b><\/b>Nagios can be restarted using the following command\n<p dir=\"ltr\">\/etc\/init.d\/nagios3 restart<\/p>\n<b id=\"docs-internal-guid-4836defd-9786-78f4-b609-e1c27ea792e3\">\n<\/b>Once we opt nagios for restart, the above process checks will be shown in the web&nbsp;interface\n\n<a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/07.png\"><img class=\"alignnone size-medium wp-image-382\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/07-300x168.png\" alt=\"07\" width=\"300\" height=\"168\"><\/a>\n<p dir=\"ltr\">Configuring Nagios to send email notifications<\/p>\n<p dir=\"ltr\">Edit \/etc\/nagios3\/conf.d\/contact.cfg to &nbsp;add a contact &nbsp;and define it contact group. Restart Nagios<\/p>\n<p dir=\"ltr\">For example<b><b>&nbsp;<\/b><\/b><\/p>\ndefine contact{\ncontact_name rahul\nalias Rahul\nservice_notification_period 24x7\nhost_notification_period 24x7\nservice_notification_options w,u,c,r\nhost_notification_options d,r\nservice_notification_commands notify-service-by-email\nhost_notification_commands notify-host-by-email\nemail rahul.nair@confianzit.biz\n}\n\ndefine contactgroup{\ncontactgroup_name admins\nalias Nagios Administrators\nmembers rahul\n}\n<div><\/div>\n<div><a href=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/08.png\"><img class=\"alignnone size-medium wp-image-381\" src=\"http:\/\/www.confianzit.com\/cit-blog\/wp-content\/uploads\/2014\/03\/08-300x168.png\" alt=\"08\" width=\"300\" height=\"168\"><\/a><\/div>\n<div><\/div>\n<div><\/div>\n<div>Nagios would now send alert on the specified arguments we defined, if it encounters any issues with the process .<\/div>\n<div><\/div>\n<div><\/div>","_et_gb_content_width":"","footnotes":""},"categories":[3,7,8],"tags":[],"_links":{"self":[{"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/posts\/377"}],"collection":[{"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/comments?post=377"}],"version-history":[{"count":16,"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/posts\/377\/revisions"}],"predecessor-version":[{"id":2348,"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/posts\/377\/revisions\/2348"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/media\/391"}],"wp:attachment":[{"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/media?parent=377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/categories?post=377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.confianzit.com\/cit-blog\/wp-json\/wp\/v2\/tags?post=377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}