Giter Club home page Giter Club logo

nconf's Introduction

NConf README
============

NConf homepage:
http://www.nconf.org

Start guide:
http://www.nconf.org/dokuwiki/doku.php?id=nconf:help:documentation:start:main

Complete documentation:
http://www.nconf.org/dokuwiki/doku.php?id=nconf:help:documentation:detail:main

Table of contents
-----------------
A. Requirements
B. Manual installation
C. Manual update


A. Requirements
---------------

NConf system requirements:

    * Apache webserver
    * PHP 5 or higher, php-mysql, php-ldap (only if using LDAP auth)
    * MySQL 5.0.2 or higher (with InnoDB)
    * Perl 5.6 or higher, perl-DBI, perl-DBD-MySQL
    * Nagios 3.x or Icinga 0.8x (binary necessary for testing generated config)


php.ini settings:

    * short_open_tag = On
    * register_globals = Off
    * magic_quotes_gpc = Off 


Compatibility:
NConf has been tested on Red Hat, Fedora and CentOS Linux.
It has not been tested on Windows or any UNIX, or with SELinux.


Security considerations:
NConf is intended to be deployed within a private network or intranet. As such, development focus is clearly not that of a secure Internet application. Although it can be run anywhere, we do not advise users to publish NConf as a public site. 


B. Manual installation
----------------------

1. Download and unpack
Download and unpack the NConf archive to your webserver's document root folder. 


2. Set permissions
Make sure the following directories are writable for your webserver user: 

   ./config
   ./output
   ./static_cfg
   ./temp


3. Create the database
Create a new MySQL database for NConf, create a user to access the database, grant the appropriate privileges (make sure InnoDB for MySQL is set up properly prior to creating the database). 

On the commandline, you would proceed like this: 

   $> mysql -u root -p
   Enter password:
   mysql> CREATE DATABASE DBNAME;
   mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON `DBNAME`.* TO 'DB_USER'@'localhost' IDENTIFIED BY 'DB_PASS';

Please refer to the MySQL manual on how to set up InnoDB (the steps might vary depending on your OS distribution). 


4. Create the database structure

$> mysql -u DBUSER -p DBNAME < INSTALL/create_database.sql


5. Configure NConf
Copy the contents of ./config.orig to ./config. Make sure you also copy the hidden files. 

Edit ./config/mysql.php, set at least the following values: 

   DBHOST 
   DBNAME 
   DBUSER 
   DBPASS

Edit ./config/nconf.php, set at least the following values: 

   NCONFDIR 
   NAGIOS_BIN


6. Clean up
Remove the INSTALL and UPDATE folders, as well as the INSTALL.php and UPDATE.php scripts. 


7. Get OS logo icons (optional, but nice)
If you like, download the OS logo icons and unpack them to ./img/logos/base/ 

The icons can be downloaded here:
http://www.monitoringexchange.org/p/47

8. Authentication
If you need authentication, configure ./config/authentication.php appropriately.


C. Manual update
----------------

1. Backup
Make a backup copy of your whole 'nconf/' folder and create a dump of your 'nconf' database. 
The update process will not overwrite your configuration, but if you have made changes to any other files, these changes will be lost! This is also true for icons that you might have installed manually ('img/logos/base/'). 

    Example: 

    cp -rp nconf/ nconf.BAK 
    mysqldump -u DBUSER -p DBNAME > nconf-dbdump.sql


2. Download and unpack
Download and unpack the NConf archive to a temporary location on your webserver. 

    Example: 

    tar -zxf nconf-VERSION.tgz -C /tmp/


