Duplicating Graphs for Many Hosts

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

Moderators: Developers, Moderators

Post Reply
philovivero
Posts: 37
Joined: Mon Dec 12, 2005 2:27 pm
Location: San Francisco, USA

Duplicating Graphs for Many Hosts

Post by philovivero »

I have about 10 MySQL databases I want to monitor.

I installed the XML/PHP MySQL graphing bit from Berger at hkdashnetdotde, and it's good and all, but setting it up to monitor a single host takes maybe 10 minutes. Now I want to set it up for the other 9 hosts, and don't want to spend an hour and a half clicking my mouse.

So is there a way in Cacti to take everything for a host X (data sources, graph templates, etc) and do everything exactly the same way, but for host Y?

Also, I'd kind of like to change the graph definition, but again, the web interface is pretty time/click intensive. Looking at the XML files that represent the graph, it looks like there are a lot of very long hashes for something:

Code: Select all

<hash_1000066a8f533015198c049b1a191926eef0f2>
        <task_item_id>hash_0800067dd258e86254765e228a3069fbdb86b1</task_item_id>
        <color_id>7EE600</color_id>
        <graph_type_id>7</graph_type_id>
        <consolidation_function_id>1</consolidation_function_id>
        <cdef_id>0</cdef_id>
        <value></value>
        <gprint_id>hash_060006e9c43831e54eca8069317a2ce8c6f751</gprint_id>
        <text_format>Select</text_format>
        <hard_return></hard_return>
        <sequence>1</sequence>
</hash_1000066a8f533015198c049b1a191926eef0f2>
How to generate those hashes or graph_type_id and consolidation_function_id are not entirely clear. Is there some documentation about the meanings of this XML file in case I want to edit it directly? Alternatively, is there a more direct-to-data way of modifying the graph in Cacti (something that requires a lot less clicking, ie: has all fields on one page rather than across many pages, for example)?
power to the soul
belief to the people
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

FYI, the XML files are only for templates. You don't import/export them per hosts.

As for hashes, they are a way to identify elements in the database globally around the world.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
philovivero
Posts: 37
Joined: Mon Dec 12, 2005 2:27 pm
Location: San Francisco, USA

Post by philovivero »

rony wrote:FYI, the XML files are only for templates. You don't import/export them per hosts.
Indeed. So one XML file defines a graph of, say, 5 parameters with current, min, max, and average. I want to change it to, say, 8 other parameters with current, min, max, median, and average.

Then I want to use basically the same graph (colours and all) but use 8 different sources of data. So 99% of the XML file would remain unchanged.

I want to do this by editing the XML files if I can truly just edit 1% of the file, because it would save a lot of work.
As for hashes, they are a way to identify elements in the database globally around the world.
So I could just pick any unique string of characters and numbers?
power to the soul
belief to the people
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Unfortunatly it really doesn't work that way.

If you dive into the code, export.php and look at the includes and functions being called, you will see why this is.

When you export a template, it's not attached to a host. If it's truly a well designed template, then you should be able to create a host template including the data queries and graph templates that you want for those types of hosts. Then you can add your new device and then apply that host template. From there, you simple select the graphs you want to create for that host.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
tpe
Posts: 12
Joined: Tue Jul 26, 2005 1:08 pm

Creating a hash

Post by tpe »

ok, I'm trying to make some scripts to add some templates, data_sources and hosts. Can someone please direct me to how I can create a hash that appears valid to cacti?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Check out export.php....

And on that note, why would you be automating the adding of templates?
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

I'm more than happy to help either of you out in a more realtime situation. Easier to answer questions and help you understand the process.

I will be on IM and IRC later tonight around 7:00 PM CST.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
tpe
Posts: 12
Joined: Tue Jul 26, 2005 1:08 pm

Post by tpe »

I got a little ahead of myself. I need to add a bunch (~500) hosts and ~20 data sources per host. I think doing the host template, data template and graph template correctly could allieviate me from needing to add all the data sources, but the hosts are still a problem.

Thanks for the pointer to export.php
philovivero
Posts: 37
Joined: Mon Dec 12, 2005 2:27 pm
Location: San Francisco, USA

Maybe I got ahead of myself, too.

Post by philovivero »

Like TPE, I discovered how to make a host template with all the graphs I need and now the only thing I need to do for each host is enter a Cacti username/password about 10 times per host, all one one page, which is way less painful.

However, now I'm on to what appears to be a bug. When I do create the graphs, after entering all the data, it says:

