divided between host an service downtimes
This commit is contained in:
parent
8a209ed30b
commit
8015b8c979
1 changed files with 17 additions and 5 deletions
|
@ -33,7 +33,8 @@ options:
|
||||||
required: true
|
required: true
|
||||||
default: null
|
default: null
|
||||||
choices: [ "downtime", "enable_alerts", "disable_alerts", "silence", "unsilence",
|
choices: [ "downtime", "enable_alerts", "disable_alerts", "silence", "unsilence",
|
||||||
"silence_nagios", "unsilence_nagios", "command" ]
|
"silence_nagios", "unsilence_nagios", "command", "servicegroup_service_downtime",
|
||||||
|
"servicegroup_host_downtime" ]
|
||||||
host:
|
host:
|
||||||
description:
|
description:
|
||||||
- Host to operate on in Nagios.
|
- Host to operate on in Nagios.
|
||||||
|
@ -99,6 +100,12 @@ EXAMPLES = '''
|
||||||
# schedule downtime for a few services
|
# schedule downtime for a few services
|
||||||
- nagios: action=downtime services=frob,foobar,qeuz host={{ inventory_hostname }}
|
- nagios: action=downtime services=frob,foobar,qeuz host={{ inventory_hostname }}
|
||||||
|
|
||||||
|
# set 30 minutes downtime for all services in servicegroup foo
|
||||||
|
- nagios: action=servicegroup_service_downtime minutes=30 servicegroup=foo host={{ inventory_hostname }}
|
||||||
|
|
||||||
|
# set 30 minutes downtime for all host in servicegroup foo
|
||||||
|
- nagios: action=servicegroup_host_downtime minutes=30 servicegroup=foo host={{ inventory_hostname }}
|
||||||
|
|
||||||
# enable SMART disk alerts
|
# enable SMART disk alerts
|
||||||
- nagios: action=enable_alerts service=smart host={{ inventory_hostname }}
|
- nagios: action=enable_alerts service=smart host={{ inventory_hostname }}
|
||||||
|
|
||||||
|
@ -178,9 +185,11 @@ def main():
|
||||||
'silence_nagios',
|
'silence_nagios',
|
||||||
'unsilence_nagios',
|
'unsilence_nagios',
|
||||||
'command',
|
'command',
|
||||||
'servicegroup_downtime'
|
'servicegroup_host_downtime',
|
||||||
|
'servicegroup_service_downtime',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
action=dict(required=True, default=None, choices=ACTION_CHOICES),
|
action=dict(required=True, default=None, choices=ACTION_CHOICES),
|
||||||
|
@ -232,8 +241,8 @@ def main():
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
if action == 'servicegroup_downtime':
|
if action in ['servicegroup_service_downtime', 'servicegroup_host_downtime']:
|
||||||
# Make sure there's an actual service selected
|
# Make sure there's an actual servicegroup selected
|
||||||
if not servicegroup:
|
if not servicegroup:
|
||||||
module.fail_json(msg='no servicegroup selected to set downtime for')
|
module.fail_json(msg='no servicegroup selected to set downtime for')
|
||||||
# Make sure minutes is a number
|
# Make sure minutes is a number
|
||||||
|
@ -879,7 +888,10 @@ class Nagios(object):
|
||||||
self.schedule_svc_downtime(self.host,
|
self.schedule_svc_downtime(self.host,
|
||||||
services=self.services,
|
services=self.services,
|
||||||
minutes=self.minutes)
|
minutes=self.minutes)
|
||||||
if self.action == "servicegroup_downtime":
|
elif self.action == "servicegroup_host_downtime":
|
||||||
|
if self.services == 'servicegroup':
|
||||||
|
self.schedule_servicegroup_host_downtime(self, self.servicegroup, minutes=30)
|
||||||
|
elif self.action == "servicegroup_service_downtime":
|
||||||
if self.services == 'servicegroup':
|
if self.services == 'servicegroup':
|
||||||
self.schedule_servicegroup_host_downtime(self, self.servicegroup, minutes=30)
|
self.schedule_servicegroup_host_downtime(self, self.servicegroup, minutes=30)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue