one script feeding several graphs - solved

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Andy16
Posts: 10
Joined: Wed Sep 16, 2015 4:51 am

one script feeding several graphs - solved

Post by Andy16 »

Hi out there,

beeing new to cacti I got somehow lost...

I managed to do a scritp that queries a good set of data - 30 values in one shot.
Created a "data input method" for that.

Then I did a "data template", only using a subset of the values, built a graph on and it works fine.
Creating another data template on a diffrent set of variables works - but polling is done twice in parallel!
In my setup this must not happen!

So how to create several graphs from values of one script?
How many rrds will be created?

RTFM and a link is also appreciated :-)
thanks for help
Last edited by Andy16 on Wed Mar 16, 2016 8:46 am, edited 1 time in total.
silvertip257
Posts: 33
Joined: Sun Mar 25, 2012 12:22 pm

Re: one script feeding several graphs

Post by silvertip257 »

Andy16 wrote:Hi out there,

beeing new to cacti I got somehow lost...

I managed to do a scritp that queries a good set of data - 30 values in one shot.
Created a "data input method" for that.

Then I did a "data template", only using a subset of the values, built a graph on and it works fine.
Creating another data template on a diffrent set of variables works - but polling is done twice in parallel!
In my setup this must not happen!

So how to create several graphs from values of one script?
How many rrds will be created?

RTFM and a link is also appreciated :-)
thanks for help
Without your script, it's a bit hard to know for sure (but here goes my guess below).

I would suggest writing your script in a way that you can specify different data to be retrieved for each graph.
So hypothetically that item1-4 is only retrieved for Data Input Method#1 and item5-7 is only retrieved for Data Input Method #2, and so forth.
silvertip257
Andy16
Posts: 10
Joined: Wed Sep 16, 2015 4:51 am

Re: one script feeding several graphs

Post by Andy16 »

silvertip257 wrote: Without your script, it's a bit hard to know for sure (but here goes my guess below).
I think I missed the point - sorry for that.... and thanks for the fast reply! :D

script is doing quite a lot in logon, preprocessing and so on and cannot be run in parallel (only single user access)
Result is an output like
data1:123 data2:234 data3:345 data4:435 data5:354 data6:782 .............

In graph A I wanna show data1 and data2,
in graph B only data3 and data4
in graph C only data1 and data5 and data6

So script shall run once every 5 min, update one (or several) rrd files and graphs shall read data from the file(s)

How can I set that up?
thanks for your help
silvertip257
Posts: 33
Joined: Sun Mar 25, 2012 12:22 pm

Re: one script feeding several graphs

Post by silvertip257 »

Andy16 wrote:
silvertip257 wrote: Without your script, it's a bit hard to know for sure (but here goes my guess below).
I think I missed the point - sorry for that.... and thanks for the fast reply! :D

script is doing quite a lot in logon, preprocessing and so on and cannot be run in parallel (only single user access)
Result is an output like
data1:123 data2:234 data3:345 data4:435 data5:354 data6:782 .............

In graph A I wanna show data1 and data2,
in graph B only data3 and data4
in graph C only data1 and data5 and data6

So script shall run once every 5 min, update one (or several) rrd files and graphs shall read data from the file(s)

How can I set that up?
thanks for your help
I would configure your script so you pass a parameter (input string [0]) to tell your script which pieces of data to retrieve and print to stdout (for your Data Input Methods).

You would end up running your script 3 times, but it would retrieve smaller subsets of data.

Ex:
Input: a ... Output: data1:123 data2:234
Input: b ... Output: data3:345 data4:435
Input: c ... Output: data1:123 data5:354 data6:782

Or potentially have 4 Data Input Methods (and Data Templates) data1, data2, data3+data4, data5+data6

Data Input Method > Data Template > Data Source Item
(a single DT can contain multiple DSIs and a single RRA file is created per DT)

[ I checked and haven't done what you describe above... ]
Either way I suspect you will end up with duplicate data in different RRAs (with the 3 part method) regarding data1.
While even if you had data1 in its own DT (4 part method), I don't believe Cacti is smart enough to skip creating another data1 Data Source. This behavior would likely happen if you're creating Graph Templates, but not for one-off graphs where you reference existing Data Sources.


[0] http://docs.cacti.net/manual:087:3a_adv ... ut_methods
silvertip257
Andy16
Posts: 10
Joined: Wed Sep 16, 2015 4:51 am

Re: one script feeding several graphs

Post by Andy16 »

silvertip257 wrote: I don't believe Cacti is smart enough to skip creating another data1 Data Source.
:evil: grrr - so no way having a huge poller script and feed multipe graphs??? Graph : poller is a 1:1 relation?
Seems like I have to come up with a cache mechanism, running a minute before cacti and offering values to the multiple cacti pollers...
Andy16
Posts: 10
Joined: Wed Sep 16, 2015 4:51 am

Re: one script feeding several graphs

Post by Andy16 »

ok, that caching thing did the job...

script in crontab to run every 5 min:
- sleep 4 min
- query values and write to file

all data inputs grep from that file

works - thanks
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests