Nagios is a IT infrastructure monitoring system. I am writing a simple plug-in script for it. A special account, nagios, has been created for it, and the script gets run by Nagios under that account.
For debugging purposes, the script is very simple:
#!/bin/bash
echo "OK - Running okay" ~ `id`
It echoes the value of ~
, i.e. the home directory, and the result of the id
command.
I log into the nagios account (su -l nagios
), and test it from the command line:
OK - Running okay /home/nagios uid=1005(nagios) gid=1007(nagios) groups=1007(nagios),1008(nagcmd)
That is exactly what I expect.
I run it from within the Nagios system, the reported results are:
OK - Running okay /home/julian uid=1005(nagios) gid=1007(nagios) groups=1007(nagios),1008(nagcmd)
Wait, /home/julian
is my account's home directory; but it is logged into the nagios account. That contradiction makes no sense to me; I obviously don't understand how this is meant to work.
Any suggestions how this might be happening?