|
|
| Author |
Message |
ymartin59
Joined: 17 Feb 2006 Posts: 40
|
Posted: Mon Feb 20, 2006 3:39 am Post subject: Must have scripts ! |
|
|
That script set is wonderful and powerful. And I do not find them so "quick and dirty".
I really think that scripts must be included in cacti !
|
|
| Back to top |
|
 |
ymartin59
Joined: 17 Feb 2006 Posts: 40
|
Posted: Mon Feb 20, 2006 4:45 am Post subject: Issue with multiple data sources graph creation |
|
|
Hello,
I'm trying to create "ucd/net Available Disk Space" with the command:
add_graphs.php --graph-type cg --graph-template-id 3 --host-id 8
--snmp-query-id 2 --snmp-query-type-id 6 --snmp-field dskPath --snmp-value "/"
--graph-title "grenade - Disk Space - /"
Where:
Known Graph Templates:(id, name)
3 ucd/net - Available Disk Space
Known SNMP Queries:(id, name)
2 ucd/net - Get Monitored Partitions
Known SNMP Query Types:(id, name)
6 Available/Used Disk Space
Two datasources are created for the graph but their custom data fields (index type, index value and output type ID) are not set automatically - in addition, the datasource name is "|host_description| - Hard Drive Space" instead of "|host_description| - Partion - |query_dskDevice|"
Last edited by ymartin59 on Mon Feb 20, 2006 6:17 am; edited 1 time in total |
|
| Back to top |
|
 |
ymartin59
Joined: 17 Feb 2006 Posts: 40
|
Posted: Mon Feb 20, 2006 6:15 am Post subject: Re: Issue with multiple data sources graph creation |
|
|
| ymartin59 wrote: | I'm trying to create "ucd/net Available Disk Space" with the command:
add_graphs.php --graph-type cg --graph-template-id 3 --host-id 8
--snmp-query-id 2 --snmp-query-type-id 6 --snmp-field dskPath --snmp-value "/"
--graph-title "grenade - Disk Space - /"
|
Sorry, I made a big mistake... graph-type must be 'ds' !! It works perfectly.
|
|
| Back to top |
|
 |
tclark
Joined: 11 Jul 2005 Posts: 26
|
Posted: Sun Feb 26, 2006 3:23 am Post subject: Any plans to update add_device script to support snmpv3? |
|
|
The current version of cacti only supports AuthNoPriv. In the environment I support, we enforced an AuthPriv snmpv3 policy on our servers. To enable cacti to work properly, an update to $auth_snmp in ./lib/snmp.php was done. The updated syntax for $auth_snmp now looks like this.
$snmp_auth = "-u $username -l authPriv -a MD5 -A $password -x DES -X $password"; /* v3 - username/password */
It would be great to be able to use some of these scripts to save work : )
|
|
| Back to top |
|
 |
imbezol
Joined: 12 Apr 2006 Posts: 1
|
Posted: Wed Apr 12, 2006 7:16 pm Post subject: |
|
|
This patch adds the ability for add_graphs.php to tell if a graph exists already even if the type is cg.
| Code: | --- add_graphs.php Tue Dec 13 05:53:46 2005
+++ add_graphs.php.new Wed Apr 12 18:06:02 2006
@@ -245,6 +245,23 @@
if ($graph_type == "cg")
{
$empty = array(); /* Suggested Values are not been implemented */
+
+ $existsAlready = db_fetch_cell("select id from graph_local where graph_template_id = $templateId AND host_id = $hostId");
+ if (isset($existsAlready) && $existsAlready > 0)
+ {
+ if ($graphTitle != "")
+ {
+ db_execute("update graph_templates_graph set title = \"$graphTitle\" where local_graph_id = $existsAlready");
+ update_graph_title_cache($existsAlready);
+ }
+ $dataSourceId = db_fetch_cell("SELECT DISTINCT data_template_rrd.local_data_id
+ FROM graph_templates_item, data_template_rrd
+ WHERE graph_templates_item.local_graph_id = " . $existsAlready .
+ " AND graph_templates_item.task_item_id = data_template_rrd.id");
+ echo "Not Adding Graph - this graph already exists - graph-id: ($existsAlready) - data-source-id: ($dataSourceId)\n";
+ return(1);
+ }
+
$returnArray = create_complete_graph_from_template($templateId, $hostId, "", $empty);
}
|
Save this to add_graphs.php.patch and run
| Code: | | patch -p0 < add_graphs.php.patch |
|
|
| Back to top |
|
 |
deltaforce
Joined: 14 Apr 2006 Posts: 1 Location: Grenoble - FRANCE
|
Posted: Wed Apr 19, 2006 10:26 am Post subject: |
|
|
About add_tree.php, some functions weren't implemented like --list-trees ; --list-nodes...
Does somebody know if these scripts are finished today ? (I'm triing to complete them, but it doesn't work).
Thank you.
|
|
| Back to top |
|
 |
