End Device Tracking Add-On for Cacti

Support questions about the MAC Track plugin

Moderators: Developers, Moderators

Post Reply
tommyj
Posts: 43
Joined: Thu Jun 23, 2005 5:16 pm
Location: Stockholm, Sweden

Post by tommyj »

Has anybody been able to get the VLAN information from HP Procurve swithces using the get_procurve_switch_ports function? I know it's designed for Procurve 4000 but I've modified it so I can get the port number and portname for 2500, 2600, 2800 and 5300 series but I can't get the VLAN info.

Looking into the log it seems that the VLAN info don't get inserted into the database (between the swtchname and the macaddress):

Code: Select all

04/29/2006 11:53:04 AM - CMDPHP: Poller[0] DEBUG: SQL Exec: "REPLACE INTO mac_track_temp_ports (site_id,device_id,hostname,dns_hostname,description,vlan_id,vlan_name,mac_address,ip_address,port_number,port_name,scan_date) VALUES ('1','3','10.10.10.10','hostname.hostdomain','switchname','','','08:00:20:80:DA:20','10.10.10.11','7','','2006-04-29 11:52:57')" 
Anybody have a resolution for this?
segelhof
Posts: 1
Joined: Wed May 03, 2006 1:17 pm

Post by segelhof »

I've looked through most of this thread and still can't seem to find where to download mactrack from? Each time I think I've found it there is an edit that says outdated or something to that effect! Can someone let me know where to download this or what page it is on?

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

Post by cigamit »

segelhof wrote:I've looked through most of this thread and still can't seem to find where to download mactrack from? Each time I think I've found it there is an edit that says outdated or something to that effect! Can someone let me know where to download this or what page it is on?

Thanks!
I shalt take pity on thy poor soul, and post the latest SVN of the Plugin version. Actually, no pity is involved... I'm just too lazy to go back through all the pages.
Attachments
mactrack.zip
Latest SVN of Mactrack Plugin
(107.54 KiB) Downloaded 1466 times
Last edited by cigamit on Thu May 04, 2006 10:13 pm, edited 1 time in total.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

Ok, this may only apply to the version of MySQL I am using, but I will post it anyway. I have been having problems with certain ip_ranges not getting added to the cacti database. The errors I get when the 'poller_mactrack.php' runs are as follows:

05/04/2006 10:16:12 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (10.1.200,2,10,2006-05-04 09:40:16)"
05/04/2006 10:16:12 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (10.1.200,71,2,2006-05-04 09:40:16)"
05/04/2006 10:16:12 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (10.1.201,2,63,2006-05-04 09:40:16)"

I grew tired of seeing the errors, and noticed that some of the sites where not displaying all assigned 'IP ranges' under the 'site ip range report'. long and short, I found that when the poller was doing the 'replace into' for the 'ip ranges' it found, the database was throwing errors. I duplicated this by hand as shown here:

mysql> REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (10.101.101,2,84,2006-05-04 09:40:16);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.101,2,84,2006-05-04 09:40:16)' at line 1
mysql>

I found that the only way this would work from the mysql command prompt is as follows:


05/04/2006 10:16:12 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (10.1.200,2,10,2006-05-04 09:40:16)"
05/04/2006 10:16:12 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (10.1.200,71,2,2006-05-04 09:40:16)"
05/04/2006 10:16:12 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (10.1.201,2,63,2006-05-04 09:40:16)"

I grew tired of seeing the errors, and noticed that some of the sites where not displaying all assigned 'IP ranges' under the 'site ip range report'. long and short, I found that when the poller was doing the 'replace into' for the 'ip ranges' it found, the database was throwing errors. I duplicated this by hand as shown here:

mysql> REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES ('10.101.101','2','84','2006-05-04 09:40:16');

In case you don't see the difference, it is the single quotes around each value '. I have attached a patched 'poller_macktrack.php' file which adds the single quotes to every 'replace into' statement - which fixed my problems. Now I am getting all of the 'ip ranges' at every site reported properly in the 'site ip range report' - and no more errors.

Hope this helps someone else.

BTW, I am using the following version of MySQL:

mysqladmin Ver 8.41 Distrib 5.0.18, for portbld-freebsd6.0 on i386
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version 5.0.18
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 2 days 2 hours 33 min 11 sec

