Quick and dirty script to add devices to cacti
Moderators: Developers, Moderators
-
- Posts: 5
- Joined: Wed Feb 27, 2008 4:55 pm
Hello
So I understand from you that 0.8.7 has the scripts that can add 150 hosts + their graphs in one shot. True?
actually I am trying to find an automatic way to add 150 hosts + their graphs. I need to know how to do it in cacti without manually adding these hosts and graphs in the web interface.
thanks
So I understand from you that 0.8.7 has the scripts that can add 150 hosts + their graphs in one shot. True?
actually I am trying to find an automatic way to add 150 hosts + their graphs. I need to know how to do it in cacti without manually adding these hosts and graphs in the web interface.
thanks
yesmelanie_pfefer wrote:So I understand from you that 0.8.7 has the scripts that can add 150 hosts + their graphs in one shot. True?
| 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 |
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Please see http://docs.cacti.net/node/529
There have been some contributions of wrapper scripts around those cacti cli stuff. Please search the forum for them
Reinhard
There have been some contributions of wrapper scripts around those cacti cli stuff. Please search the forum for them
Reinhard
@Gandalf
I've used these scripts to insert my 2000 appliances into cacti.
I've also make a quick dirty script to automake threshold.
But I can't find a solution to automatically delete grapgh in the same way that we create it ( specifying interface if oper status = down for exemple ).
Can you help me? Which php file is used to delete graph with wich parameter?
Best regards,
Vince
I've used these scripts to insert my 2000 appliances into cacti.
I've also make a quick dirty script to automake threshold.
But I can't find a solution to automatically delete grapgh in the same way that we create it ( specifying interface if oper status = down for exemple ).
Can you help me? Which php file is used to delete graph with wich parameter?
Best regards,
Vince
@Gandalf
I've used the script provided in release 0.87.
But there is no script to delete graph. In fact I don't want to create a graph for vlan interface even if operstatus=up.
So what I currently do is create all graph with operstatus=up and after deleting all graph that I don't need.
My goal is to have a script that can delete graph according to the ifdescr value.
Thank you for your help
I've used the script provided in release 0.87.
But there is no script to delete graph. In fact I don't want to create a graph for vlan interface even if operstatus=up.
So what I currently do is create all graph with operstatus=up and after deleting all graph that I don't need.
My goal is to have a script that can delete graph according to the ifdescr value.
Thank you for your help
As I can see, the speed of unrouted vlan is 0. Can we add filtering by ifSpeed when create graph? At least we can reduce unwanted process to create unrouted vlans that appear as interfaces.
Looking carefully into the ifType code may also help to gain more precise filtering.
I don't have 0.8.7 at hand but like to offer an idea that may help. (I'm using cisco)
Looking carefully into the ifType code may also help to gain more precise filtering.
I don't have 0.8.7 at hand but like to offer an idea that may help. (I'm using cisco)
Hi, my problem was to add new graphs associated to a host template after adding the device with add_device.php.
I added some dirty lines to the add_graph.php to get all graph template ids associated to a special host template. After getting theese ids its easy to add theese graphs.
I use it in combination with a shell script so all i need is the output of the ids.
Of course there is a workaround getting all ids but this was for me the easiest way.
Hope this is useful for someone.
this must be added into the switch
this can be added somewhere in the file (its really dirty )
this can be added to the display_help() function
if you execute now
the output looks like:
13
30
31
42
thats a snipped of my shell code
EDIT// feature request created
I added some dirty lines to the add_graph.php to get all graph template ids associated to a special host template. After getting theese ids its easy to add theese graphs.
I use it in combination with a shell script so all i need is the output of the ids.
Of course there is a workaround getting all ids but this was for me the easiest way.
Hope this is useful for someone.
this must be added into the switch
Code: Select all
break;
case "--list-graph-template-id":
$listGraphTemplateID = TRUE;
Code: Select all
if ($listGraphTemplateID) {
if ($hostTemplateId > 0) {
function displayGraphTemplateIDs($hostTemplateId) {
$ids = array();
$tmparray = db_fetch_assoc("SELECT graph_template_id FROM host_template_graph WHERE host_template_id = $hostTemplateId");
foreach ($tmparray as $tmp) {
$tmp["graph_template_id"];
$ids[] = $tmp["graph_template_id"];
echo $tmp["graph_template_id"]."\n";
}
return $ids;
}
displayGraphTemplateIDs($hostTemplateId);
} else {
echo "ERROR: You must supply an host-template-id before you can list its graph templates\n";
echo "Try --host-template-id=[ID] --list-graph-template-id\n";
exit(1);
}
exit(0);
}
Code: Select all
echo " --list-graph-template-id --host-template-id=[ID]\n";
if you execute now
Code: Select all
./add_graphs.php --host-template-id=14 --list-graph-template-id
13
30
31
42
thats a snipped of my shell code
Code: Select all
ids=`php -q ../cli/add_graphs.php --list-graph-template-id --host-template-id=$solarisID`
for a in $ids
do
php -q ../cli/add_graphs.php --host-id=$hostID --graph-type=cg --graph-template-id=$a
done
Last edited by TheBigOne on Wed Oct 15, 2008 2:49 am, edited 1 time in total.
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Please create a feature request using http://ww.cacti.net/bugs.php adding your code there
Reinhard
Reinhard
Who is online
Users browsing this forum: No registered users and 5 guests