Nagios and NConf on Ubuntu 10.04 Lucid Lynx

As of December 2011, NConf has released version 1.3.0 which changes the deployment methods for configs. Take a look at my NConf 1.3.0 upgrade guide!

Have you been wondering about how to get Nagios and NConf setup on your Ubuntu server?  Well, I took some notes the last time around, and here they are, for anyone that may find them useful.  Here we go!

(disclaimer: don’t screw up your system.)

Prerequisites

If you didn’t check the box to configure your box as a LAMP (Linux, Apache, MySQL, PHP) server when you first setup your box, do that first with:

sudo apt-get install apache2
sudo apt-get install mysql-server mysql-client
sudo apt-get install php5 libapache2-mod-php5

If you want phpMyAdmin (for web-based MySQL administration):

sudo apt-get install phpmyadmin

Installing Nagios

Install Nagios with

sudo apt-get install nagios3

It should install all the necessary dependencies. Follow the prompts to get it configured and test it out by browsing to http://<yourserver>/nagios3

If you would like to monitor Windows servers using NSClient++ (which I am doing), also install the NRPE plugin with

sudo apt-get install nagios-nrpe-plugin

I felt like I ought to backup the config files before I started messing with them, so I backed them up with

sudo cp -r /etc/nagios3 /etc/nagios3.backup

Installing NConf

NConf provides a web-based frontend for configuring Nagios.  There’s no package in the Ubuntu repositories for it, but you can download it pretty easily.  Version 1.2.6 was the latest as of the time of this writing, so make sure you’re getting the latest version.  (Note: it looks like the link below gets cut off, so here’s a link to the NConf download page where you can grab the latest source)

wget http://sourceforge.net/projects/nconf/files/nconf/1.2.6-0/nconf-1.2.6-0.tgz/download
Unpack it to your webroot:
sudo tar xzvf nconf-1.2.6-0.tgz -C /var/www
Change the owner of the folder and files you just extracted to the web user:
sudo chown -R www-data:www-data /var/www/nconf
Now you’ll need to create a MySQL database to hold the NConf configuration data.  Using phpMyAdmin (sudo apt-get install phpmyadmin if you don’t have it) do the following:
  • Privileges -> Add a new User
  • User name: nconf
  • Host: localhost
  • Password: (generate, and make a note of the generated password)
  • Create database with the same name and grant all privileges
  • Go
  • Privileges -> reload the privileges

Then browse to http://<yourserver>/nconf and follow the prompts to finish initial configuration of NConf.

When you get to the database configuration page, enter nconf for the username and the database name, and use the generated password you should have made a note of earlier. For most everything else, accept the defaults, but change the NAGIOS_BIN variable to /usr/sbin/nagios3 to reference the right location.

Finally, remove the folders and files referenced at the end of the installation process:

sudo rm -r /var/www/nconf/INSTALL
sudo rm /var/www/nconf/INSTALL.php
sudo rm -r /var/www/nconf/UPDATE
sudo rm /var/www/nconf/UPDATE.php

At this point, you should be able to login to NConf, although it won’t be doing anything of importance.

Configuring Nagios to use NConf

We’ll need to make some changes to one of the Nagios configuration files, so (using sudo) open up /etc/nagios3/nagios.cfg in your favorite editor and delete or comment out all the lines that begin with cfg_dir= or cfg_file= and add the following lines:

cfg_dir=/etc/nagios3/global
cfg_dir=/etc/nagios3/Default_collector

Back at the terminal, run the following command to create a folder for NConf to dump the configuration files it generates.

sudo mkdir /etc/nagios3/import

Configuring NConf to Deploy Nagios Configurations Automatically

Almost there. Using sudo, open up /var/www/nconf/ADD-ONS/deploy_local.sh and make the following changes to paths:

OUTPUT_DIR="/var/www/nconf/output/"
NAGIOS_DIR="/etc/nagios3/"
...
/etc/init.d/nagios3 reload

GM and Allison pointed out in the comments that they had to set the execute bit on this file:

chmod +x /var/www/nconf/ADD-ONS/deploy_local.sh

