47 lines
947 B
Python
47 lines
947 B
Python
defaults = {
|
|
'monitoring': {
|
|
'services': {
|
|
'test': {
|
|
'vars.command': '/bin/ls /',
|
|
},
|
|
},
|
|
},
|
|
}
|
|
|
|
|
|
@metadata_reactor.provides(
|
|
'monitoring/services',
|
|
)
|
|
def default_check_command(metadata):
|
|
services = {}
|
|
|
|
for name, conf in metadata.get('monitoring/services').items():
|
|
services[name] = {}
|
|
|
|
if 'host_name' not in conf:
|
|
services[name]['host_name'] = node.name
|
|
|
|
if 'check_command' not in conf:
|
|
services[name]['check_command'] = 'sshmon'
|
|
|
|
return {
|
|
'monitoring': {
|
|
'services': services,
|
|
},
|
|
}
|
|
|
|
|
|
|
|
@metadata_reactor.provides(
|
|
'users/sshmon/authorized_users'
|
|
)
|
|
def user(metadata):
|
|
return {
|
|
'users': {
|
|
'sshmon': {
|
|
'authorized_users': {
|
|
'nagios@' + metadata.get('monitoring/icinga2_node'),
|
|
}
|
|
},
|
|
},
|
|
}
|