Network discovery for Cacty

General discussion about Plugins for Cacti

Moderators: Moderators, Developers

Author
Message
User avatar
tim_hunter
Posts: 3
Joined: Thu Jul 07, 2005 6:15 pm
Contact:

Network discovery for Cacty

#1 Post by tim_hunter » Thu Jan 12, 2006 7:01 pm

eu fiz um network discovery aki, pois a nossa urgência era grande e queria a opinião de vcs..

this text was writed in Portuguese-Brasil

té mais!!!
Attachments
discovery.JPG
screen shot discovery plug-in
discovery.JPG (105.39 KiB) Viewed 22171 times
Tim Hunter

kslt
Cacti User
Posts: 85
Joined: Tue Aug 02, 2005 4:12 am

#2 Post by kslt » Sun Jan 15, 2006 6:15 am

and where i can get a script ?

cigamit
Developer
Posts: 2782
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

#3 Post by cigamit » Mon Jan 16, 2006 11:36 am

I have been working on a simular Plugin for a while now, and its just about ready for release. I just need to add a few more options. It currently runs automatically via the poller every few hours (adding option to specify how long between) and you can specify multiple subnets to scan. It only scans hosts that are currently not in your Cacti install (to save time) and allows for easy Addition into Cacti (currently redirects you to the Add Host page with everything already preset except Description and Host Template). At a later date you will be able to specify which host template to use for what OS it finds. It only uses internal Cacti functions to do it works now (before it required NMAP) and should work fine on both Windows and Linux. You currently can specify several different Community Names for it to try, and I am about to have it show on the info page the actual community name that it uses. The contact and location OIDs are properly shown, I just don't have it setup on those particular hosts. It also will DNS the IPs and return the result, but I had it disabled for that screen shot.

Anyways, here is a screen shot of it, I should have it released by the end of the week.

As a side note, does anyone believe it is showing too much info? I'm thinking about trimming down the amount of initial info it shows, but instead have it show the Location, Contact, and Description as a DHTML popup when you mouse over the device.
Attachments
discover.jpeg
Discover Plugin
discover.jpeg (233.56 KiB) Viewed 21832 times

cacontece
Posts: 5
Joined: Mon Jan 16, 2006 2:12 pm

#4 Post by cacontece » Mon Jan 16, 2006 2:18 pm

I think there is enough information...

I was wondering to use NMAP, but it seems to be a kind of slow with a lot of hosts...
How did you do it with just PHP functions?

best regards,

cacontece

cigamit
Developer
Posts: 2782
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

#5 Post by cigamit » Mon Jan 16, 2006 2:40 pm

cacontece wrote:I think there is enough information...

I was wondering to use NMAP, but it seems to be a kind of slow with a lot of hosts...
How did you do it with just PHP functions?

best regards,

cacontece
Cacti already has internal ping and snmp functions, which work quite nicely, so all I really do is loop through the subnets you request, and query them using the cacti functions. This makes it the most portable as you don't have to install NMap and all its requirements. NMap worked fine at this, and it really wasn't any slower than the script already is (its not blazing fast by any means) but was just too much overhead for me.

cacontece
Posts: 5
Joined: Mon Jan 16, 2006 2:12 pm

#6 Post by cacontece » Fri Jan 20, 2006 7:09 am

Hi cigamit...

can I try your discovery plugin?? :D

tks...

cacontece

mories
Posts: 8
Joined: Fri Dec 30, 2005 1:45 pm

#7 Post by mories » Fri Jan 20, 2006 1:17 pm

cigamit : I am also very interested in your Discovery plugin !

lanyao
Posts: 8
Joined: Wed Dec 14, 2005 9:37 pm

#8 Post by lanyao » Mon Jan 23, 2006 10:38 pm

waiting for your release :)

mgob
Posts: 25
Joined: Wed Dec 07, 2005 3:43 am
Location: Arizona
Contact:

#9 Post by mgob » Thu Jan 26, 2006 10:11 am

ditto

User avatar
NHDave
Cacti User
Posts: 61
Joined: Sun Mar 20, 2005 9:14 am
Contact:

