我一直在用下面的脚本监视gluster FS mount,但是通过NRPE执行脚本时遇到了问题。
这是我在远程盒子上的脚本。 /usr/lib64/nagios/plugins/check_gluster.pl
#!/usr/bin/perl @output=`/usr/sbin/gluster volume heal static info split-brain | egrep "Number of entries"`; if($output[0] !~ m/0/){ print "CRITICAL: Possible m4_2b split brain issues - $output[0]"; }elsif($output[0] !~ m/0/) { print "CRITICAL: Possible m4_2c split brain issues"; }else { print "OK"; }
在我的NRPE中,我有以下configuration
command[check_glusterfs]=/usr/bin/sudo /usr/lib64/nagios/plugins/check_gluster.pl
当我在Nagios上运行check_nrpe时,我有以下几点:
# /usr/lib/nagios/plugins/check_nrpe -t 60 -H myhost.domain.com -c check_glusterfs NRPE: Unable to read output
在远程盒子上,我有以下错误,
type=AVC msg=audit(1397547577.720:1183140): avc: denied { execute } for pid=20524 comm="sh" name="sudo" dev=xvde ino=11029 scontext=unconfined_u:system_r:nrpe_t:s0 tcontext=system_u:object_r:sudo_exec_t:s0 tclass=file type=SYSCALL msg=audit(1397547577.720:1183140): arch=c000003e syscall=59 success=no exit=-13 a0=89f800 a1=89ecd0 a2=89e1f0 a3=7fff72151910 items=0 ppid=20523 pid=20524 auid=512 uid=497 gid=498 euid=497 suid=497 fsuid=497 egid=498 sgid=498 fsgid=498 tty=(none) ses=120914 comm="sh" exe="/bin/bash" subj=unconfined_u:system_r:nrpe_t:s0 key=(null) type=AVC msg=audit(1397547577.720:1183141): avc: denied { execute } for pid=20524 comm="sh" name="sudo" dev=xvde ino=11029 scontext=unconfined_u:system_r:nrpe_t:s0 tcontext=system_u:object_r:sudo_exec_t:s0 tclass=file type=SYSCALL msg=audit(1397547577.720:1183141): arch=c000003e syscall=21 success=no exit=-13 a0=89f800 a1=1 a2=0 a3=7fff72151910 items=0 ppid=20523 pid=20524 auid=512 uid=497 gid=498 euid=497 suid=497 fsuid=497 egid=498 sgid=498 fsgid=498 tty=(none) ses=120914 comm="sh" exe="/bin/bash" subj=unconfined_u:system_r:nrpe_t:s0 key=(null)
[更新]任何人有任何想法我可以解决这个问题? 不幸的是,我不允许在箱子上禁用selinux。
我正在运行Cento 6.5
问候,艾伦
问题是,SELinux阻止了使用sudo的Nagios插件。
为了确保这是由SELinux引起的,您可以禁用它或将其设置为宽容:
/etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - SELinux is fully disabled. SELINUX=permissive
策略更改将在下次启动时运行。