Volans has submitted this change and it was merged.

Change subject: Icinga: raid_handler improvements
......................................................................


Icinga: raid_handler improvements

* enable debug logging for now
* notify Icinga when the raid_handler configuration changes
* pass also the $SERVICENOTES$ variable to detect timeouts (first
  approach to check it's value)

Bug: T142085
Change-Id: Ie1da8854685237cae7d6ca61746708f43cae526d
---
M modules/icinga/files/raid_handler.py
M modules/icinga/manifests/event_handlers/raid.pp
M modules/icinga/templates/event_handlers/raid_handler.cfg.erb
3 files changed, 11 insertions(+), 1 deletion(-)

Approvals:
  Volans: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/icinga/files/raid_handler.py 
b/modules/icinga/files/raid_handler.py
index 00d2609..05f83c9 100644
--- a/modules/icinga/files/raid_handler.py
+++ b/modules/icinga/files/raid_handler.py
@@ -68,6 +68,8 @@
         '-c', dest='datacenter', action='store', required=True,
         help='The name of the datacenter the host is located in')
     parser.add_argument(
+        '-n', dest='notes', action='store', help='The Service notes')
+    parser.add_argument(
         '-d', dest='debug', action='store_true', help='Debug level logging')
 
     return parser.parse_args()
@@ -210,6 +212,13 @@
         logger.debug('Nothing to do, exiting')
         return
 
+    if args.notes is not None and 'Timeout' in args.notes:
+        logger.info(
+            ("Skipping RAID Handler execution for host '{}' and "
+             "RAID type '{}', timeout detected: {}").format(
+                args.host_address, args.raid_type, args.notes))
+        return
+
     raid_status = get_raid_status(args.host_address, args.raid_type)
     phab_client = get_phabricator_client()
     project_ids = get_phabricator_project_ids(phab_client, args.datacenter)
diff --git a/modules/icinga/manifests/event_handlers/raid.pp 
b/modules/icinga/manifests/event_handlers/raid.pp
index 357d259..7222490 100644
--- a/modules/icinga/manifests/event_handlers/raid.pp
+++ b/modules/icinga/manifests/event_handlers/raid.pp
@@ -34,5 +34,6 @@
         owner      => 'icinga',
         group      => 'icinga',
         require    => 
File['/usr/lib/nagios/plugins/eventhandlers/raid_handler'],
+        notify     => Service['icinga'],
     }
 }
diff --git a/modules/icinga/templates/event_handlers/raid_handler.cfg.erb 
b/modules/icinga/templates/event_handlers/raid_handler.cfg.erb
index 3beb095..e60620d 100644
--- a/modules/icinga/templates/event_handlers/raid_handler.cfg.erb
+++ b/modules/icinga/templates/event_handlers/raid_handler.cfg.erb
@@ -1,4 +1,4 @@
 define command{
     command_name    raid_handler
-    command_line    $USER1$/eventhandlers/raid_handler -s $SERVICESTATE$ -t 
$SERVICESTATETYPE$ -a $SERVICEATTEMPT$ -H $HOSTNAME$ -r $ARG1$ -D "$ARG2$" -c 
$ARG3$
+    command_line    $USER1$/eventhandlers/raid_handler -d -s $SERVICESTATE$ -t 
$SERVICESTATETYPE$ -a $SERVICEATTEMPT$ -H $HOSTNAME$ -n "$SERVICENOTES$" -r 
$ARG1$ -D "$ARG2$" -c $ARG3$
     }

-- 
To view, visit https://gerrit.wikimedia.org/r/316779
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie1da8854685237cae7d6ca61746708f43cae526d
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Volans <[email protected]>
Gerrit-Reviewer: Alexandros Kosiaris <[email protected]>
Gerrit-Reviewer: Faidon Liambotis <[email protected]>
Gerrit-Reviewer: Volans <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to