0

im trying to monitoring the log from httpd but i have this error:

[root@localhost httpd]# tail -f /var/log/zabbix/zabbix_agentd.log
  2446:20210304:102535.671 agent #0 started [main process]
  2451:20210304:102535.683 agent #5 started [active checks #1]
  2447:20210304:102535.688 agent #1 started [collector]
  2448:20210304:102535.688 agent #2 started [listener #1]
  2449:20210304:102535.692 agent #3 started [listener #2]
  2450:20210304:102535.693 agent #4 started [listener #3]
  2451:20210304:102837.516 active check "log[/var/log/httpd/error_log]" is not supported: Cannot obtain information for file "/var/log/httpd/error_log": [13] Permission denied

How i can obtained permission

3

2 Answers 2

1

error message suggests that zabbix user cannot read the mentioned file "/var/log/httpd/error_log".

Please know that only making the file readable by all does not help - you need to provide user "zabbix" a way to travese the directory structure where the file is located - i.e. permissions for directories need to be adjusted like so:

chmod o+rx /var
chmod o+rx /var/log
chmod o+rx /var/log/httpd

this provides "others" to read + execute the directory structure where the file is located.

to test you have correct permissions to read the file you can do the following:

~# whoami
root
~# sudo -u zabbix /bin/bash
/root$ whoami
zabbix
/root$ cat /var/log/nginx/some-error.log
cat: /var/log/nginx/some-error.log: Permission denied

example above shows that permissions are not correct.

0

Instead of using chmod o+rx which gives too wide permission you can use ACLs if filesystem support it. For example to solve following error:

active check "vfs.fs.size[/home/git-data/repositories/+gitaly/PackObjectsCache,pused]" is not supported: Cannot obtain filesystem information: [13] Permission denied

on Debian-like os you can:

apt install acl
setfacl -m u:zabbix:x /home/git-data
setfacl -m u:zabbix:x /home/git-data/repositories
setfacl -m u:zabbix:x /home/git-data/repositories/+gitaly

To inspect problem please switch to user zabbix and test access rights:

sudo -u zabbix /bin/bash
df /home/git-data/repositories/+gitaly/PackObjectsCache

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.