Alexandros Kosiaris has submitted this change and it was merged.

Change subject: check_puppetrun: Display the admin set message
......................................................................


check_puppetrun: Display the admin set message

Have check_puppetrun display the puppet disabled message set by the
admin. It's useful info to have displayed in the icinga interface

Change-Id: If31535d7092d4bb9167fe838253d17a47542349e
---
M modules/base/files/monitoring/check_puppetrun
1 file changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Giuseppe Lavagetto: Looks good to me, but someone else must approve
  Alexandros Kosiaris: Verified; Looks good to me, approved



diff --git a/modules/base/files/monitoring/check_puppetrun 
b/modules/base/files/monitoring/check_puppetrun
index 21961c7..7df6abd 100755
--- a/modules/base/files/monitoring/check_puppetrun
+++ b/modules/base/files/monitoring/check_puppetrun
@@ -11,6 +11,7 @@
 
 require 'optparse'
 require 'yaml'
+require 'json' # TODO: Remove once we are free from precise
 
 runlockfile = "/var/lib/puppet/state/agent_catalog_run.lock"
 adminlockfile = "/var/lib/puppet/state/agent_disabled.lock"
@@ -64,6 +65,10 @@
 
 if File.exists?(adminlockfile)
        enabled = false
+       # TODO: ruby 1.8 YAML parser sucks. Once we are free, transform into
+       # disabled_message = YAML.load_file(adminlockfile)["disabled_message"]
+       tmp = JSON.parse(File.read(adminlockfile))
+       disabled_message = tmp["disabled_message"]
 end
 
 if File.exists?(runlockfile)
@@ -114,7 +119,7 @@
 end
 
 if not enabled
-    puts "WARNING: Puppet is currently disabled, last run 
#{human_time_since_last_run} ago with #{failcount} failures"
+    puts "WARNING: Puppet is currently disabled, message: #{disabled_message}, 
last run #{human_time_since_last_run} ago with #{failcount} failures"
     exit 1
 end
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If31535d7092d4bb9167fe838253d17a47542349e
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Gehel <gleder...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to