Gentlement,
Recently I was trying to create a script that gets the value of active calls one week behind.
My script looks like:
(Please disconsider the simplicity of the script, Im no bash expert)
#!/bin/bash
declare -i timestamp=`date +"%s"`;
let "timestamp=$timestamp - 604800";
let "timestamp=$timestamp - 4800";
let "start=$timestamp - 30";
let "stop=$timestamp + 30";
variable=`
mysql -sN -u root --password=password << eof
use zabbix;
select history_uint.value from history_uint where ((history_uint.clock BETWEEN $start AND $stop) AND (history_uint.itemid = '$1'));
eof`
echo $variable;
------------------------------------------------------------------
When I run the script AS ZABBIX USER in the shell, it works fine, it returns the query result, so I presume that has no permission problems.
zabbix@EUA-MIA-NAP-ZABBIX01-004:/etc/zabbix/externalscripts> ./last_week.sh 22496
15
But when I configure zabbix to run External Scripts, it wont work, and returns 0 value. I cant figure it out why this is happening.
My zabbix conf follows in the JPG file attached.
Please help.
Best Regards
Luis Fernando Laimer
Recently I was trying to create a script that gets the value of active calls one week behind.
My script looks like:
(Please disconsider the simplicity of the script, Im no bash expert)
#!/bin/bash
declare -i timestamp=`date +"%s"`;
let "timestamp=$timestamp - 604800";
let "timestamp=$timestamp - 4800";
let "start=$timestamp - 30";
let "stop=$timestamp + 30";
variable=`
mysql -sN -u root --password=password << eof
use zabbix;
select history_uint.value from history_uint where ((history_uint.clock BETWEEN $start AND $stop) AND (history_uint.itemid = '$1'));
eof`
echo $variable;
------------------------------------------------------------------
When I run the script AS ZABBIX USER in the shell, it works fine, it returns the query result, so I presume that has no permission problems.
zabbix@EUA-MIA-NAP-ZABBIX01-004:/etc/zabbix/externalscripts> ./last_week.sh 22496
15
But when I configure zabbix to run External Scripts, it wont work, and returns 0 value. I cant figure it out why this is happening.
My zabbix conf follows in the JPG file attached.
Please help.
Best Regards
Luis Fernando Laimer
Comment