3. Update existing files
Copy the unpacked files to the 'nconf/' folder and overwrite any existing files of your current NConf installation. 

    Example: 

    /bin/cp -rv /tmp/nconf/* /path/to/nconf/  (specify the full path to the 'cp' binary!)

This step cannot be undone! Make sure you have made a backup of your 'nconf/' folder. 


4. Check permissions
Make sure the following directories are still writable for your webserver user:

   ./config 
   ./output 
   ./static_cfg
   ./temp


5. Update the database
The 'UPDATE/' folder contains a subfolder for each previous release of NConf. The folders are named like this: x.x.x_to_y.y.y 

Make sure you know your current version of NConf. Next, chose the appropriate folder and look for a script named update_database_x.x.x_to_y.y.y.sql. 

Update the database like this: 

    $> mysql -u DBUSER -p DBNAME < UPDATE/x.x.x_to_y.y.y/update_database_x.x.x_to_y.y.y.sql

If you are updating from an older version of NConf, make sure you apply all available updates for all versions between your version and the latest version of NConf. Also, make sure you apply the updates in the right order! 

Important: make sure you don't skip any updates, and that you apply ALL of them in the right order. Failure to do so may result in data corruption and instability of NConf! 


6. Additional tasks
Check the version-specific 'README' file within the current subfolder for update-related instructions. If you have applied more than one update, make sure you study all README files in all subfolders. These files contain important instructions about necessary config changes etc. 

The release notes for the current release can also be found here:
http://www.nconf.org/dokuwiki/doku.php?id=nconf:download:releasenotes


7. Restore icons (optional)
If you were using additional icons prior to the update, you will have to copy these back from your backup folder. 


8. Clean up
Finally, remove the following files and directories:

   * INSTALL
   * INSTALL.php
   * UPDATE
   * UPDATE.php 

The update should now be complete.

Refresh browser cache:

If NConf does not look or feel right after the update, push CTRL-F5.
Your browser might have to reload some cached CSS & JavaScript files.  

nconf's People

Contributors

cyclodex avatar gargiulo avatar jvogt-swp avatar tontonitch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nconf's Issues

Double Quotes in Queries

For whatever reason, running nconf on a Percona MySQL cluster doesn't work because of the double quotes in SQL queries (vs single quotes).

I fixed this with a simple change to include/functions.php

In the db_handler function, change...

$query = trim($query);

to...

$query = str_replace('"', "'", trim($query));

erronous sql query due to wrongly set max_length

Hi,

in modify_attr_write2db.php you set a default value for max_length like this:

if(isset($_POST['max_length'])){
    $max_length = $_POST['max_length'];
}else{
    $max_length = "";
}

Updating e.g. the action_url attribute will produce a sql statement starting with

UPDATE ConfigAttrs SET attr_name = 'action_url', friendly_name = 'action URL', description = 'PNP URL (if installed)', max_length = '', poss_values = ...

where max_length is an empty string. However, in the database max_length is of type int(11) and the query fails (at least on mariaDB).
IMHO is is better to default max_length to 0 instead of an empty string (at least for attributes of type "select").

Ability to define dependencies to/from advanced services

It is currently only possible to define dependencies between Services in the GUI. It would be useful to be able to declare dependencies between,

  1. Advanced Services and Advanced Services
  2. Services and Advances Services

My current set up consists of hosts mainly defined by Advanced Services with only one or two Services per host. This means my options for declaring inter-service dependencies are very limited.

Services assigned to a hostgroup containing an empty hostgroup are not checked

If there is a hostgroup (HG1) to which an advanced service is assigned (AS1) which has another hostgroup assigned to it (HG2), and the HG2 hostgroup is empty on collector2, however HG1 has members (directly) on collector2 then the advanced service's relationship to HG1 is omitted from the configuration for that collector. This means that AS1 isn't checked for the members of HG1 on collector2.

We think this is due to this loop: https://github.com/nconf/nconf/blob/develop/bin/lib/NConf/DB/Read.pm#L967 as the check of the hostgroup_members having members will mistakenly undef $attr->[1] for a hostgroup containing an empty hostgroup.

Deployment: Reloading nagios configuration (via systemctl): [FAILED] on CENTOS 7.2 x64/Nagios 4.2/NConf 1.3

Hi,
i have this output during deployment:
"system call FAILED
/usr/bin/sudo -u nagios /etc/init.d/nagios reload
Reloading nagios configuration (via systemctl): [FAILED]"

My conf:
[visudo]

Defaults requiretty

apache ALL = (nagios) NOPASSWD: /etc/init.d/nagios reload

[deployment.ini]
reload_command = "/usr/bin/sudo -u nagios /etc/init.d/nagios reload"

[shell output of the reload comamnd]
$ /usr/bin/sudo -u nagios /etc/init.d/nagios reload
Reloading nagios configuration (via systemctl): ==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: nagios
==== AUTHENTICATION COMPLETE ===
[ OK ]

Did i miss something ?
Thanks
Laurent

"item_id" HAVING CLAUSE issue caused by ONLY_FULL_GROUP_BY default setting in MySQL 5.1.73

Hello NConf team!

I am setting up a new VM having all of the following: NConf v. 1.3.0 / Icinga 1.11.5 / MySQL 5.1.73 / CentOS 6.5

The default installation and configuration with sample data gives the following error when generating the Nagios config:

DBD::mysql::st execute failed: non-grouping field 'item_id' is used in HAVING clause at /var/www/html/nconf/bin/lib/NConf/DB/Read.pm line 1056.

Which is actually triggered by the following SQL query:

SELECT id_item AS item_id FROM ConfigItems,ConfigClasses
WHERE id_class=fk_id_class
AND config_class = 'host'
HAVING (SELECT fk_item_linked2 FROM ConfigItems,ItemLinks,ConfigClasses
WHERE fk_item_linked2=id_item
AND id_class=fk_id_class
AND config_class = 'nagios-collector'
AND fk_id_item=item_id) = 1

The error is actually caused by "ONLY_FULL_GROUP_BY" sql_mode global value which is seems to be currently set by default on this mysql release.

To reproduce this problem, do these steps on your own mysql prompt:

  • Take note of your current sql_mode variable value by doing: SELECT @@sql_mode;
  • Then do SET GLOBAL sql_mode = 'ONLY_FULL_GROUP_BY'; and test the export. You should now see the HAVING BY error message.
  • Set back you variable by doing: SET GLOBAL sql_mode = ''; and retest nconf export, all should be fine now.

The first symptom that appears to users when this issue is being experienced is
the following error message, which is very misleading if they don't know how to enable
debug and find their way around in nconf:

Icinga 1.11.5
Copyright (c) 2009-2014 Icinga Development Team (http://www.icinga.org)
Copyright (c) 2009-2013 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 06-20-2014
License: GPL

Reading configuration data...
Error: Cannot open main configuration file '/var/www/html/nconf/temp/test/Default_collector.cfg' for reading!
Error processing main config file!

TAGS:
nconf
error
Cannot open main configuration file
Default_collector.cfg
HAVING CLAUSE
item_id
id_item

mysql 8

The script does not work on mysql 8 out of the box. The grouping name as become a reserved word on mysql.

After install run the following commands

Mysql:
ALTER TABLE ConfigClasses CHANGE grouping groupingdata VARCHAR(30) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL;

On bash inside the nconf dir:

find . -name '*.php' -exec sed -i -e 's/grouping/groupingdata/g' {} \

That worked for me. Thanks.

Perl hash Can't use a hash as a reference at /var/www/html/devel_nconf/bin/lib/NConf/ExportNagios.pm line 1295.*

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

Can't use a hash as a reference at /var/www/html/devel_nconf/bin/lib/NConf/ExportNagios.pm line 1295.
Compilation failed in require at /var/www/html/devel_nconf/bin/generate_config.pl line 51.
BEGIN failed--compilation aborted at /var/www/html/devel_nconf/bin/generate_config.pl line 51.
tar: global: Cannot stat: No such file or directory
tar: Default_collector: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors

Check command dependencies must use also advanced services

When building service dependencies based on check command default_service_dependency value, nconf must look for services defined as advanced services as well.

Because advanced services are very useful to check for basic host services like SNMP, SSH or HTTP (which don't need service-dependent arguments), and a large number of high level checks depend on these basic interfaces, it's very useful to configure dependencies on it. However, when nconf builds service dependencies, only looks for services on the same host (ignoring advanced services)

deployment.ini only runs local extract, ignores the other actions

Due to a bug in the include/modules/deployment/class.deployment.php in the function history you cannot run more than one type/action. The bug is the $this->name is not always defined, so it may crash on some steps.
Original function:

  // update history log
  final public function history($message, $status) {
    if($status === TRUE)
    {
        history_add('module', 'deploy '.$this->name, $message.' (OK)');
    }
    else
    {
        history_add('module', 'deploy '.$this->name, $message.' (FAILED)');
    }
}

Fixed solution:

// update history log
final public function history($message, $status) {
    if (empty($this) || empty($this->name))
    {
            $name ="";
    }
    else
    {
            $name=$this->name;
    }

    if($status === TRUE)
    {
        history_add('module', 'deploy '.$name, $message.' (OK)');
    }
    else
    {
        history_add('module', 'deploy '.$name, $message.' (FAILED)');
    }
}

hostgroups for services not supported?

Hi,

I'm currently trying to import a nagios configuration which users services with only hostgroup_names (no host at all) and nconf is not able to import it. Are you going to implement this feature?

Best,
Andreas

set mysql charset=utf is not woring in generate_config.php ?

when i set database charset to utf8, generate_config.php still can not create the correct config file. It write chinese word to '?' in config file . Can you give me favor ?

#main.php function.php
#-------------------------------------------------------------
$dbh = mysql_connect(DBHOST,DBUSER,DBPASS);
mysql_select_db(DBNAME);
mysql_query('set names utf8');
#---------------------------------------------------------------

Chaining Hostgroups with Advanced Services does not work

When creating an advanced services linked to a hostgroup which itself does not have any direct members does not work. The setup is as follows:

Advanced Service (Antivirus) <- Hostgroup (Windows) <- Hostgroups (Windows 2K, Windows 2K3, ... ) <- Members (Server1, Server2)

During config file creation Hostgroup Windows is detected as not present on collector and removed.

PHP-MySQL support FAILED on Raspbian Stretch

I am trying to install nconf on Raspbian Stretch. I installed all pre-requisties but I am still getting PHP-MySQL support. Any one can help in this regard?

PHP 7.0.33-0+deb9u3 (cli) (built: Mar 8 2019 10:01:24) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33-0+deb9u3, Copyright (c) 1999-2017, by Zend Technologies

Server version: Apache/2.4.25 (Raspbian)
Server built: 2018-11-03T18:46:19

sudo apt-get install php-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-mysql is already the newest version (1:7.0+49).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Server version: 10.1.37-MariaDB-0+deb9u1 Raspbian 9.0

Will there be a new release?

Hi guys,

at first i want to say that I really like nconf. Good Work.

But the last Release 1.3 is more then 2 years ago. Will there be a new one or is something like that planed?

Regards

Eventhandler for service: no script selection

When editing a service, I can set "event-handler enabled". However I cannot find an option to select which script should be used to handle the event. So where can I select the script to execute?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.