Code: Select all

 + Created graph: dbsess01 - MySQL - Command statistics
+ Created graph: dbsess01 - MySQL - Connections
+ Created graph: dbsess01 - MySQL - Handler statistics
+ Created graph: dbsess01 - MySQL - QueryCache statistics
+ Created graph: dbsess01 - MySQL - Questions
+ Created graph: dbsess01 - MySQL - Thread statistics
+ Created graph: dbsess01 - MySQL - Traffic
But then, when I go to the device graph template, there is no graph. When I click the "Turn on graph debug mode", it says:

Code: Select all

ERROR: opening '/usr/pkg/share/httpd/htdocs/cacti/rra/dbsess01_select_672.rrd': No such file or directory
Sure enough, when I go to that directory, there is no rrd RRA file there for my machine (which I'm calling dbsess01). When I turn up logging level to DEBUG and try again, there are absolutely no lines logged in cacti.log whatsoever during this process. Looks like cacti.log is only for polling events, not for web events. So I checked the "Web RRD Graph Syntax" log option on the Settings page, and again went through it, and still no .rrd files, and no lines in the log about it.

I'm rather confused. Cacti has write access into that directory. There are hundreds of .rrd in there already. I suspect there is some sort of permissions or process problems, but without logs to look at, I'm perplexed about how to troubleshoot this...?

Help?
power to the soul
belief to the people
tpe
Posts: 12
Joined: Tue Jul 26, 2005 1:08 pm

Post by tpe »

I *may* have some guidance...

Cacti never creates the .rrd files. The poller creates them the next time it runs via cron. I've had strange situations where the poller has run four or five times before the rrds are created. Once they've been created everything works fine.

One suggestion. Go to Graph Management then to your specific graph. Turn debug on, them see if it complains about no rrd. Make sure it's looking in the place you expect.

Another suggestion. Go to the data sources, turn debug on, then examine the syntax of the rrdcreate. I've had situations where cacti is attempting to use invalid syntax to create the RRDs. You may need to manually create them.

I hope this helps.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

The files will not be created until the poller runs at least one time.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
philovivero
Posts: 37
Joined: Mon Dec 12, 2005 2:27 pm
Location: San Francisco, USA

.rrd's Creation Time

Post by philovivero »

Okay! Thanks for your help, guys. I think I'll just be patient. If the graphs haven't shown up in 10 or 15 minutes (I think my poller runs 300 seconds/interval), then I'll start fretting again.
power to the soul
belief to the people
philovivero
Posts: 37
Joined: Mon Dec 12, 2005 2:27 pm
Location: San Francisco, USA

Host Status: DOWN

Post by philovivero »

Okay, I have more data.

So, the RRD graph create commands are correct (thanks for the tip, TPE), and for most hosts the graphs are created on the next run of the Poller (thanks for the tip, Rony!)... but!

There are four hosts:

Code: Select all

dbback01   	Down  	192.168.xxx.xx  	0  	0  	0%  	
dbmstr01 	Down 	192.168.xxx.xx 	0 	0 	0% 	
dbsess01 	Down 	192.168.xxx.xx 	0 	0 	0% 	
dbslave01 	Down 	192.168.xxx.xx 	0.75 	3.59 	99.89%
These hosts are listed as "Down." Now I'm not sure what constitutes "down," because if I get onto the Cacti machine and ping the hosts, I can ping, and if I run the "mysql" command that the Poller is running ("mysql -ucacti -pCACTIPSWD -h 192.168.xxx.xxx"), then it can connect and do the commands the Poller needs to run.

The graphs for those hosts are not created. Google searches don't give me any joy (tried searching on "cacti host status down"). I'm going to go pore the documentation and logs and see what I can glean, but I don't remember seeing anything about this the first time around.

Thanks in advance for any pointers you might have.
power to the soul
belief to the people
tpe
Posts: 12
Joined: Tue Jul 26, 2005 1:08 pm

Post by tpe »

from what I've seen "Down" implies it's not responding to snmp queries.
philovivero
Posts: 37
Joined: Mon Dec 12, 2005 2:27 pm
Location: San Francisco, USA

Post by philovivero »

tpe wrote:from what I've seen "Down" implies it's not responding to snmp queries.
Aha! You are right. :D

The hosts that are up and have graphs created for them all show SNMP information, but the others show "SNMP error."

I'll go figure out why these machines are being SNMP-reluctant.
power to the soul
belief to the people
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests