Hi,
Is there a way to run CLI commands as a different user?
Here’s my situation:
I am monitoring my asterisk box using zabbix, the basics such as cpu, ram, hd space, etc are all easily done.
I need to monitor an IAX2 peer though as it sometimes goes down. I found it was easy enough to monitor by running this command:
asterisk -rx “iax2 show peers”
I then strip out what I need from the output and monitor it. I would also like to be able to send a remote command via zabbix to restart the iax if necessary.
Here’s my problem: Zabbix cannot run as root, it has it’s own user. For the monitoring this proved a problem as well, solved by creating a cronjob that saves the output to a text file accessible by the zabbix user. This will not work for sending a command to restart iax though.
Has anyone got any suggestions on how I might accomplish this?
Also please note that I am not interested in a script that monitors and restarts the service, my main concern is external monitoring and graphing. I would also like to be able to add other checks/commands at a later stage if possible.