Don't just keep adding to the sudoers file in xvm-munin-config
[invirt/packages/xvm-munin-config.git] / debian / xvm-munin-host-config.postinst
index 5060710..3dbbeb6 100755 (executable)
@@ -23,12 +23,17 @@ case "$1" in
         # So munin can read the mail log
         adduser munin adm
         
         # So munin can read the mail log
         adduser munin adm
         
+        # First clear out the old stuff we threw in /etc/sudoers
+        perl -i.bak -ne 's%^### (BEGIN|END) xvm-munin-config\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers
+        
         # So munin can sudo to get to postfix queue info
         # So munin can sudo to get to postfix queue info
+        # and smartctl info
+        # and info about running domains
         cat >>/etc/sudoers <<EOF
 ### BEGIN xvm-munin-config
 munin ALL=(postfix) SETENV: NOPASSWD: /etc/munin/plugins/postfix_mailqueue
 munin ALL=(munin) SETENV: NOPASSWD: ALL
         cat >>/etc/sudoers <<EOF
 ### BEGIN xvm-munin-config
 munin ALL=(postfix) SETENV: NOPASSWD: /etc/munin/plugins/postfix_mailqueue
 munin ALL=(munin) SETENV: NOPASSWD: ALL
-munin ALL=(root) SETENV: NOPASSWD: /etc/munin/plugins/hddtemp_smartctl , /etc/munin/plugins/smart_*
+munin ALL=(root) SETENV: NOPASSWD: /etc/munin/plugins/hddtemp_smartctl , /etc/munin/plugins/smart_* , /etc/munin/plugins/xen_cpu
 ### END xvm-munin-config
 EOF
         
 ### END xvm-munin-config
 EOF