Deploy only to hosts with changed config

Request new features for NConf

Deploy only to hosts with changed config

Postby robertkoeppl » Fri May 25, 2012 09:37

Is there a way to deploy only to those hosts where a configuration change has happened? If not is there a plan to implement that feature? This would come in quite handy in an environment with many collectors.
robertkoeppl
NConf rookie
NConf rookie
 
Posts: 19
Joined: Mon Mar 05, 2012 11:01
Location: Leoben Austria

Re: Deploy only to hosts with changed config

Postby scrat » Sat May 26, 2012 18:48

Hi,

I wrote an own deployment script for our company where you can choose from a list where to deploy the configuration.
If you want I can share this script...


Regards,
René
User avatar
scrat
NConf enthusiast
NConf enthusiast
 
Posts: 101
Joined: Mon Aug 23, 2010 16:28
Location: Vienna, Austria

Re: Deploy only to hosts with changed config

Postby robertkoeppl » Tue May 29, 2012 08:09

Hi Rene!
This would be very helpful indeed. Could you either attach it to this thread or mail to robert.koeppl@knapp.com please.
Thanks a lot in advance
robertkoeppl
NConf rookie
NConf rookie
 
Posts: 19
Joined: Mon Mar 05, 2012 11:01
Location: Leoben Austria

Re: Deploy only to hosts with changed config

Postby scrat » Mon Jun 04, 2012 10:56

Hi,

Sorry for my late response.
Find attached my deploy-script.
It's really dirty PHP code as I'm not a (PHP) programmer...

Here's a short description on how to use this script:

1. Allow config deployment
Code: Select all
# vi config/nconf.php

define('ALLOW_DEPLOYMENT', 1);


2. Copy deploy_config.php in your NConf root directory

3. Hack NConf to use this script instead of the internal deployment routine
When updating NConf this will be overwritten!
Code: Select all
# vi include/ajax/exec_generate_config.php

// if ($deployment_info){
// $content = 'The generated configuration has been written to the "nconf/output/" directory.<br>
// To set up more sophisticated deployment functionality, please edit your "config/deployment.ini" file accordingly.<br>
// For a complete list of available deployment options, refer to the online documentation on
// <a href="http://www.nconf.org" target="_blank">www.nconf.org</a>.';
// echo NConf_HTML::limit_space(
// NConf_HTML::show_highlight('Note', $content)
// );
// }else{
// Show deployment button
// echo "<form method=\"POST\" action=\"call_file.php?module_file=deployment/main.php\" id=buttons>";
echo "<form method=\"POST\" action=\"deploy_config.php\" id=buttons>";
echo '<input type=hidden name=status value="'.$status.'">';
echo '<br><input type="submit" name="submit" value="Deploy" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">';
echo "</form><br>";
// }


4. Allow Apache doing ssh as another user - TODO: make this more secure
Code: Select all
# visudo

#Defaults requiretty
apache ALL=(ALL) NOPASSWD: ALL


5. Adapt deploy_config.php to match your requirements
Code: Select all
# vi deploy_config.php

$NAGIOS_CONF_DIR="/etc/icinga";
$NAGIOS_CONF="icinga.cfg";
$NAGIOS_START_SCRIPT="/etc/init.d/icinga";
$NAGIOS_BIN="/usr/bin/icinga";
$NCONF_DIR="/data/www/nconf";
$NCONF_CONF_DIR="output";
$NCONF_CONF_FILE="NagiosConfig.tgz";
$SSH_PORT = 22;
$SSH_USER = "sshuser";


6. Make sure $SSH_USER can connect via SSH with rsa/dsa-keys to your Nagios/Icinga-Servers and has sudo-permissions there to reload Nagios/Icinga or change the deployment to something other then SSH!

7. Make sure your Nagios/Icinga-Monitor/Collectors are named in the following way in NConf (or adapt the script :) ):
Monitor: monitor_FQDN
Collectors: collector_FQDN
e.g. collector_icinga01.lan.local

The script uses the FQDN to connect to the servers, so DNS must be working.

Please let me know if this script is helpful for you.
Change, code optimizations,... are always welcome ;)


Regards,
René
Attachments
deploy_config.php.tar
(10 KiB) Downloaded 412 times
User avatar
scrat
NConf enthusiast
NConf enthusiast
 
Posts: 101
Joined: Mon Aug 23, 2010 16:28
Location: Vienna, Austria

Re: Deploy only to hosts with changed config

Postby robertkoeppl » Tue Jun 05, 2012 10:25

Thanks a lot. I will need to work out a solution for the naming though. We have no consistent naming scheme for the hosts, as they are depending on the wishes of different customers.
Another Point is the reload. For a reason unknown to me, reload does not seem to work properly with nagios/icinga with ndoutils in place. restart however does work
robertkoeppl
NConf rookie
NConf rookie
 
Posts: 19
Joined: Mon Mar 05, 2012 11:01
Location: Leoben Austria

Re: Deploy only to hosts with changed config

Postby scrat » Tue Jun 05, 2012 10:49

I use Icinga with IDOutils (MySQL-Database on RHEL 6) and reloading is working fine.
Before using Icinga I had Nagios (3.2 on Debian Lenny) with nodutils running and reloading was also no problem.


Regards,
René
User avatar
scrat
NConf enthusiast
NConf enthusiast
 
Posts: 101
Joined: Mon Aug 23, 2010 16:28
Location: Vienna, Austria

Re: Deploy only to hosts with changed config

Postby robertkoeppl » Tue Jun 05, 2012 17:32

What I notice is, that if I reload ( Icinga 1.6.5, SLES11SP2 ) check results no longer arrive in the mysql database, but no errors are to be found anywhere. If I restart it works just fine
robertkoeppl
NConf rookie
NConf rookie
 
Posts: 19
Joined: Mon Mar 05, 2012 11:01
Location: Leoben Austria

Deploy only to hosts with changed config

Postby MichaelPi » Wed Dec 17, 2014 22:39

This is already done in UltraVNC with MS-Logon. There are two groups for full access and a third one for view-only.
MichaelPi
starter
starter
 
Posts: 4
Joined: Wed Dec 10, 2014 03:50


Return to Feature requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron