Quick and dirty script to add devices to cacti
Moderators: Developers, Moderators
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Please post output of You may scratch confidential information
Reinhard
Code: Select all
php -q add_tree.php --list-nodes --tree-id=200
Reinhard
the problem is that if you have lots of ds then you need to add some indexes to your tables, else it would take hours to add a device into cacti ...
becouse some rows from this select
which is in api_automation_tools.php are not indexed.
becouse some rows from this select
Code: Select all
"SELECT DISTINCT
data_input_fields.data_name AS `name`,
data_input_fields.name AS `description`,
data_input_data.value AS `default`,
data_template_data.data_template_id,
data_input_fields.id AS `data_input_field_id`
FROM data_input_data
INNER JOIN (((data_template_rrd
INNER JOIN (graph_templates
INNER JOIN graph_templates_item
ON graph_templates.id = graph_templates_item.graph_template_id)
ON data_template_rrd.id = graph_templates_item.task_item_id)
INNER JOIN data_template_data
ON data_template_rrd.data_template_id=data_template_data.data_template_id)
INNER JOIN data_input_fields
ON data_template_data.data_input_id=data_input_fields.data_input_id)
ON (data_input_data.data_template_data_id = data_template_data.id)
AND (data_input_data.data_input_field_id = data_input_fields.id)
WHERE (((graph_templates.id)=$templateId)
AND ((data_input_data.t_value)='on')
AND ((data_input_fields.input_output)='in'))"
here is a little script in perl to add a cisco router/switch in cacti using the php scripts from cli directory, it currently add only fastethernet , gigabit , tenge and portchannels interfaces, if anybody needs more let me know ...
rename cisco.pl.txt to cisco.pl, move it to cli/
run ./cisco.pl device_name ip_address
read the comments...
rename cisco.pl.txt to cisco.pl, move it to cli/
run ./cisco.pl device_name ip_address
read the comments...
- Attachments
-
- cisco.pl.txt
- (15.46 KiB) Downloaded 599 times
-
- Posts: 6
- Joined: Mon Jul 02, 2007 8:19 pm
- Contact:
ds graphs are not updating...
hi,
im still having a hard time figuring out why does my ds graphs(interface traffic) are not updating although all my cg graphs(ping latency test) are working.
the logs says:
01/02/2008 03:26:32 PM - SPINE: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid. Partial Result: ...
01/02/2008 03:26:32 PM - SPINE: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid. Partial Result: ...
i already looked almost everywhere in this forum and i haven't found any possible problem associated with mine...am i the only one experiencing this?
i hope to hear from you guys soon...
jeff
im still having a hard time figuring out why does my ds graphs(interface traffic) are not updating although all my cg graphs(ping latency test) are working.
the logs says:
01/02/2008 03:26:32 PM - SPINE: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid. Partial Result: ...
01/02/2008 03:26:32 PM - SPINE: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid. Partial Result: ...
i already looked almost everywhere in this forum and i haven't found any possible problem associated with mine...am i the only one experiencing this?
i hope to hear from you guys soon...
jeff
-
- Posts: 6
- Joined: Mon Jul 02, 2007 8:19 pm
- Contact:
ds graphs are not updating...part 2
Hi,
In addition to my previous post, I will post here some mysterious things i encountered,
I add all my devices using the php scripts found on the cli directory, and it all went ok without any error. I checked my cacti db and all my host was added.
But still the ds graphs are not updating.
When i checked at the "Device>Test Router 1>*Create Graph for this host"
this is what i found (pls see attachment below).
Note: I already added this Test Router 1 using the php scripts inside the cli directory
I think those lines at the eth0 and ets0a interfaces are supposed to be colored gray and unselectable (there shouldn't be any checkbox at the end of the line) since i already added this interface using the scripts.
i badly need your help, guys.patiently waiting for a reply
p.s. after i selected the lines in the attached files, the cacti created a duplicate graph and those duplicate graphs are updating, really strange. it seems the add_graphs.php is the culprit but i have no evidence to support my claim.
jeff
In addition to my previous post, I will post here some mysterious things i encountered,
I add all my devices using the php scripts found on the cli directory, and it all went ok without any error. I checked my cacti db and all my host was added.
But still the ds graphs are not updating.
When i checked at the "Device>Test Router 1>*Create Graph for this host"
this is what i found (pls see attachment below).
Note: I already added this Test Router 1 using the php scripts inside the cli directory
I think those lines at the eth0 and ets0a interfaces are supposed to be colored gray and unselectable (there shouldn't be any checkbox at the end of the line) since i already added this interface using the scripts.
i badly need your help, guys.patiently waiting for a reply
p.s. after i selected the lines in the attached files, the cacti created a duplicate graph and those duplicate graphs are updating, really strange. it seems the add_graphs.php is the culprit but i have no evidence to support my claim.
jeff
- Attachments
-
- figure 1
- cacti-error.JPG (131.88 KiB) Viewed 9731 times
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: ds graphs are not updating...
This is, when I should have dropped in. You may reproduce this by deleting the working graphs along with their datasources. Then, please read second link of my signature to find the cause of this error.seichimaru wrote:hi,
im still having a hard time figuring out why does my ds graphs(interface traffic) are not updating although all my cg graphs(ping latency test) are working.
the logs says:
01/02/2008 03:26:32 PM - SPINE: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid. Partial Result: ...
01/02/2008 03:26:32 PM - SPINE: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid. Partial Result: ...
i already looked almost everywhere in this forum and i haven't found any possible problem associated with mine...am i the only one experiencing this?
i hope to hear from you guys soon...
jeff
Well, I do understand if you don't want to loose your graphs ...
Reinhard
Yea, still having issues.gandalf wrote:Please post output ofYou may scratch confidential informationCode: Select all
php -q add_tree.php --list-nodes --tree-id=200
Reinhard
add_tree.php --type=node --node-type=host --tree-id=264 --host-id=213 --host-group-style=1
Reports:
Added Node node-id: (266)
However when I go into cacti it doesn't show up.
Known Tree Nodes:
type id text
Host 266 eccas567.xxxxx.xxxx.com Graph Template
WTF?!
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Rael, I removed some confidential data from your posting. Please run Does tree 264 has a parent-tree?
Reinhard
Code: Select all
php -q add_tree.php --list-trees|grep 264
Reinhard
-
- Posts: 6
- Joined: Mon Jul 02, 2007 8:19 pm
- Contact:
Re: ds graphs are not updating...
Sir Gandalf,gandalf wrote:This is, when I should have dropped in. You may reproduce this by deleting the working graphs along with their datasources. Then, please read second link of my signature to find the cause of this error.seichimaru wrote:hi,
im still having a hard time figuring out why does my ds graphs(interface traffic) are not updating although all my cg graphs(ping latency test) are working.
the logs says:
01/02/2008 03:26:32 PM - SPINE: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid. Partial Result: ...
01/02/2008 03:26:32 PM - SPINE: Poller[0] Host[2] DS[10] WARNING: Result from SNMP not valid. Partial Result: ...
i already looked almost everywhere in this forum and i haven't found any possible problem associated with mine...am i the only one experiencing this?
i hope to hear from you guys soon...
jeff
Well, I do understand if you don't want to loose your graphs ...
Reinhard
Good day!
I manage to resolve my issues with this partial results. I'll keep in my your suggestion and advice.
Thanks!
-
- Posts: 5
- Joined: Wed Feb 27, 2008 4:55 pm
I downloaded the tool of this thread.
add_device.php gives an error:
./add_device.php 1 zeus zeus public 2 disable
Warning: include_once(/lib/utility.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 13
Warning: include_once(): Failed opening '/lib/utility.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 13
Warning: include_once(/lib/api_data_source.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 14
Warning: include_once(): Failed opening '/lib/api_data_source.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 14
Warning: include_once(/lib/api_graph.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 15
Warning: include_once(): Failed opening '/lib/api_graph.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 15
Warning: include_once(/lib/snmp.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 16
Warning: include_once(): Failed opening '/lib/snmp.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 16
Warning: include_once(/lib/data_query.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 17
Warning: include_once(): Failed opening '/lib/data_query.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 17
Warning: include_once(/lib/api_device.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 18
Warning: include_once(): Failed opening '/lib/api_device.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 18
Fatal error: Call to undefined function db_fetch_assoc() in /home/cactiuser/add_device.php on line 26
add_device.php gives an error:
./add_device.php 1 zeus zeus public 2 disable
Warning: include_once(/lib/utility.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 13
Warning: include_once(): Failed opening '/lib/utility.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 13
Warning: include_once(/lib/api_data_source.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 14
Warning: include_once(): Failed opening '/lib/api_data_source.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 14
Warning: include_once(/lib/api_graph.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 15
Warning: include_once(): Failed opening '/lib/api_graph.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 15
Warning: include_once(/lib/snmp.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 16
Warning: include_once(): Failed opening '/lib/snmp.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 16
Warning: include_once(/lib/data_query.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 17
Warning: include_once(): Failed opening '/lib/data_query.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 17
Warning: include_once(/lib/api_device.php): failed to open stream: No such file or directory in /home/cactiuser/add_device.php on line 18
Warning: include_once(): Failed opening '/lib/api_device.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/cactiuser/add_device.php on line 18
Fatal error: Call to undefined function db_fetch_assoc() in /home/cactiuser/add_device.php on line 26
Why use this tool when the scripts in cacti 0.8.7.x do the majority of it now?melanie_pfefer wrote:I downloaded the tool of this thread.
add_device.php gives an error
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Who is online
Users browsing this forum: No registered users and 2 guests