Multiple graphs from one data source
Moderators: Developers, Moderators
Multiple graphs from one data source
Hello
Is it possible , in any way, to create one data source, that updates regularly, and then create multiple graphs based on this data.
Current situation:
I have a script that fetches multiple values , let say a-f
This script is defined in data input method "get my data"
I want to create 2 graphs, fist with values a,b and the second with c,d,f
Now, when i define 2 graphs, cacti polls the data twice and creates 2 data sources.
Thanks
Is it possible , in any way, to create one data source, that updates regularly, and then create multiple graphs based on this data.
Current situation:
I have a script that fetches multiple values , let say a-f
This script is defined in data input method "get my data"
I want to create 2 graphs, fist with values a,b and the second with c,d,f
Now, when i define 2 graphs, cacti polls the data twice and creates 2 data sources.
Thanks
Re:
Same problem, I was thinking it was a mistake from me somewhere...
So if the file was modified less than 2 minutes ago, the remote shell is not executed and instead the cached result is used.
I think this is quite OK because the hit on the poller is minimal (local shell script invocation).
I could not get this to work but I ended it doing a workaround in my shell script to cache the result if it was executed less than 2 minutes ago. Here is how my script looks now. Note: first create a directory called cache in the script directory.gandalf wrote:That's a known drawback, not considered to be a bug.
You may create the first graph "the ussual way" from "Create Graphs for this Host". The second one has to be created from Graph Management. You will be able to refer the required data sources to those already created by the first graph.
R.
Code: Select all
TARGETSERVER=$1
THISDIR=/opt/cacti-0.8.8a/scripts
USR=<...>
#we need to cache the response because cacti will execute the script once per graph based on the data source
#this is a limitation of cacti
FNAME=query_accesslog_${TARGETSERVER}
find ${THISDIR}/cache -name "$FNAME" -mmin -2 | grep -q $FNAME
if [ $? -eq 1 ] ; then
#cached result is too old, we need to run again the query
ssh ${USR}@$TARGETSERVER '/usr/local/bin/query_accesslog.sh' > ${THISDIR}/cache/${FNAME}
fi
cat ${THISDIR}/cache/${FNAME}
I think this is quite OK because the hit on the poller is minimal (local shell script invocation).
Re: Multiple graphs from one data source
since it is now over a year on this thread, is there any updates? i got one datasource with multiuple stuff, but because the data is not all in the same unit, so i want to make separate graphs for each unit type (weather in my case, so degrees C, km/h, mm, kPa, etc)
Re: Multiple graphs from one data source
Not in an automated way through a template. You have to create your data template / data source to store the data (the graph values). Then create graphs manually (via a graph template if you'd like) and point the various graph item fields at the same data source (different data source items). It's a pain, but I'm pretty sure there still isn't any other way. The caching of results like someone mentioned above is a good way to overcome any overhead associated with effectively polling the same data over and over again.
Re: Multiple graphs from one data source
Hi,
I had the same problem and haven't found any solution so I've decided to create my own CLI command. I share it with you and would be glad if you want to include it with Cacti.
Hope it can help.
I had the same problem and haven't found any solution so I've decided to create my own CLI command. I share it with you and would be glad if you want to include it with Cacti.
Hope it can help.
- Attachments
-
- add_extragraph.zip
- (1.88 KiB) Downloaded 187 times
Who is online
Users browsing this forum: No registered users and 4 guests