I think this is very simple issue which can be easily resolved, but still I couldn't find the answer.
I want to build a graph based on a bash script output.
So I have 2 bash scripts that generate exactly the same output. Cacti can perfectly build a graph based on the script #1. But for script #2 Cacti poller generates an error message.
What is the reason for that?
SCRIPT #1 (the one that works)
------------------------------------
Script:
Script output:#!/bin/sh
echo 'kbps1:10 kbps10:10 kbps30:10'
SCRIPT #2 (the one that doesn't work)root@host:/usr/share/cacti/site/scripts# ./test.sh 10.1.1.1
kbps1:10 kbps10:10 kbps30:10
------------------------------------------
(This is a simple script that uses ssh to get some statistics from a FortiGate)
Script:
Script output:#!/bin/sh
ssh -i /home/user/.ssh/id_rsa -l user -q $1 < /usr/share/cacti/site/scripts/script.fg | grep network | awk '{printf "kbps1:" int($7) " kbps10:" int($12) " kbps30:" int($17) "\n"}'
File 'script.fg' contains some FortiGate commands.root@host:/usr/share/cacti/site/scripts# ./fg_network.sh 10.1.1.1
kbps1:341 kbps10:336 kbps30:323
The output looks exactly the same as for the script #1. But the Cacti poller complains that the result of the script is invalid:
PS. I've completed all steps from the Cacti troubleshooting manual but that didn't help.08/27/2015 01:30:02 PM - CMDPHP: Poller[0] Host[2] DS[137] WARNING: Result from CMD not valid. Partial Result: U
08/27/2015 01:30:02 PM - CMDPHP: Poller[0] Host[2] DS[137] CMD: /usr/share/cacti/site/scripts/fg_network.sh 10.1.1.1, output: U
08/27/2015 01:30:02 PM - CMDPHP: Poller[0] DEVEL: SQL Exec: "insert into poller_output (local_data_id, rrd_name, time, output) values (137, '', '2015-08-27 13:30:02', 'U')"
Thank you in advance!