Nagios + allowed_hosts in templates

Hello,

I have two Nagios servers. All works fine until some changes. I manually change on every hosts this line:

allowed_hosts=nagios_server_1,nagios_server_2

For example I added new check for SSH in UCS Managment. After that Nagios was restated all servers have only one Nagios server in nrpe.cfg. Ok. I understand it because it is from Templates.

I tried to change template files from:

#allowed_hosts=127.0.0.1,192.168.0.2 @!@ if baseConfig.has_key('nagios/client/allowedhosts') and baseConfig['nagios/client/allowedhosts']: print 'allowed_hosts=%s' % baseConfig['nagios/client/allowedhosts'] else: print 'allowed_hosts=%s' % baseConfig['ldap/master'] @!@

to

#allowed_hosts=127.0.0.1,192.168.0.2
#@!@
#if baseConfig.has_key('nagios/client/allowedhosts') and baseConfig['nagios/client/allowedhosts']:
#        print 'allowed_hosts=%s' % baseConfig['nagios/client/allowedhosts']
#else:
#        print 'allowed_hosts=%s' % baseConfig['ldap/master']
#@!@
allowed_hosts=nagios_server_1,nagios_server_2

But it doesn’t work. Still I have only one server there. Do you have any idea what should I update after change in Templete file?

Thank you for help.
Rafal

Hi,

did you run “ucr commit /path/to/conffile” after saving the change in the template?

Best Regards,
Dirk Ahrnke

Why not set the UCR variable nagios/client/allowedhosts?

-> ucr set nagios/client/allowedhosts="nagios_server1,nagios_server2"
-> more /etc/nagios/nrpe.cfg | grep allowed_hosts
#allowed_hosts=127.0.0.1,192.168.0.2
allowed_hosts=nagios_server1,nagios_server2
Mastodon