Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Data Source Import Script for NON-CACTI created RRD's

 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
o019676



Joined: 07 Apr 2007
Posts: 7

PostPosted: Sun Apr 08, 2007 12:35 am    Post subject: Data Source Import Script for NON-CACTI created RRD's Reply with quote

My first attemp at a contribution.

BACKUP YOUR CACTI DATABASE FIRST!!!!
THIS IS BETA CODE FOR NOW!!!!!
TREAT IT AS SO!!!

Feel free to email me any changes you might want or bugs in the script.
I will update accordingly and repost!!

webwillow@thewebwillow.com
donald.t.gullett@jpmchase.com

standby for a add_graph script for adding graphs for these as well!!

Make a data template for your RRD's that you want to mass import.
YOU MUST HAVE A DATA TEMPLATE FIRST...VERY IMPORTANT!!

BIG NOTE!! you can only make one data source per host per data template, i made this part so that i dont accidently create the data source twice. and so i can do a mass import and if the datasource for that host and template is already created, it will skip on to the next one. I run the script every morning.

download this script (bash script)

gunzip -dc <filename>|tar xvf -

chmod 755 add_datasource.sh

edit the global file and add your configuration (i.e. where mysql is etc)
i use nagios with this and other scripts to import nagios hosts that use the global file, remove those if you wish, shouldnt hurt it if you leave them there.

use the -h or --help option to get how to use the script.
./add_datasource.sh --list
note the number of the data template you want
./add_datasource.sh --hostlist
note the number of the host you want
note the location of your rrd file
./add_datasource.sh -D <data template number> -H <hostid> --rdd <rrd file>

example:

./add_datasource.sh -D 61 -H 111 -rrd /usr/local/nagios/nagiosgraph/rrd/gti0l012_ROOT_disk.rrd

also can be used to list host id numbers, data template id's and existing data source id's with the correct option

so far works great for me!!!



add_datasource.tar.gz
 Description:

Download
 Filename:  add_datasource.tar.gz
 Filesize:  2.01 KB
 Downloaded:  167 Time(s)

Back to top
o019676



Joined: 07 Apr 2007
Posts: 7

PostPosted: Mon Apr 09, 2007 10:00 pm    Post subject: Addition Scipts Reply with quote

NOTE: ALWAYS BACKUP YOUR CACTI DATABASE BEFORE USING THIS SCRIPT!!!!!!!

THIS IS BETA SCRIPT AND SHOULD BE USED AS SO!!!!!!

Attached file has an addition script to the above posted file.

Use one file to add the datasource and the other to add the graph to the datasource.

You must have a data template and a graph template created in cacti itself for the adds to work.

Also make sure that you make the data template correctly with the template pointing to the datasource cdef's (i think thats the correct way to say it).

The script dredges the mysql database for the templates to properly add the datasource and the graphs properly.

I just ran 10 test of adding over 1000 graphs that are attached to nagios created RRD's via nagiosgraph with a seperate script which i will provide later. I would include it here as well but some finishing touches and much needed input from other users are need before i post the code with the nagios script.

Always use -h or --help with this script on the command line to get help on the use.

Just like the other script, you must provide a graph template number, host id, and a datasource it.

try using --list --datsourcelist or --hostlist to get the info you need.

GOOD LUCK!!!!

Working great for me so far!



ds_graphs.zip
 Description:

Download
 Filename:  ds_graphs.zip
 Filesize:  4.65 KB
 Downloaded:  140 Time(s)

Back to top
o019676



Joined: 07 Apr 2007
Posts: 7

PostPosted: Wed Apr 11, 2007 7:30 am    Post subject: File Change Reply with quote

Had to edit the above global file.

same contents with slight change to the global file.

cant upload files with internal passwords...whoops
Back to top
ruben



Joined: 12 Apr 2007
Posts: 9

PostPosted: Thu Apr 12, 2007 9:32 am    Post subject: Reply with quote

I haven't gotten around to play with your scripts yet. But I do want to thank you in advance for the effort.
The last few days I spend most my time on creating and auto-updating a 'large' sum of RRD files (8 Class C subnets, 1 RRD per IP). Since I didn't feel like creating 2000+ data sources and yet another 2000+ graphs, these scripts will most likely be of much help to me.
Back to top
o019676



Joined: 07 Apr 2007
Posts: 7

PostPosted: Tue Jun 05, 2007 10:55 pm    Post subject: Has Anyone used this Yet? Reply with quote

Just wondering if i could get some feedback from anyone else who has used it?
Back to top
ruben



Joined: 12 Apr 2007
Posts: 9

PostPosted: Wed Jun 06, 2007 2:19 am    Post subject: Re: Has Anyone used this Yet? Reply with quote

o019676 wrote:
Just wondering if i could get some feedback from anyone else who has used it?


I haven't looked at it for quite some time now. But what I do recall is that your script were less suited for my case then I had hoped for. I don't recall what the issues were exactly, but I think it came down to the fact that the graphs I want to generate are "more unique" than your script can handle. I'll see if I can take another stab at it today and provide more info.
Back to top
fiksve



Joined: 14 Jan 2007
Posts: 5

PostPosted: Sat Aug 16, 2008 10:41 pm    Post subject: Great Reply with quote

Exactly what I needed! This is a great tool for us who dont use the cacti poller system, but rely on specialized mechanisms to generate the rrds -- Thanks!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group