[MediaWiki-commits] [Gerrit] raid: setup multiple checks, one per each RAID found - change (operations/puppet)

2016-05-30 Thread Faidon Liambotis (Code Review)
Faidon Liambotis has submitted this change and it was merged.

Change subject: raid: setup multiple checks, one per each RAID found
..


raid: setup multiple checks, one per each RAID found

Instead of calling check_raid once, and let it autodetect a single RAID
controller (or always return "OK", if none found), tie our newly-created
fact with our newly-written check-raid support for arguments to setup
multiple NRPE checks, as (or if) needed.

This also removes support for /etc/nagios/raid_utility which was used as
a workaround for systems with multiple RAID controllers, such as
labstore1001.

Bug: T84050
Change-Id: Id55187c725ec08e3c24f362729143a2182061726
---
M modules/raid/files/check-raid.py
M modules/raid/manifests/init.pp
2 files changed, 27 insertions(+), 15 deletions(-)

Approvals:
  Faidon Liambotis: Verified; Looks good to me, approved



diff --git a/modules/raid/files/check-raid.py b/modules/raid/files/check-raid.py
index 06b86b0..c03687c 100644
--- a/modules/raid/files/check-raid.py
+++ b/modules/raid/files/check-raid.py
@@ -10,14 +10,6 @@
 
 def main():
 try:
-# following the model of self determination for OS and driver
-# allow for a declarative override to ensure a specific driver
-with open('/etc/nagios/raid_utility') as f:
-hc_driver = f.read().strip()
-except:
-hc_driver = None
-
-try:
 argv_driver = sys.argv[1]
 except:
 argv_driver = None
@@ -25,8 +17,6 @@
 osName = os.uname()[0]
 if argv_driver:
 driver = argv_driver
-elif hc_driver:
-driver = hc_driver
 elif osName == 'SunOS':
 driver = 'zpool'
 elif osName == 'Linux':
diff --git a/modules/raid/manifests/init.pp b/modules/raid/manifests/init.pp
index 5ece243..f6ff0d2 100644
--- a/modules/raid/manifests/init.pp
+++ b/modules/raid/manifests/init.pp
@@ -14,8 +14,15 @@
 # following line should be then removed.
 $raid = split($::raid, ',')
 
+$check_raid = '/usr/bin/sudo /usr/local/lib/nagios/plugins/check_raid'
+
 if 'megaraid' in $raid {
 require_package('megacli')
+
+nrpe::monitor_service { 'raid_megaraid':
+description  => 'MegaRAID',
+nrpe_command => "${check_raid} megacli",
+}
 }
 
 if 'mpt' in $raid {
@@ -29,17 +36,37 @@
 content => "RUN_DAEMON=no\n",
 before  => Package['mpt-status'],
 }
