While running check_mailq with root user output is as expected but with icinga user it is giving below error:
[root@servername ~]# /icinga/plugins/libexec/check_mailq -w 1 -c 2
postqueue: warning: Mail system is down -- accessing queue directly
WARNING: postfix mailq is 1 (threshold w = 1)|unsent=1;1;2;0
[root@servername ~]# su - icinga
[icinga@servername ~]$ /icinga/plugins/libexec/check_mailq -w 1 -c 2
postqueue: fatal: Queue report unavailable - mail system is down
CRITICAL: Error code 69 returned from /usr/bin/mailq
I added icinga user to all below groups
[icinga@servername~]$ groups
icinga root mail smmsp postfix postdrop cgred icinga_cmd
And changed group permission (+rx) for directory and sub-directories under /var/spool/postfix/, /var/spool/clientmqueue/ , /var/spool/mqueue/, /var/spool/snmptt/ & /var/spool/mail/
]#ll /var/spool/postfix/
drwxr-x---. 2 postfix root 20480 Jul 17 11:00 active
drwxr-x---. 2 postfix root 4096 Jul 17 11:00 bounce
drwxr-x---. 2 postfix root 4096 Oct 31 2016 corrupt
drwxr-x---. 18 postfix root 4096 Oct 31 2016 defer
drwxr-x---. 18 postfix root 4096 Oct 31 2016 deferred
drwxr-x---. 2 postfix root 4096 Oct 31 2016 flush
drwxr-x---. 2 postfix root 4096 Oct 31 2016 hold
drwxr-x---. 2 postfix root 4096 Jul 17 11:00 incoming
drwxrwx---. 2 postfix postdrop 20480 Jul 17 11:06 maildrop
drwxr-xr-x. 2 root root 4096 Jul 17 11:05 pid
drwxr-x---. 2 postfix root 4096 Jul 17 06:22 private
drwxr-x---. 2 postfix postdrop 4096 Jul 17 06:22 public
drwxr-x---. 2 postfix root 4096 Oct 31 2016 saved
drwxr-x---. 2 postfix root 4096 Oct 31 2016 trace
]#ls -ld /var/spool/clientmqueue/
drwxrwx---. 2 smmsp smmsp 5398528 Aug 21 2017 /var/spool/clientmqueue/
]#ls -ld /var/spool/mqueue/
drwxr-x---. 2 root mail 4096 May 27 2016 /var/spool/mqueue/
]#ls -ld /var/spool/snmptt/
drwxr-xr-x. 2 snmptt snmptt 995328 Jul 17 11:21 /var/spool/snmptt/
]# ls -ld /var/spool/mail/
drwxrwxr-x. 2 root mail 4096 Jul 17 11:00 /var/spool/mail/
When I run mailq
command with root user it shows mails in queue but with icinga user it just says postqueue: fatal: Queue report unavailable
Please help me to understand if i'm missing anything, why mailq is not giving correct output with icinga user.
Note: I don't want to use sudo.
0 Answers