cdukes Cacti User
Joined: 26 Mar 2002 Posts: 54 Location: Tampa, FL
|
Posted: Thu Apr 20, 2006 10:25 am Post subject: Awesome! |
|
|
Thank you so much for writing this.
I just imported 1k devices perfectly!
On to adding graphs now
|
|
| Back to top |
|
 |
manaf Cacti User
Joined: 16 Apr 2006 Posts: 50
|
Posted: Sun Apr 23, 2006 1:54 am Post subject: |
|
|
| How can i use it in windows??
|
|
| Back to top |
|
 |
shadowk
Joined: 24 Apr 2006 Posts: 3
|
Posted: Mon Apr 24, 2006 8:23 am Post subject: patch |
|
|
Here is a patch to prevent adding hosts to the graph tree if they are in the specified tree already.
| Code: |
--- add_tree.php Fri Apr 21 16:44:38 2006
+++ add_tree.php.new Fri Apr 21 17:29:35 2006
@@ -208,6 +208,12 @@
$rra_id = 0;
$name = '';
+ $hostNodeExists = db_fetch_cell("SELECT id FROM graph_tree_items WHERE graph_tree_id = $treeId AND host_id = $hostId");
+ if (isset($hostNodeExists))
+ {
+ echo "Not adding host, host-id ($hostId) is already in graph tree ($treeId)\n";
+ return 1;
+ }
if (!isset($hosts[$hostId]))
{
printf("No such host-id (%s) exists. Try --list-hosts\n", $hostId);
|
Save this to add_tree.php.patch and run:
| Code: |
patch -p0 < add_tree.php.patch
|
Andrew
|
|
| Back to top |
|
 |
stutz
Joined: 21 Apr 2006 Posts: 4 Location: London. UK
|
Posted: Thu May 04, 2006 4:03 am Post subject: A wrapper for Bradley's scripts |
|
|
Firstly thanks to Bradley et al for the php import scripts. I have written my first ever script (so don't be to harsh - comments for improvements appreciated!) to successfully transfer 1500 devices from CastleRock SNMPc to Cacti. This can be modified to read in pretty much any CSV file and populate Cacti with the Tree, Devices and Graphs all asociated with the relevant Nodes.
One question I have is when creating a CG graph, is there any way to populate the custom fields?
For example for a graph 'Host Availability' in the 'Data Sources' menu in the 'Supplemental Data Template Data' section is a 'Custom Data' field for 'IP Address'. At the moment I have to manually add the address for each device.
| Description: |
| Feel free to use/modify this wrapper script for your own use. Do share any improvements though! |
|
 Download |
| Filename: |
import.zip |
| Filesize: |
945 Bytes |
| Downloaded: |
731 Time(s) |
|
|
| Back to top |
|
 |
schlabschi
Joined: 08 May 2006 Posts: 2
|
Posted: Mon May 08, 2006 10:50 am Post subject: |
|
|
Awesom scripts! Really saved me a lot of work.
But I have the same problem as "stutz" above: Can someone who is smarter in scripting than me provide a way to populate the custom fields like ip address?
I also have to put it in by hand for over 1500 entries
Thanks a lot,
Schlabschi
|
|
| Back to top |
|
 |
sini Cacti User
Joined: 24 Nov 2003 Posts: 55 Location: Hungary
|
Posted: Tue May 16, 2006 7:01 am Post subject: |
|
|
Hi,
Nice work! Just one question.
How can I add a grap with space in its ifDescr like "ATM2/0.1007-aal5 layer"?
thx
|
|
| Back to top |
|
 |
kanada Cacti User
Joined: 28 Aug 2005 Posts: 125
|
Posted: Fri Jun 09, 2006 4:28 am Post subject: |
|
|
I have in logs some errors when i try add to sql var with speed interface.
CMDPHP: Poller[0] ERROR: SQL Exec Failed "update data_template_data set rrd_maximum='|query_ifSpeed|' where local_data_id=8787"
any ideas?
Thanks.
|
|
| Back to top |
|
 |
jbajc
Joined: 21 Apr 2006 Posts: 6
|
Posted: Thu Jun 22, 2006 6:35 am Post subject: |
|
|
Hello,
I have a problem with script add_graphs.php. The script seems to be working properly if I use cmd.php as a poller. If I use cactid it doesn't create any new rrds.
Have any ideas?
Tnx for reply
Janko
|
|
| Back to top |
|
 |
gninja Cacti User
Joined: 24 Aug 2004 Posts: 293 Location: San Francisco, CA
|
Posted: Mon Jun 26, 2006 8:24 pm Post subject: |
|
|
| I'm having a problem with this.. It doesn't seem to execute the queries properly when setting up. If I add a host with snmp disk graphs, when I go into the device, instead of the mount points, I see the mount numbers... Any way to fix that?
|
|
| Back to top |
|
 |
|