Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Quick and dirty script to add devices to cacti
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
melanie_pfefer



Joined: 27 Feb 2008
Posts: 5

PostPosted: Thu Feb 28, 2008 2:52 am    Post subject: Reply with quote

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
Back to top
BSOD2600
Cacti Moderator


Joined: 08 May 2004
Posts: 6791
Location: WA, USA

PostPosted: Thu Feb 28, 2008 2:36 pm    Post subject: Reply with quote

melanie_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?

yes
Back to top
Rael
Cacti User


Joined: 05 Apr 2007
Posts: 128

PostPosted: Wed Apr 02, 2008 9:14 am    Post subject: Reply with quote

These tools have proved a god send for the long term support of our cacti instance, however I don't see a way of removing hosts from cacti in the cli? Am I missing something?
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Thu Apr 03, 2008 2:05 pm    Post subject: Reply with quote

What are you aiming add when talking about "moving". What do you want to move?
Reinhard
Back to top
Rael
Cacti User


Joined: 05 Apr 2007
Posts: 128

PostPosted: Mon Apr 07, 2008 8:50 am    Post subject: Reply with quote

I'm sorry gandalf, we're you talking to me or someone else?
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Wed Apr 09, 2008 12:18 pm    Post subject: Reply with quote

Rael wrote:
I'm sorry gandalf, we're you talking to me or someone else?
I was talking to you, but I must have been drunk. I was reading "moving" instead of "removing".
So it's simply a matter of a feature request. Not that difficult
Reinhard
Back to top
ibrahim



Joined: 27 May 2008
Posts: 27

PostPosted: Mon Jun 09, 2008 10:43 am    Post subject: Reply with quote

hello Reinhard

i have a list of hosts that i have to monitor. can you please tell me how to use this script ( after i installed it in the cacti dir ) in order to insert those hosts with their graphs automatically ( by steps)

i ll really appreciate

thx in advance
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Wed Jun 11, 2008 2:31 pm    Post subject: Reply with quote

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
Back to top
killshoot



Joined: 26 Mar 2008
Posts: 34

PostPosted: Tue Jun 17, 2008 7:42 am    Post subject: Reply with quote

@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
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Wed Jun 18, 2008 1:21 pm    Post subject: Reply with quote

Please use the cli scripts provided by cacti since 087
Reinhard
Back to top
killshoot



Joined: 26 Mar 2008
Posts: 34

PostPosted: Thu Jun 19, 2008 5:43 am    Post subject: Reply with quote

@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
Back to top
rujipars



Joined: 02 Nov 2007
Posts: 15

PostPosted: Fri Jun 20, 2008 6:04 am    Post subject: Reply with quote

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)
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Sat Jun 21, 2008 2:49 pm    Post subject: Reply with quote

Automatic filtering is not (yet) provided by cacti. But when scanning the interface list manually, you'll notice those with correct ifSpeed. Then, please select only those
Reinhard
Back to top
TheBigOne



Joined: 29 Sep 2008
Posts: 9

PostPosted: Tue Oct 14, 2008 4:53 am    Post subject: Reply with quote

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
Code:
 
break;
case "--list-graph-template-id":
$listGraphTemplateID = TRUE;   


this can be added somewhere in the file (its really dirty )
Code:
 
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);
        }



this can be added to the display_help() function
Code:
echo "    --list-graph-template-id --host-template-id=[ID]\n";



if you execute now
Code:
./add_graphs.php --host-template-id=14 --list-graph-template-id

the output looks like:
13
30
31
42

thats a snipped of my shell code
Code:

  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


EDIT// feature request created


Last edited by TheBigOne on Wed Oct 15, 2008 2:49 am; edited 1 time in total
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 12295
Location: Muenster, Germany

PostPosted: Tue Oct 14, 2008 1:43 pm    Post subject: Reply with quote

Please create a feature request using http://ww.cacti.net/bugs.php adding your code there
Reinhard
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 7 of 8

 



Powered by phpBB © 2001, 2005 phpBB Group