I have written a script to obtain the max no of open files for a particular process and I can successfully collect the value by directly issuing the command in OS as well as testing the option with zabbix_agentd -t while it didn't work with zabbix_get as well as the web interface reported ZBX_NOTSUPPORTED. Please find below config that I used to obtain the open file limit for a particular user (e.g. apache).
/opt/zabbix/etc/maxFileOpen.sh
In the zabbix log, it simply complain with :-
I have no idea on what would possibly be the problem, but I truly suspect the problem actually is permission related and I think I can get around this problem by setting the Allow Root to 1 but this is really not an ideal solution. Actually the zabbix_agentd is running under an non-privileged account zabbix. Does anyone have any idea?
The environment using is zabbix 1.8.9 under RHEL 5.3
Code:
UserParameter=OpenFileLimit[*],/usr/bin/sudo /opt/zabbix/etc/maxFileOpen.sh "$1"
Code:
#!/bin/bash
/bin/cat /proc/`/bin/ps -u ${1} -opid | /usr/bin/tail -1 | awk '{print $1}'`/limits | /bin/awk '/Max open files/ {print $5}'
Code:
[root@server ~]# /opt/zabbix/etc/maxFileOpen.sh apache 1024 [root@server ~]# /usr/bin/sudo -u zabbix /usr/bin/sudo /opt/zabbix/etc/maxFileOpen.sh apache 1024 [root@server ~]# /opt/zabbix/etc/maxFileOpen.sh "apache" 1024 [root@server ~]# /usr/bin/sudo -u zabbix /usr/bin/sudo /opt/zabbix/etc/maxFileOpen.sh "apache" 1024 [root@server ~]# /opt/zabbix/sbin/zabbix_agentd -t 'OpenFileLimit[apache]' OpenFileLimit[apache] [t|1024] [root@server ~]# /opt/zabbix/bin/zabbix_get -s 127.0.0.1 -key OpenFileLimit[apache] ZBX_NOTSUPPORTED
Code:
21145:20120424:181052.529 Run remote command [/usr/bin/sudo /opt/zabbix/etc/maxFileOpen.sh "apache"] Result [0] []... 21145:20120424:181052.529 Sending back [ZBX_NOTSUPPORTED] 21143:20120424:181052.932 In update_cpustats() 21143:20120424:181052.932 End of update_cpustats()
The environment using is zabbix 1.8.9 under RHEL 5.3
Comment