Madhuvishy has submitted this change and it was merged.

Change subject: nfs: Add sudo permissions for nagios user to run drbd commands
......................................................................


nfs: Add sudo permissions for nagios user to run drbd commands

Bug: T144633
Change-Id: Ifc7ff088cefaa853bbf1710abba7246d969061d0
---
M modules/labstore/manifests/monitoring/drbd.pp
1 file changed, 12 insertions(+), 4 deletions(-)

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



diff --git a/modules/labstore/manifests/monitoring/drbd.pp 
b/modules/labstore/manifests/monitoring/drbd.pp
index da2d30e..1c7dc1d 100644
--- a/modules/labstore/manifests/monitoring/drbd.pp
+++ b/modules/labstore/manifests/monitoring/drbd.pp
@@ -5,6 +5,14 @@
 
 class labstore::monitoring::drbd($drbd_role, $resource = 'all') {
 
+    sudo::user { 'nagios_check_drbd':
+        user       => 'nagios',
+        privileges => [
+                      'ALL = NOPASSWD: /usr/local/sbin/check_drbd_status',
+                      'ALL = NOPASSWD: /usr/local/sbin/check_drbd_role',
+                      ],
+    }
+
     file { '/usr/local/sbin/check_drbd_status':
         source => 'puppet:///modules/labstore/monitor/check_drbd_status',
         mode   => '0755',
@@ -12,9 +20,9 @@
         group  => 'root',
     }
 
-    nrpe::monitor_service { 'check-drbd-status':
+    nrpe::monitor_service { 'check_drbd_status':
         description  => 'Check status of DRBD node',
-        nrpe_command => "/usr/local/sbin/check_drbd_status ${resource} 
${drbd_role}",
+        nrpe_command => "/usr/bin/sudo /usr/local/sbin/check_drbd_status 
${resource} ${drbd_role}",
         require      => File['/usr/local/sbin/check_drbd_status'],
     }
 
@@ -26,8 +34,8 @@
     }
 
     nrpe::monitor_service { 'check_drbd_role':
-        description  => 'Check status of DRBD node',
-        nrpe_command => "/usr/local/sbin/check_drbd_role ${::hostname} 
${drbd_role}",
+        description  => 'Check DRBD role',
+        nrpe_command => "/usr/bin/sudo /usr/local/sbin/check_drbd_role 
${::hostname} ${drbd_role}",
         require      => File['/usr/local/sbin/check_drbd_role'],
     }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc7ff088cefaa853bbf1710abba7246d969061d0
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Madhuvishy <mviswanat...@wikimedia.org>
Gerrit-Reviewer: Madhuvishy <mviswanat...@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