Threads: 8 Questions: 34507786 Slow queries: 0 Opens: 0 Flush tables: 1 Open tables: 55 Queries per second avg: 189.613
Attachments
poller_mactrack.zip
(5.17 KiB) Downloaded 594 times
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

chadd wrote:05/04/2006 10:16:12 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (10.1.200,2,10,2006-05-04 09:40:16)"
Could have swore I fixed this a while back, but I guess I forgot to commit it to SVN at the time. I have now updated SVN with the newest, and will update the posted archive above.
torstentfk
Cacti User
Posts: 367
Joined: Tue Apr 05, 2005 9:52 am
Location: Munich, Germany

Post by torstentfk »

Hi,

is is possible to display the total number of trunk ports at "Site Report" per site?

Torsten
User avatar
gilles
Cacti User
Posts: 250
Joined: Tue Jul 12, 2005 8:16 pm

WARNING: Device Type Not Found in Device Type

Post by gilles »

hello,

when i do :
php.exe -q mactrack_scanner.php -id=9 -d

i have this :
DEBUG: HOST: 192.168.0.107 is alive, processing has begun.
DEBUG: WARNING: SITE: MONUM, IP: 192.168.0.107, TYPE: HP J4813A ProCurve Switch 2524, revision, Device Type Not Found in Device Type Table.
DEBUG: SQL: UPDATE mac_track_devices SET ports_total='26',device_type_id='45',scan_type = '1',vlans_total='0',ports_active='6',ports_trunk='0',macs_active='17', snmp_readstring='munom',snmp_sysName='0801',snmp_sysLocation='Les egouts',snmp_sysContact='ADMINISTRATEUR',snmp_sysObjectID='.1.3.6.1.4.1.11.2.3.7.11.19',snmp_sysDescr='HP J4813A ProCurve Switch 2524, revision F.01.08, ROM F.01.01 (/sw/code/build/info(s00))',snmp_sysUptime='852035114',snmp_status='4',last_runmessage='
WARNING: Device Type Not Found in Device Type table.',last_rundate='2006-05-09 12:07:35',last_runduration='0.1238' WHERE device_id ='9'


i have created 2 lines in table mac_track_device_types, one with 2524 and another with J4813A (scanning_function : get_generic_switch_ports)


i have found a solution :
i put this line
$device = call_user_func_array("get_generic_switch_ports", array($site, $device, $device_type["lowPort"], $device_type["highPort"]));
after this :
$device_type = find_scanning_function($device, $device_types);


can you help me with this error ?
qwertz
Cacti User
Posts: 98
Joined: Thu Feb 16, 2006 9:20 am

Post by qwertz »

Hello,

Everything seems to work perfectly for me.

Only one thing.

I have to run the script manually to collect statistics with:
php5 poller_mactrack.php -f

Nothing is collected if i'm waiting for the automatic script even i activated it with the correct timing.

Could you perhaps help me ?

thanks
Qwertz

PS: i see the following in the cacti log after php5 poller_mactrack.php -f:

05/15/2006 11:51:14 AM - SYSTEM MACTRACK STATS: Time:2.0504 ConcurrentProcesses:7 Devices:2
05/15/2006 11:51:14 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "UPDATE `mac_track_ip_ranges` SET ips_max=ips_current, ips_max_date=ips_current_date WHERE ips_current > ips_max"
05/15/2006 11:51:14 AM - CMDPHP: Poller[0] ERROR: SQL Row Failed "SELECT * FROM mac_track_processes WHERE device_id = 0"
05/15/2006 11:51:14 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "DELETE FROM mac_track_processes WHERE device_id='-1'"
05/15/2006 11:51:14 AM - CMDPHP: Poller[0] ERROR: SQL Cell Failed "SELECT count(*) FROM mac_track_processes WHERE device_id > 0"
05/15/2006 11:51:12 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "INSERT INTO mac_track_processes (device_id, process_id, status, start_date) VALUES ('2', '31263', 'Running', NOW())"
05/15/2006 11:51:12 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "INSERT INTO mac_track_processes (device_id, process_id, status, start_date) VALUES ('1', '31261', 'Running', NOW())"
05/15/2006 11:51:12 AM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "INSERT INTO mac_track_processes (device_id, process_id, status, start_date) VALUES ('-1', '0', 'Running', NOW())"
Skept
Posts: 12
Joined: Sun Jul 03, 2005 1:30 pm

