I have PRTG configured to retrieve a value from a MYSQL database. The script is shown below.
It works if the value is manually set the value.
mysql -h 127.0.0.1 call_center < test.sql > qu qc=0 qc=$(tail --lines=1 qu) echo "0:0:message"
If I use the variable $qc to set the value it doesn't work and I get (valor_config:message ) (code: PE129) in the PRTG sensor page.
mysql -h 127.0.0.1 call_center < test.sql > qu qc=0 qc=$(tail --lines=1 qu) echo "0:$qc:message"
Looking at both methods in the Linux terminal I get the same result. Why does the manual one work whereas the variable one doesn't?
[root@localhost scripts]# ./myscript 0:0:message test.sql use call_center; SELECT COUNT(status) FROM call_entry where status = 'en-cola' limit 1;
username and password are stored in my.cnf
I'm running Centos 7 with Server version: 5.5.50-MariaDB .
Add comment