This script will deploy the generated configuration package and then reload the running instance of Nagios, but it’s easiest to use just installed in the root crontab.

sudo crontab -e

and adding the line

* * * * * /var/www/nconf/ADD-ONS/deploy_local.sh

Final Steps

After saving and closing the root crontab, log back into NConf and take a look around.  You’ll see some sample definitions and some predefined services for the localhost computer.  You may want to delete the check_local_mrtgtraf and check_local_procs services, as the first one doesn’t work without additional configuration and the second one is a sample definition, but you can make those changes at your leisure.

Once you’re ready, click Generate Nagios config, and if all goes well, you’ll see something like the following:

[ Initializing NConf perl-API (library version 0.2, written by A. Gargiulo) ]
[ Copyright (c) 2006-2009 Sunrise Communications AG, Zurich, Switzerland    ]

[INFO]  Starting generate_config script
[INFO]  Generating global config files
[INFO]  Generating config for Nagios-collector 'Default Nagios'
[INFO]  Ended generate_config script

Running syntax check:

	  Default_collector:	 Total Warnings: 0  Total Errors: 0
Changes updated successfully.

Now log back into Nagios and click on Service Detail.  Within a minute or two, you should see the hosts and services change to reference the configuration as generated from NConf.

If that works, then huzzah!

Start making your configuration changes in NConf and enjoy not having the manipulate those Nagios conf files by hand anymore!

Troubleshooting, Tips and Caveats

Try running the deploy_local.sh script by hand (with sudo) if it doesn’t appear that Nagios is getting the configurations from NConf. You may be able to glean some information from the output of that script.

New hosts not showing up in Nagios after being created in NConf? Make sure you’ve selected Default Nagios under “monitored by” when defining the host, or that host won’t get assigned properly.

This setup process effectively disables all the command definitions provided by the package install of Nagios, which are stored under /etc/nagios-plugins/config.  I looked through them and compared them to the ones provided by default with NConf, and I was fine with what NConf provided.  NConf provides a mechanism to import command definitions if you really find that you need them.

I have no idea how this setup will hold up under an upgrade of the Nagios package.  We’ll see when the time comes, and if I remember, I’ll update these notes.

If you have any trouble with the steps provided above, please comment and I’ll do what I can to assist.

More Information

Take a look at the following documentation from NConf:

This entry was posted in System Administration and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