Post by Skept »

hi guys, i am getting the same error as qwuertz. any ideas on how to resolve it?
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

Skept wrote:hi guys, i am getting the same error as qwuertz. any ideas on how to resolve it?
have you ran the database_upgrade.php script?
Dr.Dritz
Posts: 44
Joined: Wed Apr 02, 2003 2:48 pm
Location: Southern Denmark

Post by Dr.Dritz »

cigamit wrote:
Skept wrote:hi guys, i am getting the same error as qwuertz. any ideas on how to resolve it?
have you ran the database_upgrade.php script?
Hello,
database_upgrade solved the errors for me, but the scheduled scanning still doesn't happen.
poller_mactrack invoked manually and everything's OK and IP's are gathered.

B.t.w. I'm using cmd.php and not cactid, could that be the matter?

- Dritz
Skept
Posts: 12
Joined: Sun Jul 03, 2005 1:30 pm

Post by Skept »

Thanks for the info. database_upgrade.php solved the problem. Now, I am wondering if it is possible to extend this to linux based siwtches and routers? For example, I do know that snmpd on linux routers saves recently connected host ip macs pairs in .1.3.6.1.2.1.3.1.1.2 I would appreciate any pointers on this.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

Skept wrote:Thanks for the info. database_upgrade.php solved the problem. Now, I am wondering if it is possible to extend this to linux based siwtches and routers? For example, I do know that snmpd on linux routers saves recently connected host ip macs pairs in .1.3.6.1.2.1.3.1.1.2 I would appreciate any pointers on this.
try a device type with a scanning fuction of 'get generic switch ports' and the oid you think it is.
Skept
Posts: 12
Joined: Sun Jul 03, 2005 1:30 pm

Post by Skept »

chadd, thanks for the tip. I have tried that and have created a device type with my oid. but after adding a new device, it still recognizes it as .1.3.6.1.4.1.8072.3.2.10 [the default one, i mean].

I am sure, I missed something.
quinten
Posts: 6
Joined: Wed May 24, 2006 12:29 pm

Post by quinten »

Strange Error:

I posted this here http://forums.cacti.net/viewtopic.php?t=12961, because my original problem was with an Undefined index:
PHP Notice: Undefined index: url_path in /var/www/html/mactrack/include/top_mactrack_header.php on line 52,
PHP Notice: Undefined index: url_path in /var/www/html/mactrack/include/top_mactrack_header.php on line 53,
PHP Notice: Undefined index: url_path in /var/www/html/mactrack/include/top_mactrack_header.php on line 65,
PHP Notice: Undefined index: url_path in /var/www/html/mactrack/include/top_mactrack_header.php on line 65,
PHP Notice: Undefined index: url_path in /var/www/html/mactrack/include/top_mactrack_header.php on line 66,
PHP Notice: Undefined index: url_path in /var/www/html/mactrack/include/top_mactrack_header.php on line 66,
I resolved it by modifying the url_path in those lines with the http:// address.

However.. One issue still kept coming into the error_log when I clicked on the "Mactrack" tab.

PHP Fatal error: Call to undefined function: do_hook() in /var/www/html/mactrack/include/top_mactrack_header.php on line 67

System is:
Fedora Core release 3 (Heidelberg)

PHP 4.3.9 (cgi) (built: Oct 20 2004 14:52:04)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

This is perl, v5.8.5 built for i386-linux-thread-multi

Not being a PHP guru, is there such a function in PHP 4? What will upgrading to PHP 5 do to existing scripts.

I have Cacti 0.8.6h in 2 Instances. One straight up Cacti, the other Mactrack. Each with its own Databases.

I also have cacti-cactid-0.8.6g

The MySql version is 3.23.58.

I have run database_upgrade.php on the Mactrack Database..

I was having some "path" issues with a few of the files, mainly with mactrack_view.php, but I corrected those.

any help would be appreciated with this little error.

THanks,

Q
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests