Applying data sources to multiple hosts

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

Moderators: Developers, Moderators

Post Reply
assie
Posts: 11
Joined: Sat Jul 09, 2011 1:09 pm

Applying data sources to multiple hosts

Post by assie »

Hi,

Iv got a graph template that needs 2 datasources. It uses a custom data input method (NRPE Disk stats, that parses /proc/diskstats). From that input method, it needs 2 data sources,
reads and writes. OK, so iv got a graph template in place to apply to lots of hosts, but i still need to add the 2 data sources each time. Can this be automated somehow? Iv got too many
hosts that needs em to do it manually.

Thanks in advance,

Assie.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Applying data sources to multiple hosts

Post by gandalf »

Good news: this can be done.
Please see 1st link of my sig to learn the standard procedure to develop different kinds of custom resources
R.
assie
Posts: 11
Joined: Sat Jul 09, 2011 1:09 pm

Re: Applying data sources to multiple hosts

Post by assie »

gandalf wrote:Good news: this can be done.
Please see 1st link of my sig to learn the standard procedure to develop different kinds of custom resources
R.
Ok, thanks, ill start reading! :oops:
assie
Posts: 11
Joined: Sat Jul 09, 2011 1:09 pm

Re: Applying data sources to multiple hosts

Post by assie »

gandalf wrote:Good news: this can be done.
Please see 1st link of my sig to learn the standard procedure to develop different kinds of custom resources
R.

Hi, i have red the documentation but cound not find what I was looking for. I started to check out the cli scripts and actually found some usefull stuff

php ./add_graphs.php --graph-type=cg --graph-template-id=184 --host-id=235 --graph-title="A HOSTNAME /dev/sda combined count" --input-fields=128:disk=sda

Now for one, i could find the graph-template id using the --list-graph-templates, then find the id of the template. But there is no such option to find the date input template,
I had to go into MySQL and select * from data_template; to get the ID, why cant the script do this too?

second, when I change the title in the previous line from /dev/sda to /dev/sdb and change disk=sda to disk=sdb, it refused to create the graph:

NOTE: Not Adding Graph - this graph already exists - graph-id: (10174) - data-source-id: (12586)

Now one would think with a new title, the script would figure this is another graph and not an existing one... any hints?

Thanks,

Assie.
assie
Posts: 11
Joined: Sat Jul 09, 2011 1:09 pm

Re: Applying data sources to multiple hosts

Post by assie »

Can anyone help me out? any info at all?

Thanks..
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Applying data sources to multiple hosts

Post by gandalf »

Then I suppose that I did not understand what you are aiming at. Can you please provide some more words about your goals?
R.
User avatar
PSI
Posts: 4
Joined: Sun Jul 17, 2011 9:02 am

Re: Applying data sources to multiple hosts

Post by PSI »

I will use this topic as I have similar problem.

I would like to add graphs for many host as it is described here: http://www.pmacct.net/docs/cacti.html

As you can see there are 2 custom data sources per each graph.

I thought I would use directly the CLI add_graphs.php as there is no add_data_sources.php script.

Based on that description I tried: php -q add_graphs.php --graph-type=cg --host-id=2 --graph-template-id=63 --input-fields="74:aggregation=dst_host 74:adata=192.168.55.55 74:pipe=/var/run/pmacct-in.pipe" --force

This adds only one data source (unnamed), I didn't find any other method for putting 2 datasources there.. I didn't find anywhere any CLI method for creating datasources. Do you know any such examples?

My Cacti version: 0.8.7g
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Applying data sources to multiple hosts

Post by gandalf »

Please post the exported graph template (including dependencies) here. Then I'll try to reproduce.
This then is classified as a cli issue.
In fact, the add_graphs should create ALL related data sources along with the graph. That's why we don't have an add_data_sources script. But add_graphs seems to fail (or there is some different issue here).
In case you prefer a more automated way of creating graphs (and data sources), please see AUTOM8 plugin
R.
User avatar
PSI
Posts: 4
Joined: Sun Jul 17, 2011 9:02 am

Re: Applying data sources to multiple hosts

Post by PSI »

Thank you for the quick response :) I'm having troubles posting the template by the attachment upload ( "The upload was rejected because the uploaded file was identified as a possible attack vector.")

So the link to the file is: http://www.nowatel.com/public/upload/ca ... _graph.xml
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Applying data sources to multiple hosts

Post by gandalf »

One issue is, that both graph and data template require a title. So I unchecked the option in both templates and applied your add_graphs.php command (both numbers for the templates had to be changed, of course). Then, the graph and data source were created.
But I did not understand the graph template really. You defined 3 graph input items, were the data template only provides a single one. How come?
R.
User avatar
PSI
Posts: 4
Joined: Sun Jul 17, 2011 9:02 am

Re: Applying data sources to multiple hosts

Post by PSI »

The data template uses 3 custom data inputs (Actual Data (IP number of the monitored host), Aggregation string (src or dst packets) and Pipe file) and upon that 3 custom data inputs we get one output - throughput of the host in one direction (upload or download). So to build the graph template we need to generate 2 Data Sources (one for upload and one for download). To understand what i'm saying you should look at the 3 last paragraphs of the http://www.pmacct.net/docs/cacti.html. I tried to build that graph by cli, but my generated graph is only able to be build with one datasource instead of two (so i get a graph in one direction - upload or download).
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Re: Applying data sources to multiple hosts

Post by gandalf »

And when creating such a graph manually, all works as expected?
R.
assie
Posts: 11
Joined: Sat Jul 09, 2011 1:09 pm

Re: Applying data sources to multiple hosts

Post by assie »

gandalf wrote:Then I suppose that I did not understand what you are aiming at. Can you please provide some more words about your goals?
R.
Sorry for the very late reply, but iv been busy on other little projects. For now I solved my cli command line issue by using 2 different graph templates, both being identical but having
different id's in the database, not sure what the other option is/was.

I now have a diff question, but I will make a new post for that.

Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest