{"id":265,"date":"2012-01-29T14:36:34","date_gmt":"2012-01-29T22:36:34","guid":{"rendered":"https:\/\/digitalcardboard.com\/blog\/?p=265"},"modified":"2012-06-25T12:11:29","modified_gmt":"2012-06-25T20:11:29","slug":"upgrading-to-nconf-1-3-0-on-ubuntu-11-10-oneiric-ocelot","status":"publish","type":"post","link":"https:\/\/digitalcardboard.com\/blog\/2012\/01\/29\/upgrading-to-nconf-1-3-0-on-ubuntu-11-10-oneiric-ocelot\/","title":{"rendered":"Upgrading to NConf 1.3.0 on Ubuntu 11.10 Oneiric Ocelot"},"content":{"rendered":"<p>Congrats to the NConf crew for reaching the 1.3.0 milestone! Two years in the making, but I&#8217;m excited to see the project continuing to move forward.<\/p>\n<p>It&#8217;s been over a year since I originally <a title=\"Nagios and NConf on Ubuntu 10.04 Lucid Lynx\" href=\"https:\/\/digitalcardboard.com\/blog\/2010\/08\/24\/nagios-and-nconf-on-ubuntu-10-04-lucid-lynx\/\" target=\"_blank\">installed and configured Nagios and NConf 1.2.6 on my Lucid Lynx server<\/a>. In the meantime, I&#8217;ve upgraded the hardware and moved to Ubuntu 11.10 Oneiric Ocelot, mostly to keep up with the current releases. Not a whole lot has changed for what I use this server for, but keeping up with the Nagios releases in the repos has been convenient.<\/p>\n<p>If you&#8217;re following along with this guide but starting fresh with Nagios and Nconf, you&#8217;ll probably want to <a title=\"Nagios and NConf on Ubuntu 10.04 Lucid Lynx\" href=\"https:\/\/digitalcardboard.com\/blog\/2010\/08\/24\/nagios-and-nconf-on-ubuntu-10-04-lucid-lynx\/\" target=\"_blank\">take a look at my previous guide<\/a>\u00a0and the\u00a0<a href=\"http:\/\/www.nconf.org\/dokuwiki\/doku.php?id=nconf:help:documentation:start:installation\" target=\"_blank\">NConf installation documentation<\/a> to get some background information. I&#8217;ll try to provide some notes for those of you doing a fresh install, but since I&#8217;m just upgrading, I can&#8217;t make any promises.<\/p>\n<h2>Backups!<\/h2>\n<p>Log into your server and make them backups!<\/p>\n<pre>sudo cp -rp \/var\/www\/nconf \/var\/www\/nconf.bak\r\nmysqldump -u root -p nconf &gt; ~\/nconf_sql.bak<\/pre>\n<p>I also backed up my Nagios configs<\/p>\n<pre>sudo cp -rp \/etc\/nagios3 \/etc\/nagios3.bak<\/pre>\n<h2>Download and Unpack<\/h2>\n<p>Wget or otherwise <a href=\"http:\/\/www.nconf.org\/dokuwiki\/doku.php?id=nconf:download:main\" target=\"_blank\">download the latest version on Nconf<\/a>. Wget has that issue with following SourceForge links so you may need to rename the file.<\/p>\n<p>Unpack the files and then copy them to where you installed NConf before, or do it all in one step:<\/p>\n<pre>sudo tar xzvf nconf-1.3.0-0.tgz -C \/var\/www<\/pre>\n<p>Then fix the permissions for the NConf folder, setting them back to your apache user:<\/p>\n<pre>sudo chown -R www-data:www-data \/var\/www\/nconf<\/pre>\n<h2>Upgrade<\/h2>\n<p>Browse to <em>http:\/\/&lt;yourserver&gt;\/nconf\/UPDATE.php<\/em><\/p>\n<p>Follow the prompts to proceed with the interactive update. <a href=\"http:\/\/www.nconf.org\/dokuwiki\/doku.php?id=nconf:help:documentation:start:update#begin_interactive_update\" target=\"_blank\">NConf&#8217;s documentation on the update process<\/a> has screenshots that I won&#8217;t repost here.<\/p>\n<p>After the upgrade, you&#8217;ll need to remove some files and folders. Browse to your NConf folder and nuke them. I also had to remove the <em>call_ajax.php<\/em> file, which wasn&#8217;t in the original documentation.<\/p>\n<pre>cd \/var\/www\/nconf\r\nsudo rm -rf INSTALL\/ UPDATE\/ INSTALL.php UPDATE.php call_ajax.php<\/pre>\n<p>There&#8217;s been a few changes\/additions to the NConf conf file, so open up <em>config\/nconf.php<\/em> and add the following lines:<\/p>\n<pre>define('CHECK_UPDATE', 1);\r\ndefine(\"DEBUG_GENERATE\", 3); # [1=ERROR|2=WARN|3=INFO|4=DEBUG|5=TRACE]\r\ndefine('CHECK_STATIC_SYNTAX', 1);<\/pre>\n<p>Also, set the <em>ALLOW_DEPLOYMENT<\/em> variable to 1 to enable deploying configs directly from NConf and comment out the other <em>CONF_DEPLOY_<\/em> variables, as they aren&#8217;t used anymore.<\/p>\n<pre>define('ALLOW_DEPLOYMENT', 1);\r\n#define('CONF_DEPLOY_URL', \"https:\/\/webserver.mydomain.com\/incoming_config.php\");\r\n#define('CONF_DEPLOY_USER', \"deployUser\");\r\n#define('CONF_DEPLOY_PWD', \"deployPass\");<\/pre>\n<p>At this point, you should be able to log into NConf 1.3.0 and look around.<\/p>\n<h2>Migrating Deployment<\/h2>\n<p>With NConf 1.2.6, I used the <em>ADD-ONS\/deploy_local.sh<\/em> script and a cron job to deploy configuration changes to Nagios. In 1.3.0, they&#8217;ve integrated this a little better into the core of the application, but it required some adjustment in my setup.<\/p>\n<p>Start off by coping the deployment.ini sample configuration file to the config folder:<\/p>\n<pre>sudo cp \/var\/www\/nconf\/config.orig\/deployment.ini \/var\/www\/nconf\/config\/deployment.ini<\/pre>\n<p>Open up the <em>config\/deployment.ini<\/em> file, uncomment the <em>LOCAL deployment<\/em> section <strong>except<\/strong> for the <em>[copy nagios.cfg]<\/em> section and change the <em>target_file<\/em> variables to reference the <em>nagios3<\/em> folder where Ubuntu places the config files.<\/p>\n<p>Also, add the reload command <em>(sudo \/etc\/init.d\/nagios3 reload)<\/em> at the bottom of the <em>[copy global config]<\/em> section. When you&#8217;re done the file will look similar to the following:<\/p>\n<pre>;; LOCAL deployment ;;\r\n\r\n[extract config]\r\ntype = local\r\nsource_file = \"\/var\/www\/nconf\/output\/NagiosConfig.tgz\"\r\ntarget_file = \"\/tmp\/\"\r\naction = extract\r\n\r\n[copy collector config]\r\ntype = local\r\nsource_file = \"\/tmp\/Default_collector\/\"\r\n;target_file = \"\/etc\/nagios\/Default_collector\/\"\r\ntarget_file = \"\/etc\/nagios3\/Default_collector\/\"\r\naction = copy\r\n\r\n[copy global config]\r\ntype = local\r\nsource_file = \"\/tmp\/global\/\"\r\n;target_file = \"\/etc\/nagios\/global\/\"\r\ntarget_file = \"\/etc\/nagios3\/global\/\"\r\naction = copy\r\n; *** add the line below\r\nreload_command = \"sudo \/etc\/init.d\/nagios3 reload\"<\/pre>\n<pre>; *** keep this section and the rest of the file commented out\r\n;[copy nagios.cfg]\r\n;type = local\r\n;source_file = \"\/tmp\/static_cfg\/nagios.cfg\"\r\n;target_file = \"\/etc\/nagios\/nagios.cfg\"\r\n;action = copy\r\n;reload_command = \"sudo \/etc\/rc.d\/init.d\/nagios reload\"<\/pre>\n<p>This process replaces the deploy_local.sh script, but we&#8217;ll need to allow the web user to issue the Nagios reload. To do that, we need to modify the <em>sudoers<\/em> file:<\/p>\n<pre>sudo visudo<\/pre>\n<p>Then add the following lines:<\/p>\n<pre># Allow www-data (apache) user to reload nagios\r\nwww-data ALL=NOPASSWD: \/etc\/init.d\/nagios3 reload<\/pre>\n<p>Save and quit.<\/p>\n<p>Finally, remove the entry in the root crontab entry that launched the old deploy script:<\/p>\n<pre>sudo crontab -e<\/pre>\n<p>And remove the line reading:<\/p>\n<pre>* * * * * \/var\/www\/nconf\/ADD-ONS\/deploy_local.sh<\/pre>\n<h2>Deployment Testing and Cleanup<\/h2>\n<p>Let&#8217;s make sure the new deployment procedure works. Back in the NConf GUI, click <em>Generate Nagios config<\/em>. You should hopefully see something like:<\/p>\n<pre>[INFO]  Starting generate_config script\r\n[INFO]  Generating global config files\r\n[INFO]  Generating config for Nagios-collector 'Default Nagios'\r\n[INFO]  Ended generate_config script<\/pre>\n<p>If the config files generate successfully, you&#8217;ll see a button aptly labeled <em>&#8216;Deploy&#8217;<\/em>.<\/p>\n<p>Click\u00a0<em>Deploy, <\/em>and with any luck you&#8217;ll be presented with three OK messages in NConf \u00a0and your Nagios Event Log should show a SIGHUP message.<\/p>\n<p>Relax, and enjoy some JQuerified NConf 1.3.0 goodness! Gold star!<\/p>\n<p>I did notice that the original deployment method left a bunch of old config tgz bundles, so if you&#8217;re feeling like cleaning those up, just remove the whole lot:<\/p>\n<pre>sudo rm \/var\/www\/nconf\/output\/NagiosConfig.tgz.*<\/pre>\n<p><strong>Update (6\/25\/12):<\/strong> You&#8217;ll want to remove the\u00a0<strong>extended_host_info.cfg<\/strong> and\u00a0<strong>extended_service_info.cfg<\/strong> files from your target config directory <em>(\/etc\/nagios3\/Default_collector\/)<\/em>, or you might get weird problems trying to deploy later on. I just found this out six months later.<\/p>\n<h2>Troubleshooting Notes<\/h2>\n<ul>\n<li>The biggest problems I had were just remembering to reference <em>nagios3<\/em> rather than <em>nagios<\/em> for paths and commands. \u00a0Make sure you reference the correct locations. This caused me all sorts of weird grief with the <em>sudoers<\/em> file, and I didn&#8217;t catch it until later.<\/li>\n<li>While NConf will run without the additional variables in <em>config\/nconf.php<\/em>, it&#8217;ll log warnings until you add them.<\/li>\n<li>I had to remove an extra file <em>(call_ajax.php)<\/em> before NConf would run. The file has been replaced with <em>call_file.php<\/em> which apparently fixes a security issue. At the time of this writing, removing this file wasn&#8217;t in the docs, but it complains until you nuke it.<\/li>\n<\/ul>\n<h2>Fresh Install of Nagios and NConf<\/h2>\n<p>From what I can tell, you can follow all the steps in my <a title=\"Nagios and NConf on Ubuntu 10.04 Lucid Lynx\" href=\"https:\/\/digitalcardboard.com\/blog\/2010\/08\/24\/nagios-and-nconf-on-ubuntu-10-04-lucid-lynx\/\" target=\"_blank\">old guide<\/a> for installing 1.3.0 up until you get to<em>\u00a0Configuring NConf to Deploy Nagios Configurations Automatically<\/em>. At that point, follow the <em>Migrating Deployment<\/em> instructions from this guide.<\/p>\n<p>Please leave a comment and let me know if you do a fresh install. I&#8217;d be curious to know how it works for you.<\/p>\n<h2>More Information<\/h2>\n<ul>\n<li><a href=\"http:\/\/www.nconf.org\/dokuwiki\/doku.php?id=nconf:help:documentation:start:installation\" target=\"_blank\">Installation Guide<\/a><\/li>\n<li><a href=\"http:\/\/www.nconf.org\/dokuwiki\/doku.php?id=nconf:help:documentation:start:update\" target=\"_blank\">Upgrade Guide<\/a><\/li>\n<li><a href=\"http:\/\/www.nconf.org\/dokuwiki\/doku.php?id=nconf:help:documentation:modules:deployment:main\" target=\"_blank\">Deployment<\/a><\/li>\n<\/ul>\n<p><em>\u00a0(edit 6\/25\/12 to add additional file cleanup instructions)<\/em><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Congrats to the NConf crew for reaching the 1.3.0 milestone! Two years in the making, but I&#8217;m excited to see the project continuing to move forward. It&#8217;s been over a year since I originally installed and configured Nagios and NConf 1.2.6 on my Lucid Lynx server. In the meantime, I&#8217;ve upgraded the hardware and moved [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8,29],"tags":[23,32,30,31,124,80,79,68],"class_list":["post-265","post","type-post","status-publish","format-standard","hentry","category-software","category-system-administration","tag-linux","tag-monitoring","tag-nagios","tag-nconf","tag-software","tag-sysadmins","tag-ubuntu","tag-upgrade"],"_links":{"self":[{"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/posts\/265","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/comments?post=265"}],"version-history":[{"count":5,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/posts\/265\/revisions"}],"predecessor-version":[{"id":323,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/posts\/265\/revisions\/323"}],"wp:attachment":[{"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/media?parent=265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/categories?post=265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalcardboard.com\/blog\/wp-json\/wp\/v2\/tags?post=265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}