+
+nrpe::monitor_service { 'raid_mpt':
+description  => 'MPT RAID',
+nrpe_command => "${check_raid} mpt",
+}
 }
 if 'md' in $raid {
 # if there is an "md" RAID configured, mdadm is already installed
+
+nrpe::monitor_service { 'raid_md':
+description  => 'MD RAID',
+nrpe_command => "${check_raid} md",
+}
 }
 
 if 'aac' in $raid {
 require_package('arcconf')
+
+nrpe::monitor_service { 'raid_aac':
+description  => 'Adaptec RAID',
+nrpe_command => "${check_raid} aac",
+}
 }
 
 if 'twe' in $raid {
 require_package('tw-cli')
+
+nrpe::monitor_service { 'raid_twe':
+description  => '3ware TW',
+nrpe_command => "${check_raid} twe",
+}
 }
 
 file { '/usr/local/lib/nagios/plugins/check_raid':
@@ -53,10 +80,5 @@
 sudo::user { 'nagios_raid':
 user   => 'nagios',
 privileges => ['ALL = NOPASSWD: 
/usr/local/lib/nagios/plugins/check_raid'],
-}
-
-nrpe::monitor_service { 'raid':
-description  => 'RAID',
-nrpe_command => '/usr/bin/sudo 
/usr/local/lib/nagios/plugins/check_raid',
 }
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id55187c725ec08e3c24f362729143a2182061726
Gerrit-PatchSet: 7
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis 
Gerrit-Reviewer: Faidon Liambotis 
Gerrit-Reviewer: Volans 
Gerrit-Reviewer: jenkins-bot <>

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


[MediaWiki-commits] [Gerrit] raid: setup multiple checks, one per each RAID found - change (operations/puppet)

2016-05-26 Thread Faidon Liambotis (Code Review)
Faidon Liambotis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/291013

Change subject: raid: setup multiple checks, one per each RAID found
..

raid: setup multiple checks, one per each RAID found

Instead of calling check_raid once, and let it autodetect a single RAID
controller (or always return "OK", if none found), tie our newly-created
fact with our newly-written check-raid support for arguments to setup
multiple NRPE checks, as (or if) needed.

This also removes support for /etc/nagios/raid_utility which was used as
a workaround for systems with multiple RAID controllers, such as
labstore1001.

Bug: T84050
Change-Id: Id55187c725ec08e3c24f362729143a2182061726
---
M modules/raid/files/check-raid.py
M modules/raid/manifests/init.pp
2 files changed, 27 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/13/291013/1

diff --git a/modules/raid/files/check-raid.py b/modules/raid/files/check-raid.py
index 9dcf404..6c02a01 100644
--- a/modules/raid/files/check-raid.py
+++ b/modules/raid/files/check-raid.py
@@ -9,14 +9,6 @@
 
 def main():
 try:
-# following the model of self determination for OS and driver
-# allow for a declarative override to ensure a specific driver
-with open('/etc/nagios/raid_utility') as f:
-hc_driver = f.read().strip()
-except:
-hc_driver = None
-
-try:
 argv_driver = sys.argv[1]
 except:
 argv_driver = None
diff --git a/modules/raid/manifests/init.pp b/modules/raid/manifests/init.pp
index 8bdaf80..7c754e7 100644
--- a/modules/raid/manifests/init.pp
+++ b/modules/raid/manifests/init.pp
@@ -14,8 +14,15 @@
 # - Puppet with stringify_facts=false (if supported)
 $raid = split($::raid, ',')
 
+$check_raid = '/usr/bin/sudo /usr/local/lib/nagios/plugins/check_raid'
+
 if 'megaraid' in $raid {
 require_package('megacli')
+
+nrpe::monitor_service { 'raid_megaraid':
+description  => 'MegaRAID',
+nrpe_command => "${check_raid} megacli",
+}
 }
 
 if 'hpsa' in $raid {
@@ -33,17 +40,37 @@
 content => "RUN_DAEMON=no\n",
 before  => Package['mpt-status'],
 }
+
+nrpe::monitor_service { 'raid_mpt':
+description  => 'MPT RAID',
+nrpe_command => "${check_raid} mpt",
+}
 }
 if 'md' in $raid {
 # if there is an "md" RAID configured, mdadm is already installed
+
+nrpe::monitor_service { 'raid_md':
+description  => 'MD RAID',
+nrpe_command => "${check_raid} md",
+}
 }
 
 if 'aac' in $raid {
 require_package('arcconf')
+
+nrpe::monitor_service { 'raid_aac':
+description  => 'Adaptec RAID',
+nrpe_command => "${check_raid} aac",
+}
 }
 
 if 'twe' in $raid {
 require_package('tw-cli')
+
+nrpe::monitor_service { 'raid_twe':
+description  => '3ware TW',
+nrpe_command => "${check_raid} twe",
+}
 }
 
 file { '/usr/local/lib/nagios/plugins/check_raid':
@@ -57,10 +84,5 @@
 sudo::user { 'nagios_raid':
 user   => 'nagios',
 privileges => ['ALL = NOPASSWD: 
/usr/local/lib/nagios/plugins/check_raid'],
-}
-
-nrpe::monitor_service { 'raid':
-description  => 'RAID',
-nrpe_command => '/usr/bin/sudo 
/usr/local/lib/nagios/plugins/check_raid',
 }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id55187c725ec08e3c24f362729143a2182061726
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis 

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