I’ve defined a script data query to graph some values taken from several text files.
This is the script that I use (full permission):
#!/bin/sh
file="/home/opred/ip_sla_statistics"
n_entries="/home/opred/ip_sla_statistics_entries"
f_tags="/home/opred/ip_sla_statistics_tags"
tags=$(more $f_tags | grep Tag | sed 's/Tag: //g')
rtt_min=$(more $file | grep "RTT Min" | sed 's/^.*:\s//g' | sed 's/\sms$//g' | cut -d "/" -f 1);
n=1
while read index
do
c=$(echo $index)!$(echo $tags | cut -d " " -f $n)!$(echo $rtt_min | cut -d " " -f $n)
# Without arguments returns indexes
if [ $# -eq 0 ]
then
echo $c | cut -d "!" -f 1
# Processing index query
elif [ "$1" = "index" ]
then
echo $(echo $c | cut -d "!" -f 1)
# Procesamos query request index
elif [ "$1" = "query" ] && [ "$2" = "index" ]
then
echo $(echo $c | cut -d "!" -f 1)!$(echo $c | cut -d "!" -f 1)
# Procesamos query request tag
elif [ "$1" = "query" ] && [ "$2" = "tag" ]
then
echo $(echo $c | cut -d "!" -f 1)!$(echo $c | cut -d "!" -f 2)
# Procesamos query request rtt_min
elif [ "$1" = "query" ] && [ "$2" = "rtt_min" ]
then
echo $(echo $c | cut -d "!" -f 1)!$(echo $c | cut -d "!" -f 3)
# Procesamos get function index
elif [ "$1" = "get" ] && [ "$2" = "index" ]
then
out=$(echo $c | cut -d "!" -f 1 | grep $3)
echo -n $out
# Procesamos get function tag
elif [ "$1" = "get" ] && [ "$2" = "tag" ]
then
out=$(echo -n $c | grep $3 | cut -d "!" -f 2)
echo -n $out
# Procesamos get function rtt_min
elif [ "$1" = "get" ] && [ "$2" = "rtt_min" ]
then
out=$(echo -n $c | grep $3 | cut -d "!" -f 3)
echo -n $out
else
echo "No condition"
fi
n=`expr $n + 1`
done < $n_entries
This is the XML file:
<interface>
<name>Get RTT/Jitter</name>
<description>Obtain mínimum, máximum and average values of RTT and Jitter</description>
<script_path>sh |path_cacti|/scripts/procesa_ip_sla_statistics.sh</script_path>
<arg_index>index</arg_index>
<arg_query>query</arg_query>
<arg_get>get</arg_get>
<output_delimeter>!</output_delimeter>
<index_order>index</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<entryNumber>
<name>Index</name>
<direction>input</direction>
<query_name>index</query_name>
</entryNumber>
<entryTag>
<name>Tag</name>
<direction>input</direction>
<query_name>tag</query_name>
</entryTag>
<rttMin>
<name>RTTMin</name>
<direction>output</direction>
<query_name>rtt_min</query_name>
</rttMin>
</fields>
</interface>
At the images attached you will find the data template, graph template, association between graph and data query and the problem.
Cacti doesn’t find the RRD file. Perhaps a clue could be that I add to the title query_entryTag and it isn’t translated by its original value.
I have tested my script with query and get options and works fine out of Cacti. I checked the permissions and I think they are ok.
Any ideas to debug this trouble?
Script data query indexed. No RRD file.
Moderators: Developers, Moderators
Script data query indexed. No RRD file.
- Attachments
-
- problem.png (49.08 KiB) Viewed 1204 times
-
- graph_asso.png (145.42 KiB) Viewed 1204 times
-
- query_data.png (236.89 KiB) Viewed 1204 times
Re: Script data query indexed. No RRD file.
At first look, if you aren't getting an RRD file created then your script probably isn't pulling the data correctly. What's a debug run of the poller tell you? Pay particular attention to the piece where it's running your scripts and if it's returning data properly.
-Dan
-Dan
Please mark the topic solved if this resolves your problem.
Re: Script data query indexed. No RRD file.
Yes, I focus on the script. I'm changing its structure. There isn't any log or debug message to find out the trouble.artagel wrote:At first look, if you aren't getting an RRD file created then your script probably isn't pulling the data correctly. What's a debug run of the poller tell you? Pay particular attention to the piece where it's running your scripts and if it's returning data properly.
-Dan
Re: Script data query indexed. No RRD file.
I've modified the script and whereas I've checked that my script is not run by Cacti. I added an instruction to write "Running..." in a file when the script starts but it never happens (In spite of declaring the graph). Any ideas? Thanks.
Re: Script data query indexed. No RRD file.
It seems to me that your script isn't being run by cacti.
Can you explain exactly how you implemented the script in cacti?
Did you follow these instructions?
http://docs.cacti.net/manual:088:3a_adv ... with_cacti
Can you explain exactly how you implemented the script in cacti?
Did you follow these instructions?
http://docs.cacti.net/manual:088:3a_adv ... with_cacti
Please mark the topic solved if this resolves your problem.
Re: Script data query indexed. No RRD file.
Thanks for answering. I'm trying to implement a data query cause the data that I need to gather is indexed. The walkthrough explained in the link that you point out is about data input methods. I do think that Cacti is not running my script. I have translated my script to PHP but the result is exactly the same. Any ideas?artagel wrote:It seems to me that your script isn't being run by cacti.
Can you explain exactly how you implemented the script in cacti?
Did you follow these instructions?
http://docs.cacti.net/manual:088:3a_adv ... with_cacti
Re: Script data query indexed. No RRD file.
I have followed this walkthrough step by step:opred wrote:Thanks for answering. I'm trying to implement a data query cause the data that I need to gather is indexed. The walkthrough explained in the link that you point out is about data input methods. I do think that Cacti is not running my script. I have translated my script to PHP but the result is exactly the same. Any ideas?artagel wrote:It seems to me that your script isn't being run by cacti.
Can you explain exactly how you implemented the script in cacti?
Did you follow these instructions?
http://docs.cacti.net/manual:088:3a_adv ... with_cacti
http://docs.cacti.net/manual:087:3a_adv ... alkthrough
Who is online
Users browsing this forum: No registered users and 27 guests