{"id":300,"date":"2019-05-14T13:59:23","date_gmt":"2019-05-14T13:59:23","guid":{"rendered":"https:\/\/blog.iabsolute.com\/?p=300"},"modified":"2019-05-14T13:59:23","modified_gmt":"2019-05-14T20:59:23","slug":"nagios-upgrade","status":"publish","type":"post","link":"https:\/\/blog.iabsolute.com\/?p=300","title":{"rendered":"nagios upgrade"},"content":{"rendered":"\n<p><strong>Steps to Upgrade Nagios<\/strong><\/p>\n\n\n\n<p><strong>There are 2 ways of Backing up Nagios<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Taking a snapshot via vSphere (VMware) if it\u2019s a VM.<\/li><li>Follow the backup process defined below<\/li><\/ol>\n\n\n\n<p><strong>Backup Nagios Config and Plugins before proceeding<\/strong><\/p>\n\n\n\n<p>The upgrade process wont overwrite any of your config files but it\u2019s a good practise to be on a safe side.<\/p>\n\n\n\n<p>Login into SSH terminal of the Nagios Server and then copy and compress (tar) the files of Nagios<\/p>\n\n\n\n<p>as a backup in case of a failover.<\/p>\n\n\n\n<p>Stop Nagios and Apache service<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># service nagios stop\n# service httpd stop<\/pre>\n\n\n\n<p>Create a directory in \u201c\/tmp\u201d called \u201cnagios_backup\u201d and copy &amp; compress Nagios files<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># mkdir \/tmp\/nagios_backup\n# tar -cvvzf \/tmp\/nagios_backup\/nagios_bkp.tar \/usr\/local\/nagios<\/pre>\n\n\n\n<p>The above command makes a copy of this location<\/p>\n\n\n\n<p>\/usr\/local\/nagios\/<strong>bin,etc,libexec,sbin,share,var<\/strong><\/p>\n\n\n\n<p>Backed up files you will have now would be as given below. Copy them to an alternate location if required.<\/p>\n\n\n\n<p># \/tmp\/nagios_bkp.tar<\/p>\n\n\n\n<p><strong>Download and upgrade Nagios to version 4.x.x<\/strong><\/p>\n\n\n\n<p>Download the new version of Nagios v4.2.4<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># cd \/tmp\n# wget https:\/\/assets.nagios.com\/downloads\/nagioscore\/releases\/nagios-4.2.4.tar.gz<\/pre>\n\n\n\n<p>Untar the package to start install process<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># tar -zxvf \/tmp\/nagios-4.2.4.tar.gz<\/pre>\n\n\n\n<p><strong>NOTE:<\/strong> <em>Make sure you have installed unzip as the upgrade requires it.<\/em><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># yum -y install unzip<\/pre>\n\n\n\n<p>New directory will be created called nagios-4.2.4. cd into it and start the source install<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># cd \/tmp\/nagios-4.2.4\n# .\/configure --with-command-group=nagcmd\n# make all\n# make install<\/pre>\n\n\n\n<p><strong>Verify the upgrade and restart required services<\/strong><\/p>\n\n\n\n<p>Once the above process is completed run the verification check on the upgrade to make sure<\/p>\n\n\n\n<p>there are no errors reported.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \/usr\/local\/nagios\/bin\/nagios -v \/usr\/local\/nagios\/etc\/nagios.cfg<\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<p>If no errors found then go ahead and restart Nagios &amp; Apache service.<\/p>\n\n\n\n<p>If any errors are found it would be displayed during the pre-flight check and can be act upon accordingly.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># service nagios restart\n# service httpd restart<\/pre>\n\n\n\n<p>Login into Nagios Server and make sure all the hosts and services are up and running.<\/p>\n\n\n\n<p>Link: <em>http:\/\/nagios-server\/nagios\/<\/em><\/p>\n\n\n\n<p><em>-=-=-=-=-=-=-=-=-=-<\/em><\/p>\n\n\n\n<p><strong>Steps for Restore (in case of a Failover)<\/strong><\/p>\n\n\n\n<p><strong>There are 2 ways of restoring Nagios<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Rollback the snapshot via vSphere (VMware) if it\u2019s a VM.<\/li><li>Follow the restore process defined below<\/li><\/ol>\n\n\n\n<p><strong>Restore Nagios version to 4.x.x from the backup (config and plugins)<\/strong><\/p>\n\n\n\n<p>Login into SSH terminal of the Nagios Server and cd into \/tmp folder where the backup was saved.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># cd \/tmp\/nagios_backup\/<\/pre>\n\n\n\n<p>Untar the tar backup file<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># tar -xvf nagios_bkp.tar<\/pre>\n\n\n\n<p>Once the Untar is done, we need to delete the upgraded Nagios config files and the replace them with the previous version of Nagios 4.x.x<\/p>\n\n\n\n<p><strong>(NOTE: This is solely your responsibility so please make sure to backup before proceeding)<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># rm -r \/usr\/local\/nagios\/*<\/pre>\n\n\n\n<p>Copy the backup files into \/usr\/local\/nagios (default Nagios Folder)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># cp -rp \/tmp\/nagios_backup\/usr\/local\/nagios\/* \/usr\/local\/nagios\/<\/pre>\n\n\n\n<p><strong>Note:<\/strong> Make sure \u201c<strong>-p<\/strong>\u201d is used so that the folder and files owner and permissions are \u200eb\u1ea3o qu\u1ea3n\u200e.<\/p>\n\n\n\n<p><strong>Verify the downgrade and restart required services<\/strong><\/p>\n\n\n\n<p>Once the above process is completed run the verification check on the upgrade to make sure there are no errors reported.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># \/usr\/local\/nagios\/bin\/nagios -v \/usr\/local\/nagios\/etc\/nagios.cfg<\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<p>If no errors found then go ahead and restart Nagios &amp; Apache service.<\/p>\n\n\n\n<p>If any errors are found it would be displayed during the pre-flight check and can be act upon accordingly.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># service nagios restart\n# service httpd restart<\/pre>\n\n\n\n<p>Login into Nagios Server and make sure all the hosts and services are up and running.<\/p>\n\n\n\n<p>Link: <em>http:\/\/nagios-server\/nagios\/<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Steps to Upgrade Nagios There are 2 ways of Backing up Nagios Taking a snapshot via vSphere (VMware) if it\u2019s a VM. Follow the backup process defined below Backup Nagios Config and Plugins before proceeding The upgrade process wont overwrite &hellip; <a href=\"https:\/\/blog.iabsolute.com\/?p=300\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-300","post","type-post","status-publish","format-standard","hentry","category-nagios"],"_links":{"self":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=300"}],"version-history":[{"count":1,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/300\/revisions"}],"predecessor-version":[{"id":301,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=\/wp\/v2\/posts\/300\/revisions\/301"}],"wp:attachment":[{"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iabsolute.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}