#10 Post by NHDave » Tue Jan 31, 2006 2:12 pm

lanyao wrote:waiting for your release :)
Just grab the iso from his site and extract the plugins dir...
Lots of other goodies in it as well :wink:

cigamit
Developer
Posts: 2782
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

#11 Post by cigamit » Tue Jan 31, 2006 3:05 pm

NHDave wrote:
lanyao wrote:waiting for your release :)
Just grab the iso from his site and extract the plugins dir...
Lots of other goodies in it as well :wink:
Heh. Granted, thats not the newest version, that version requires NMap. I went ahead and threw the developmental snapshot up on my site as a beta so everyone can test out and let me know how it works for them. Warning, there are very little configuration options at the moment (well, only 1 actually) which is the subnet to scan, currently on being able to set it like so (ex: 192.168.0.*) or specific IP addresses. You can scan multiple subnets by using a comma, I am currently working on allowing you to use 192.168.0.0/16 or even ranges like 192.168.0.19-192.168.4.254.

It should start polling a little after you actually set the subnet (5-10 minutes), it should tell you in the Cacti log when it actually does. There is no "error" or debug checking at this point, so don't get your hopes up.

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#12 Post by fmangeant » Wed Feb 01, 2006 4:02 am

cigamit wrote:I went ahead and threw the developmental snapshot up on my site as a beta so everyone can test out and let me know how it works for them.
Hi cigamit

I installed the discovery plugin 0.1b on top of my test system (Cacti 0.8.6h + patches + plugin architecture 0.8 + monitor 0.4), and get this error when accessing the "discover" tab :

Code: Select all

Unknown column 'hash' in 'order clause'
This test system is running MySQL 4.1.14, Apache 2.0.55 and PHP 5.0.5
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

User avatar
fmangeant
Cacti Guru User
Posts: 2326
Joined: Fri Sep 19, 2003 8:36 am
Location: Sophia-Antipolis, France
Contact:

#13 Post by fmangeant » Wed Feb 01, 2006 4:30 am

Well, I'm running into another issue :

Code: Select all

$ php findhosts.php
02/01/2006 10:25:37 AM - POLLER: Poller[0] Network Discover is now running xx.xx.xx.xx
Fatal error: Call to undefined function socket_create() in /cacti/cacti-0.8.6h/lib/ping.php on line 117
Let's recompile PHP with sockets support...

To all Gentooers, add this to /etc/portage/package.use :

Code: Select all

dev-lang/php session cli xml sockets
[size=84]
[color=green]HOWTOs[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15353]Install and configure the Net-SNMP agent for Unix[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=26151]Install and configure the Net-SNMP agent for Windows[/url]
[*][url=http://forums.cacti.net/viewtopic.php?t=28175]Graph multiple servers using an SNMP proxy[/url][/list]
[color=green]Templates[/color] :
[list][*][url=http://forums.cacti.net/viewtopic.php?t=15412]Multiple CPU usage for Linux[/url]
[*][url=http://forums.cacti.net/viewtopic.php?p=125152]Memory & swap usage for Unix[/url][/list][/size]

Alex72
Posts: 3
Joined: Fri Sep 09, 2005 2:34 am
Location: Austria
Contact:

#14 Post by Alex72 » Wed Feb 01, 2006 5:37 am

First of all: This plugin is a very good idea and so long it is also well done -Thank you!

I installed the plugin and it seems that is working correctly, but I have a question about the interval when discover is scanning the subnet(s):
Where can I configure the time-interval? Is it hardcoded at the moment and if so where can I modify it?

Thanks,
Alex.

Alex72
Posts: 3
Joined: Fri Sep 09, 2005 2:34 am
Location: Austria
Contact:

#15 Post by Alex72 » Wed Feb 01, 2006 9:08 am

I found where I can configure the time-interval:

setup.php:
...
function discovery_poller_bottom () {
global $config;

include_once($config["library_path"] . "/database.php");

$t = read_config_option("discovery_last_poll");

if ($t != '' && time() - $t < 21600)
return;
...

The bold value is the time interval since last poll in seconds, which is by default 6 hours.

;-)
Alex.

Post Reply