64 Comments

  1. Jasson Phillips
    Posted November 1, 2010 at 12:48 pm | Permalink

    When I generate the config file for Nagios, I see no errors and everthing looks fine. However, I never see the changes in Nagios. Any suggestions?

    • jason
      Posted November 1, 2010 at 1:02 pm | Permalink

      Sounds like NConf may not be deploying the config properly to Nagios (if at all). Did you configure the deploy_local.sh script?

  2. Posted November 2, 2010 at 8:13 am | Permalink

    I pretty much have everything working.. except for ..

    when I add

    cfg_dir=/usr/local/nagios/global
    cfg_dir=/usr/local/nagios/Default_collector

    nagios borks and won’t startup..

    any ideas?

    • jason
      Posted November 2, 2010 at 8:25 am | Permalink

      It’s possible that it might be a permissions issue. Does /var/log/nagios3/nagios.log reveal anything of value when it fails to start?

  3. Posted November 2, 2010 at 8:24 am | Permalink

    Nevermind.. sorted it.. I had left some of the other directives in that file uncommented…

    thanks…

  4. Vaughn Koch
    Posted November 5, 2010 at 1:32 pm | Permalink

    Hey Jason, thanks for the post. Can I suggest a couple of additions?

    # Install mysql (I didn’t have this on a fresh Lucid box)
    sudo aptitude install mysql-server
    sudo aptitude install libapache2-mod-auth-mysql phpmyadmin

    It seems like you also have to comment out cfg_file in addition to cfg_dir in nagios.cfg. This blocked me from a proper config loading with the deploy script.

    Also, in the deploy script, might want to note that you need to be careful with slashes and the ’3′ for nagios3.. I missed a slash in the import which caused a few issues as well.

    Thanks again for the post!

    • jason
      Posted November 5, 2010 at 1:58 pm | Permalink

      Ah, I had installed the LAMP stuff when I setup the server, but good point. I’ll make a note of that.

    • Posted January 2, 2011 at 10:31 pm | Permalink

      Thanks for mentioning to comment out cfg_file, I spent the last two hours going through every file related to Nagios to get it to start/update properly. I came back here to re-read, and your comment got me up and running right away.

  5. Anthony
    Posted November 8, 2010 at 8:18 am | Permalink

    Not sure where I have gone wrong but on the /etc/init.d/nagios3 reload I get a failure

    ***> One or more problems was encountered while running the pre-flight check…

    Check your configuration file(s) to ensure that they contain valid
    directives and data defintions. If you are upgrading from a previous
    version of Nagios, you should be aware that some variables/definitions
    may have been removed or modified in this version. Make sure to read
    the HTML documentation regarding the config files, as well as the
    ‘Whats New’ section to find out what has changed.

    * errors in config!
    [fail]

    ANy help would me appriaciated, PS I had to create the global and Default_collector manually

    • Anthony
      Posted November 8, 2010 at 8:33 am | Permalink

      im also getting a /var/www/nconf/ADD-ONS/deploy_local.sh: Permission denied

      Ive eddited this using winscp so not if ive done somthing wrong there any help would be great

      Thanks

    • Posted November 8, 2010 at 8:43 am | Permalink

      Might be a permissions issue. Is anything being generated in the /etc/nagios3/global and Default_collector folders? They should be owned by www-data:www-data with 755 perms on both folders.

      Also, can you run the deploy_local.sh script by hand (using sudo)?

      • Anthony
        Posted November 9, 2010 at 1:45 am | Permalink

        Fantastic I had the permission correct on the folder ADD-ONS but checking deploy_local.sh that was set to 644 changed that and another file in the same folder to 755 and it worked

        Thanks for your help

  6. Posted November 23, 2010 at 4:04 am | Permalink

    Error accessing or executing Nagios / Icinga binary ‘usr/sbin/nagios3′.
    Cannot run the mandatory syntax check.

    This error I got at the end, after trying to add a host, hope someone can help me?

    • Posted November 23, 2010 at 8:38 am | Permalink

      Can you run the /usr/sbin/nagios3 binary manually from the terminal?

  7. Corando
    Posted November 25, 2010 at 8:37 am | Permalink

    Error accessing or executing Nagios / Icinga binary ‘etc/nagios3?.
    Cannot run the mandatory syntax check.
    I also got this error at the end.. Any suggestions?
    Regards

    • Posted November 25, 2010 at 12:00 pm | Permalink

      Double check the path to nagios. You should be able to execute it manually by running /usr/sbin/nagios3 from the terminal.

      If you need to edit the path, you can change it in the configs at /var/www/nconf/config/nconf.php

  8. Kyle
    Posted January 4, 2011 at 1:59 am | Permalink

    Awesome thanks!!

  9. Mark
    Posted January 11, 2011 at 3:03 pm | Permalink

    I’ve run thru twice, reverting back to a VM snapshot between times and I get the same error:
    Nagios Core 3.2.0
    Copyright (c) 2009 Nagios Core Development Team and Community Contributors
    Copyright (c) 1999-2009 Ethan Galstad
    Last Modified: 08-12-2009
    License: GPL

    Website: http://www.nagios.org
    Reading configuration data…
    Read main config file okay…
    Processing object config file ‘/var/www/nconf/temp/global/host_templates.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/timeperiods.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/contacts.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/service_templates.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/misccommands.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/contactgroups.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/checkcommands.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/hosts.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/hostgroups.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/extended_host_info.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/services.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/servicegroups.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/extended_service_info.cfg’…
    Error: Service description, host name, or check command is NULL
    Error: Could not register service (config file ‘/var/www/nconf/temp/Default_collector/services.cfg’, starting on line 58)
    Error processing object config files!

    ***> The name of the main configuration file looks suspicious…

    Make sure you are specifying the name of the MAIN configuration file on
    the command line and not the name of another configuration file. The
    main configuration file is typically ‘/usr/local/nagios/etc/nagios.cfg’

    ***> One or more problems was encountered while processing the config files…

    Check your configuration file(s) to ensure that they contain valid
    directives and data defintions. If you are upgrading from a previous
    version of Nagios, you should be aware that some variables/definitions
    may have been removed or modified in this version. Make sure to read
    the HTML documentation regarding the config files, as well as the
    ‘Whats New’ section to find out what has changed.

    Where is it getting services.cfg from and why is puking on line 58??

    • Posted January 11, 2011 at 3:34 pm | Permalink

      Looks like you’re deploying your configs to /var/www/nconf/temp/ rather than /etc/nagios3/ so it’s possible it could be a permissions issue.

      Also, check through your services definitions from within NConf. It’s possible you’ve got a faulty service being generated from NConf, so Nagios throws it back.

  10. Mark
    Posted January 12, 2011 at 12:25 pm | Permalink

    Figured it out earlier today, deleting the check_local_procs and check_mgttraf broke it. Skipped that step and it worked fine.

    • mehdi
      Posted August 1, 2012 at 6:56 am | Permalink

      mark please how did you fix the problem? i have the same

  11. mohenjox
    Posted April 8, 2011 at 7:18 pm | Permalink

    I have succesfully deploy nconf and nagios3. But nconf still can not automatically extract output to /etc/nagios3. I already give access to user www-data to /etc/nagios3. But nconf still cannot write the output. So i manually extract file NagiosConfig.tgz into dir /etc/nagios3, restarting nagios and all item now appear in map

    • Posted April 11, 2011 at 8:36 am | Permalink

      Did you create the import folder in /etc/nagios3/ ?

  12. Kishore
    Posted April 22, 2011 at 2:18 pm | Permalink

    I got the nagios3 and nconf to work but when i try to do a deploy files dont get deploy automatically, it doesn’t extract the files in import

    I tried to manually extract the files but i get this error.
    Processing object config file ‘/etc/nagios3/global/checkcommands.cfg’…
    Processing object config file ‘/etc/nagios3/global/timeperiods.cfg’…
    Processing object config file ‘/etc/nagios3/global/host_templates.cfg’…
    Processing object config file ‘/etc/nagios3/global/commands.cfg’…
    Warning: Duplicate definition found for command ‘process-host-perfdata’ (config file ‘/etc/nagios3/global/commands.cfg’, starting on line 16)
    Error: Could not add object property in file ‘/etc/nagios3/global/commands.cfg’ on line 17.
    Error processing object config files!

    ***> One or more problems was encountered while processing the config files…

    Check your configuration file(s) to ensure that they contain valid
    directives and data defintions. If you are upgrading from a previous
    version of Nagios, you should be aware that some variables/definitions
    may have been removed or modified in this version. Make sure to read
    the HTML documentation regarding the config files, as well as the
    ‘Whats New’ section to find out what has changed.

    * errors in config!

    This was the content of the File “global/commands.cfg”

    cat global/commands.cfg
    #define command {
    # command_name notify-host-by-email
    # command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n” | /bin/mail -s “** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **” $CONTACTEMAIL$
    #}

    #define command {
    # command_name notify-service-by-email
    # command_line /usr/bin/printf “%b” “***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$” | /bin/mail -s “** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **” $CONTACTEMAIL$
    #}

    define command {
    command_name check-host-alive
    command_line $USER1$/check_ping -H $HOSTADDRESS$ -w 3000.0,80% -c 5000.0,100% -p 5
    }

    define command {
    command_name process-host-perfdata
    command_line /usr/bin/printf “%b” “$LASTHOSTCHECK$\t$HOSTNAME$\t$HOSTSTATE$\t$HOSTATTEMPT$\t$HOSTSTATETYPE$\t$HOSTEXECUTIONTIME$\t$HOSTOUTPUT$\t$HOSTPERFDATA$\n” >> /var/nagios/host-perfdata.out
    }

    define command {
    command_name process-service-perfdata
    command_line /usr/bin/printf “%b” “$LASTSERVICECHECK$\t$HOSTNAME$\t$SERVICEDESC$\t$SERVICESTATE$\t$SERVICEATTEMPT$\t$SERVICESTATETYPE$\t$SERVICEEXECUTIONTIME$\t$SERVICELATENCY$\t$SERVICEOUTPUT$\t$SERVICEPERFDATA$\n” >> /var/nagios/service-perfdata.out
    }

    define command {
    command_name service_is_stale
    command_line /usr/lib/nagios/plugins/eventhandlers/stale_service.sh
    }

    Can anyone tell me what i am doing wrong.. here ..

    • Posted April 22, 2011 at 3:18 pm | Permalink

      If you’re getting duplicate definition errors, make sure you’ve commented out or removed all the cfg_dir= lines in the nagios.cfg file. It seems like Nagios is still trying to reference one of the standard config files.

    • Kishore
      Posted April 22, 2011 at 5:52 pm | Permalink

      Hey This is fixed there were Duplicate entries in 2 different files..

  13. GM
    Posted April 26, 2011 at 8:50 am | Permalink

    I’m running ubuntu server natty, nagios3 , nconf.
    Just thought I would add what I had to do to for my install to work.
    More than likely its because I had not read the above properly but i’ll post anyway!
    cfg_dir=/etc/nagios3/global
    cfg_dir=/etc/nagios3/Default_collector
    I had to create these folders.

    I also had to chmod +x /var/www/nconf/ADD-ONS/deploy_local.sh
    Then I ran var/www/nconf/ADD-ONS/deploy_local.sh by using sudo ./deploy_local.sh from the directory

    Then I ran sudo /etc/init.d/nagios3 restart

    Thanks to this guide it pointed me in the right direction and I thank you!

    • demonskier
      Posted August 15, 2011 at 3:04 pm | Permalink

      do you know if there is a way to incorporate this into NConf “Generate Nagios config” action

      • demonskier
        Posted August 15, 2011 at 3:05 pm | Permalink

        edit: The method in the above post is how I have to do it, however I do not know why and wish there was a fix I could use

        • Posted August 15, 2011 at 3:38 pm | Permalink

          Take a look at the section Configuring NConf to Deploy Nagios Configurations Automatically. Once NConf generates the deploy file, the cron job should pick it up and put it in the right place, if it all works.

  14. lesley
    Posted June 6, 2011 at 3:07 pm | Permalink

    Se alguem tiver com esse erro:
    Error accessing or executing Nagios / Icinga binary ‘/var/www/html/nconf/bin/nagios’. Cannot run the mandatory syntax check.
    No meu caso o NConf não estava encontrando os binarios do nagios.
    rode o comando:
    cp /usr/local/nagios/bin/* /var/www/html/nconf/bin/nagios

    flow

  15. Posted August 11, 2011 at 4:47 am | Permalink

    When I add any host in Nconf, m not able to view it in Nagios frontend.

    • Posted August 11, 2011 at 8:00 am | Permalink

      Can you verify that Nconf is generating a config file and that Nagios is picking it up?

  16. Glip
    Posted October 31, 2011 at 6:46 am | Permalink

    Thank you a lot!! It works! ) But i had to correct configs slightly ^)

  17. Posted December 5, 2011 at 10:22 am | Permalink

    Followed your guide exactly but what I add via NConf is not being updated to Nagios. I checked the directories and everything, files are being generated. Perhaps I missed something with removing the cfg lines in nagios.cfg?

  18. Posted December 5, 2011 at 10:27 am | Permalink

    Disregard the previous comment, I commented out the logfile in nagios.cfg…

    Gogo retard move!

    • Posted December 5, 2011 at 11:14 am | Permalink

      Glad that it’s working for you!

  19. Posted December 10, 2011 at 2:36 pm | Permalink

    Thanks for a nice tutorial, however i believe a few steps are missing..I followed all the steps by nagios didnt started at the end with error

    ——
    ***> One or more problems was encountered while running the pre-flight check…

    Check your configuration file(s) to ensure that they contain valid
    directives and data defintions. If you are upgrading from a previous
    version of Nagios, you should be aware that some variables/definitions
    may have been removed or modified in this version. Make sure to read
    the HTML documentation regarding the config files, as well as the
    ‘Whats New’ section to find out what has changed.

    errors in config! … failed!
    failed!
    ——————

    Then I figured that “generate nagios config” need to run from nconf, which generate a .tgz file in output directory which give a gloabl and default_collector folder when we extract it, and those 2 need to be copied in /etc/nagios3
    I did and everything went well…

    I thought to mention my experience and my findings..
    Thanks for a nice tutorial again, all credit goes to you my friend :-)

  20. Nic Bathgate
    Posted February 7, 2012 at 9:15 pm | Permalink

    Hi,

    I’m finding that the plugins in /usr/lib/nagios/plugins conflict with a heap of the commands in misccommands.cfg and checkcommands.cfg.

    Has anyone else had this, or know how to fix it?

    • Posted February 8, 2012 at 8:27 am | Permalink

      Essentially, I just had to nuke all the existing command definitions provided by the Ubuntu package and just go with what NConf generates. Sounds like you might still be calling out the old configs.

  21. Posted February 21, 2012 at 4:59 am | Permalink

    This guide was the only one that I got working for my VPS.
    1000 internet points to you!!

    I can now monitor my sites and configure Nagios much easier, well done and thank you!

  22. Allison
    Posted March 1, 2012 at 8:14 am | Permalink

    I just wanted to add that I, too, had some issues getting NConf to work. I started with a working Nagios installation (with hosts, services, and commands defined, including several commands for NRPE_NT), but when I tried to throw NConf into the mix, I couldn’t get the NConf generated hosts to show up on the Nagios frontend. I found that performing the following command solved the issue:

    # chmod +x /var/www/nconf/ADD-ONS/deploy_local.sh
    # sudo /var/www/nconf/ADD-ONS/deploy_local.sh

    This probably should have been obvious, but it might be a good idea to add it to the main post.

    Thanks for this guide, it was very helpful!

    • Posted March 1, 2012 at 8:29 am | Permalink

      Thanks for the info Allison; I’ve added it to the guide! The NConf folks have up and released 1.3.0, so if you feel like adding that to the mix, I’ve got another guide documenting my upgrade process. The whole deploy_local.sh thing has been replaced in the latest version.

  23. Starter
    Posted March 20, 2012 at 8:25 pm | Permalink

    Thanks but i don’t understand how i monitor remote linux host. Which daemon i use and where i add my add-on in nagios server. When i install nconf then can i configure nagios from cmd

    • Eric
      Posted April 12, 2012 at 8:11 am | Permalink

      The easiest (an for me, the only known) way, is to install the nagios-plugin with NRPE-AddOn and run NRPE as a deamon on your remote system. Usually you should find both in the repos of your prefered distribution.

  24. Eric
    Posted April 12, 2012 at 8:00 am | Permalink

    First of all: Thank you very much for this guide!

    Second and just for the record – I’ve got some trouble with the config-files unter “global” and “default_collector”. After running the deploy_local.sh these folders weren’t created nor filled with the files after I created them manually. Finally I unpacked the files from /var/www/nconf/output/NagiosConfig.tgz.
    Changes at the paths in the “deployment.ini” doesn’t seem to make any difference.

    • Posted April 12, 2012 at 9:26 am | Permalink

      You might consider upgrading to NConf 1.3.0, which has a different deployment procedure.

      • Eric
        Posted April 12, 2012 at 12:34 pm | Permalink

        Hi Jason,

        thanks for the quick reply. I’ve used the latest NConf-package from nconf.org. At the moment I’m playing around with the deployment.ini-file. It seems that the generated config-files are not copied/extracted to the /tmp/-folder but I can’t locate the exact problem. I’ll change the paths to another folder and check the functionality of the script again.

        • Posted April 12, 2012 at 12:45 pm | Permalink
          • Eric
            Posted April 12, 2012 at 1:09 pm | Permalink

            Thank you again. I already found some sources of my problems (like the ‘;’ for uncommented lines). Now I deal with the following messages from NConf:

            local
            expand extract config OK

            PHP mkdir: OK

            Create target directory (/var/www/nconf/temp/deploy)

            PHP copy: OK

            temporary copy(/var/www/nconf/output/NagiosConfig.tgz, /var/www/nconf/temp/deploy/NagiosConfig.tgz)

            system call OK

            gunzip -f /var/www/nconf/temp/deploy/NagiosConfig.tgz

            system call OK

            tar -xf /var/www/nconf/temp/deploy/NagiosConfig.tar -C /var/www/nconf/temp/deploy/

            PHP unlink: OK

            remove temporary file(/var/www/nconf/temp/deploy/NagiosConfig.tar)

            expand copy collector config FAILED

            PHP copy: FAILED

            recursive copy(/var/www/nconf/temp/deploy/Default_collector/, /etc/nagios3/Default_collector/)

            expand copy global config FAILED

            PHP copy: FAILED

            recursive copy(/var/www/nconf/temp/deploy/global/, /etc/nagios3/global/)
            Seems to be a rights-management problem.

          • Eric
            Posted April 12, 2012 at 1:51 pm | Permalink

            As update: After I allowed ‘write’ by ‘others’ via chmod there are no more problems. I’ll now search if this solution provides any security vulnerabilities. If not, my problem is fixed…

          • Posted April 12, 2012 at 2:17 pm | Permalink

            Glad to hear you were able to figure it out! The permission issue is why I ended up putting the .tgz file and the other deploy stuff in /tmp.

  25. Horkertusk
    Posted April 19, 2012 at 2:06 am | Permalink

    Hi, I may be being incredibly dumb here but I’ve had Nagios 3.2.3 and NConf 1.3.0 running fine for about a month until this week when I noticed that none of my changes to anything on nconf were being pushed through to nagios. It doesn’t give me any errors when I create a new host, generate a config or at any other stage in the process. deploy_local.sh seems to running fine and seems to create all the necessary files, I just can’t see where it’s going wrong. Can anyone help?

    • Horkertusk
      Posted April 19, 2012 at 2:38 am | Permalink

      Ok, so actually I’ve found what the problem is, I’m just not sure how to fix it. It seems that nconf is generating hosts and advanced services into a “collector” folder instead of “Default_collector”. Does anyone know where I can change this? I’m guessing I’ve somehow changed it by accident but I can’t for the life of me think where I would have changed it?

      Many thanks in advance

      • Posted April 19, 2012 at 7:45 am | Permalink

        NConf 1.3.0 has a different deployment routine (so no more deploy_local.sh). I’ve only upgraded from v1.2.6, so it’s entirely possible that the default configuration for a new install uses collector instead of Default_collector. You might start by looking through my notes on upgrading to NConf 1.3.0 and see if that helps.

  26. Goldenboy
    Posted July 27, 2012 at 4:03 am | Permalink

    Hi, nice guide.
    I have followed every step of this guide, but now i am stop at this point:

    Generate config log:

    [INFO] Starting generate_config script
    [INFO] Generating global config files
    [INFO] Generating config for Nagios-collector ‘Default Nagios’
    [INFO] Ended generate_config script

    Running syntax check:
    Default_collectorError generating config

    Nagios Core 3.4.1
    Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
    Copyright (c) 1999-2009 Ethan Galstad
    Last Modified: 05-11-2012
    License: GPL

    Website: http://www.nagios.org
    Reading configuration data…
    Read main config file okay…
    Processing object config file ‘/var/www/nconf/temp/global/timeperiods.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/contacts.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/misccommands.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/checkcommands.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/host_templates.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/service_templates.cfg’…
    Processing object config file ‘/var/www/nconf/temp/global/contactgroups.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/service_dependencies.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/host_dependencies.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/advanced_services.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/services.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/servicegroups.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/hosts.cfg’…
    Processing object config file ‘/var/www/nconf/temp/Default_collector/hostgroups.cfg’…
    Processing object config directory ‘/var/www/nconf/static_cfg’…
    Processing object config directory ‘/usr/local/nagios/etc’…
    Processing object config file ‘/usr/local/nagios/etc/cgi.cfg’…
    Error: Unexpected token or statement in file ‘/usr/local/nagios/etc/cgi.cfg’ on line 15.
    Error processing object config files!

    What have i change to work NConf
    ty in advance for a response

    • Posted July 27, 2012 at 7:32 am | Permalink

      So a couple of things: (1) I’m running Nagios 3.2.3 out of the 11.04 repos, so I can’t really speak to anything at the 3.4.x level. But (2) you might take a look inside your /usr/local/nagios/etc/cgi.cfg file to see if it’s intact, and if that erroring line is correct. In my cgi.cfg, line 13 is the main_config_file parameter.

  27. nico
    Posted August 22, 2012 at 6:05 am | Permalink

    hello,
    i have a duplicate configs on all my hosts, let me explain:
    in the column “Status Information” of nagios, all my hosts import the same configuration of my Nagios server:

    Status Information

    DISK OK – free space: / 31590 MB (92% inode = 94%):
    OK – load average: 0.25, 0.37, 0.42
    PROCS OK: 0 processes with STATE = X, Z
    PING OK – Packets Lost = 0%, RTA = 0.40 ms

    thank you for helping me if you have an answer.

    • Posted August 22, 2012 at 8:25 am | Permalink

      It sounds like it may be more a Nagios configuration issue than an NConf one, but unfortunately I don’t have a good answer for you. Make sure you’re running the stable you have access too. The Nagios Support Forum might be able to offer some better advice.

      • nico
        Posted August 23, 2012 at 1:09 am | Permalink

        ok, i hope to find an answer in the forum.
        thank you.

  28. Emmett Ward
    Posted August 28, 2012 at 10:29 am | Permalink

    Hey,
    This is a great tutorial for installing nagios and nconf. It is the only one that made any sense to me (and wasn’t filled with mis-types).

    So here is my problem, everything goes well with “generate nagios config. But when i click “deploy” I get this:

    local
    expand extract config OK

    expand copy collector config OK

    PHP copy: OK

    recursive copy(/tmp/Default_collector/, /etc/nagios3/Default_collector/)

    expand copy global config FAILED

    PHP copy: OK

    recursive copy(/tmp/global/, /etc/nagios3/global/)

    system call FAILED

    sudo /etc/init.d/nagios3 reload

    * Reloading nagios3 monitoring daemon configuration files nagios3

    Nagios Core 3.2.0
    Copyright (c) 2009 Nagios Core Development Team and Community Contributors
    Copyright (c) 1999-2009 Ethan Galstad
    Last Modified: 08-12-2009
    License: GPL

    Website: http://www.nagios.org
    Reading configuration data…
    Read main config file okay…
    Processing object config file ‘/etc/nagios3/Default_collector’…
    Error: Cannot open config file ‘/etc/nagios3/Default_collector’ for reading: No such device
    Error processing object config files!

    ***> One or more problems was encountered while processing the config files…

    Check your configuration file(s) to ensure that they contain valid
    directives and data defintions. If you are upgrading from a previous
    version of Nagios, you should be aware that some variables/definitions
    may have been removed or modified in this version. Make sure to read
    the HTML documentation regarding the config files, as well as the
    ‘Whats New’ section to find out what has changed.

    * errors in config!
    …fail!

    The files are being copied to Default_collector, but the reload command is not being executed. Any ideas??

    Thanks,

    Emmett

    • Posted August 28, 2012 at 11:15 am | Permalink

      Deploying is different in NConf 1.3.0. Take a look through my 1.3.0 upgrade guide and see if that gives you any more guidance.

    • joe
      Posted February 28, 2013 at 1:12 pm | Permalink

      Probably check permissions on your /etc/nagios3 directory

      • joe
        Posted February 28, 2013 at 1:14 pm | Permalink

        specifically, web server (nconf) user (www-data) needs to write to /etc/nagios3/conf.d to drop config files there
        drwsrwsr-x 4 root www-data 43 2013-01-16 09:06 conf.d

3 Trackbacks

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>