Hello,
On my zabbix 6.0.4 (from VM appliance) I'm facing a problem with bash (.sh) scripts.
Scripts are in /opt/zabbix/scripts/ and have execution rights.
Here is the script :
Basically, the script ask via telnet the state of a meeting room to the controller and parse the response to give 1 or 0 as return.
The execution in command line as user zabbix work perfectly.
But when I ask to execute the script from zabbix web interface, it fail partially.
Factually, it seems to ignore language parts like if conditions (if is always true), or even variables are not usable.
Only the command echo 1 seems to work because this is the only output I have in web interface (even when the answer should be 0).
All that let me think it's a problem of bash interpreter, but I already adapted /etc/passwd file :
zabbix:x:997:994:Zabbix Monitoring System:/var/lib/zabbix:/bin/bash
How can I troubleshoot this problem and change the bash interpreter of the web interface itself ?
Thanks for your support.
EquIT
On my zabbix 6.0.4 (from VM appliance) I'm facing a problem with bash (.sh) scripts.
Scripts are in /opt/zabbix/scripts/ and have execution rights.
Here is the script :
Code:
#!/bin/bash
substring0="0"
substring1="1"
sortieCommande=$(./RequestToCrestron.sh $1 2>/dev/null)
echo -e "$sortieCommande"
sortieCommande=${sortieCommande##*+}
sortieCommande=${sortieCommande%-*}
echo "$sortieCommande"
if grep -q "$sortieCommande" <<< "$substring1";
then
echo 1
else
echo 0
fi
exit 0
Basically, the script ask via telnet the state of a meeting room to the controller and parse the response to give 1 or 0 as return.
The execution in command line as user zabbix work perfectly.
But when I ask to execute the script from zabbix web interface, it fail partially.
Factually, it seems to ignore language parts like if conditions (if is always true), or even variables are not usable.
Only the command echo 1 seems to work because this is the only output I have in web interface (even when the answer should be 0).
All that let me think it's a problem of bash interpreter, but I already adapted /etc/passwd file :
zabbix:x:997:994:Zabbix Monitoring System:/var/lib/zabbix:/bin/bash
How can I troubleshoot this problem and change the bash interpreter of the web interface itself ?
Thanks for your support.
EquIT
Comment