From f3d9f8da7b3ed5f3c6cf717a837738c3b81c4368 Mon Sep 17 00:00:00 2001 From: Tim Bielawa Date: Mon, 1 Oct 2012 12:07:08 -0400 Subject: [PATCH] Add DOCUMENTATION to nagios module. --- library/nagios | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/library/nagios b/library/nagios index a5e10800d07..3886d9441dc 100755 --- a/library/nagios +++ b/library/nagios @@ -38,6 +38,98 @@ Set the path to the command file explicitly with the 'cmdfile' parameter. """ +DOCUMENTATION = ''' +--- +module: nagios +short_description: Perform common tasks in Nagios related to downtime and notifications. +description: + - "The Nagios module has two basic functions: scheduling downtime and toggling alerts for services or hosts." + - All actions require the C(host) parameter to be given explicitly. In playbooks you can use the C($inventory_hostname) variable to refer to the host the playbook is currently running on. + - You can specify multiple services at once by separating them with commas, .e.g., C(services=httpd,nfs,puppet). + - When specifying what service to handle there is a special service value, B(host), which will handle alerts/downtime for the B(host itself), e.g., C(service=host). This keyword may not be given with other services at the same time. I(Setting alerts/downtime for a host does not affect alerts/downtime for any of the services running on it.) + - When using the B(nagios) module you will need to specify your nagios server using the C(delegate_to) parameter. +version_added: 0.7 +options: + action: + description: + - Action to take. + required: true + default: null + choices: [ "downtime", "enable_alerts", "disable_alerts", "silence", "unsilence" ] + host: + description: + - Host to operate on in Nagios. + required: true + default: null + cmdfile: + description: + - Path to the nagios I(command file) (FIFO pipe). + - Only required if auto-detection fails. + required: false + default: auto-detected + author: + description: + - Author to leave downtime comments as. + - Only useable with the C(downtime) action. + required: false + default: Ansible + minutes: + description: + - Minutes to schedule downtime for. + - Only useable with the C(downtime) action. + required: false + default: 30 + services: + description: + - What to manage downtime/alerts for. Separate multiple services with commas. + - C(service) is an alias for C(services). + - B(Required) option when using the C(downtime), C(enable_alerts), and C(disable_alerts) actions. + required: true + default: null +author: Tim Bielawa +''' + +EXAMPLES = [ +""" +- description: set 30 minutes of apache downtime + code: nagios action=downtime minutes=30 service=httpd host=$inventory_hostname +""", + +""" +- description: schedule an hour of HOST downtime + code: nagios action=downtime minutes=60 service=host host=$inventory_hostname +""", + +""" +- description: schedule downtime for a few services + code: nagios action=downtime services=frob,foobar,qeuz host=$inventory_hostname +""", + +""" +- description: enable SMART disk alerts + code: nagios action=enable_alerts service=smart host=$inventory_hostname +""", + +""" +- description: two services at once: disable httpd and nfs alerts + code: nagios action=disable_alerts service=httpd,nfs host=$inventory_hostname +""", + +""" +- description: disable HOST alerts + code: nagios action=disable_alerts service=host host=$inventory_hostname +""", + +""" +- description: silence ALL alerts + code: nagios action=silence host=$inventory_hostname +""", + +""" +- description: unsilence all alerts + code: nagios action=unsilence host=$inventory_hostname +""" +] import ConfigParser import types