Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Tue Feb 19, 2019 8:07 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 140 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 10  Next
Author Message
 Post subject: Must have scripts !
PostPosted: Mon Feb 20, 2006 3:39 am 
Offline

Joined: Fri Feb 17, 2006 7:42 am
Posts: 40
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 !


Top
 Profile  
 
 Post subject: Issue with multiple data sources graph creation
PostPosted: Mon Feb 20, 2006 4:45 am 
Offline

Joined: Fri Feb 17, 2006 7:42 am
Posts: 40
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.

Top
 Profile  
 
 Post subject: Re: Issue with multiple data sources graph creation
PostPosted: Mon Feb 20, 2006 6:15 am 
Offline

Joined: Fri Feb 17, 2006 7:42 am
Posts: 40
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.


Top
 Profile  
 
 Post subject: Any plans to update add_device script to support snmpv3?
PostPosted: Sun Feb 26, 2006 3:23 am 
Offline

Joined: Mon Jul 11, 2005 7:10 pm
Posts: 28
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 : )


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 12, 2006 7:16 pm 
Offline

Joined: Wed Apr 12, 2006 7:11 pm
Posts: 1
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

_________________
Travis Morgan
http://bigfiber.net


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 19, 2006 10:26 am 
Offline

Joined: Fri Apr 14, 2006 10:01 am
Posts: 1
Location: Grenoble - FRANCE
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.


Top
 Profile  
 
 Post subject: Awesome!
PostPosted: Thu Apr 20, 2006 10:25 am 
Offline
Cacti User
User avatar

Joined: Tue Mar 26, 2002 1:25 pm
Posts: 61
Location: Morrisville, NC
Thank you so much for writing this.
I just imported 1k devices perfectly!
On to adding graphs now :-)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 23, 2006 1:54 am 
Offline
Cacti User

Joined: Sun Apr 16, 2006 2:03 am
Posts: 68
How can i use it in windows??


Top
 Profile  
 
 Post subject: patch
PostPosted: Mon Apr 24, 2006 8:23 am 
Offline

Joined: Mon Apr 24, 2006 8:16 am
Posts: 3
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


Top
 Profile  
 
 Post subject: A wrapper for Bradley's scripts
PostPosted: Thu May 04, 2006 4:03 am 
Offline

Joined: Fri Apr 21, 2006 5:32 am
Posts: 4
Location: London. UK
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.


Attachments:
File comment: Feel free to use/modify this wrapper script for your own use. Do share any improvements though!
import.zip [945 Bytes]
Downloaded 1250 times
Top
 Profile  
 
 Post subject:
PostPosted: Mon May 08, 2006 10:50 am 
Offline

Joined: Mon May 08, 2006 10:44 am
Posts: 2
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 :cry:

Thanks a lot,
Schlabschi


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 16, 2006 7:01 am 
Offline
Cacti User

Joined: Mon Nov 24, 2003 10:22 am
Posts: 91
Location: Hungary
Hi,

Nice work! Just one question.
How can I add a grap with space in its ifDescr like "ATM2/0.1007-aal5 layer"?

thx

_________________
Sini


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 09, 2006 4:28 am 
Offline
Cacti User

Joined: Sun Aug 28, 2005 12:51 pm
Posts: 137
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 22, 2006 6:35 am 
Offline

Joined: Fri Apr 21, 2006 3:32 am
Posts: 6
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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 26, 2006 8:24 pm 
Offline
Cacti User
User avatar

Joined: Tue Aug 24, 2004 5:02 pm
Posts: 371
Location: San Francisco, CA
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?

_________________
FreeBSD/RHEL
cacti-0.8.7i, spine 0.8.7i, PIA 3.1+boost 5.1
MySQL 5.5/InnoDB
RRDtool 1.2.27, PHP 5.1.6


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 140 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 10  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group