End Device Tracking Add-On for Cacti

Support questions about the MAC Track plugin

Moderators: Developers, Moderators

Post Reply
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

I think (and I could be wrong) that the point is, to have to go to your cacti root, login, then go to mactrack. Putting your own index.php file in the mactrack dir is not going to get you what you want - unless you take the mactrack_view.php file and put the correct parts of it into an index.php file. I will take a look at mactrack_view.php and see if I can't post you an index.php file that will address your issue - although, I don't really see much benifit..
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

I don't want to give you too much work ....

I think it could be a security issue ... I have at this time no problem with this issue but we don't like that any user can browse or start something directly our server !

Thanks.
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Has someome a idea?

Post by pepj »

I have since a long time (page 29 of this discussion) some errors. I never receive an answer. What could be the reason?

04/06/2006 04:40:14 PM - 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"
04/06/2006 04:40:14 PM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (XXX.26.36,1,2,2006-04-06 16:29:44)"
04/06/2006 04:40:14 PM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (192.168.200,1,3,2006-04-06 16:29:44)"
04/06/2006 04:40:14 PM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (XXX.30.9,1,18,2006-04-06 16:29:44)"

Thanks
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

chadd wrote:Ok, DNS is working fine.

The fix posted earlier in this post for "beginning at line 419" of the poller_mactrack.php file is not needed. Just add the column I stated in the post above and things work much better.
Can you provide the exact command?

DNS resolution has never worked for me, btw...
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

Here you go:

Just login to mysql on the command line (using your mysql uname and passwd and the cacti database name) as shown here:

mysql --user=username --pass=password cacti

once inside the cacti database issue the following command:

ALTER TABLE `mac_track_ip_ranges` ADD COLUMN `ips_current_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `ips_current`;

To remove the column you have just added (if you feel the need to), type the following:

ALTER TABLE `mac_track_ip_ranges` DROP COLUMN `ips_current_date`;

To view the colums in the mac_track_ip_ranges table, type the following:

describe mac_track_ip_ranges;

To view what get's put in that column as the poller runs, type the following:

SELECT ips_current_date FROM mac_track_ip_ranges;
tadavis
Posts: 16
Joined: Thu Apr 06, 2006 1:38 pm

Re: Has someome a idea?

Post by tadavis »

pepj wrote:I have since a long time (page 29 of this discussion) some errors. I never receive an answer. What could be the reason?

04/06/2006 04:40:14 PM - 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"
04/06/2006 04:40:14 PM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (XXX.26.36,1,2,2006-04-06 16:29:44)"
04/06/2006 04:40:14 PM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (192.168.200,1,3,2006-04-06 16:29:44)"
04/06/2006 04:40:14 PM - CMDPHP: Poller[0] ERROR: SQL Exec Failed "REPLACE INTO `mac_track_ip_ranges` (ip_range, site_id, ips_current, ips_current_date) VALUES (XXX.30.9,1,18,2006-04-06 16:29:44)"

Thanks
I just dealt with this last night..

In my case, it's because the values are not quoted.

So, editing poller_mactrack.php, goto line 433, and adding quotes to the values fixed it..

ie:
Old

Code: Select all

                        VALUES (" .
                        $ip_range["ip_range"] . "," .
                        $ip_range["site_id"] . "," .
                        $ip_range["ips_current"] . "," .
                        $ip_range["ips_current_date"] . ")");
New

Code: Select all

                        VALUES ('" .
                        $ip_range["ip_range"] . "','" .
                        $ip_range["site_id"] . "'," .
                        $ip_range["ips_current"] . "','" .
                        $ip_range["ips_current_date"] . "')");
If you look at the db_execute under neath it, you'll see the correct quoting is done.
tadavis
Posts: 16
Joined: Thu Apr 06, 2006 1:38 pm

Post by tadavis »

chadd wrote:try:

http://cacti/plugins/mactrack/mactrack_view.php

There is no "index" file in the mactrack plugin directory.

-chadd.
The proper index.php file should simply have the contents of:

<?php

header("Location:../index.php");

?>

This fixes one problem that occurs when click on the 'Console -> Mac Track Viewer' http link.
tadavis
Posts: 16
Joined: Thu Apr 06, 2006 1:38 pm

Post by tadavis »

chadd wrote:Here is what the log shows when I click on site ip range report:

03/31/2006 03:42:53 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed "SELECT mac_track_sites.site_id, mac_track_sites.site_name, mac_track_ip_ranges.ip_range, mac_track_ip_ranges.ips_max, mac_track_ip_ranges.ips_current, mac_track_ip_ranges.ips_max_date, mac_track_ip_ranges.ips_current_date FROM mac_track_ip_ranges INNER JOIN mac_track_sites ON (mac_track_ip_ranges.site_id=mac_track_sites.site_id) LIMIT 0,30"
03/31/2006 03:43:03 PM - CMDPHP: Poller[0] ERROR: SQL Assoc Failed "SELECT mac_track_sites.site_id, mac_track_sites.site_name, mac_track_ip_ranges.ip_range, mac_track_ip_ranges.ips_max, mac_track_ip_ranges.ips_current, mac_track_ip_ranges.ips_max_date, mac_track_ip_ranges.ips_current_date FROM mac_track_ip_ranges INNER JOIN mac_track_sites ON (mac_track_ip_ranges.site_id=mac_track_sites.site_id) WHERE mac_track_ip_ranges.site_id='1' LIMIT 0,30"
I edited mactrack_view.php, found this join at line 248, and changed it.

old:

Code: Select all

   $ip_ranges = "SELECT
        mac_track_sites.site_id,
        mac_track_sites.site_name,
        mac_track_ip_ranges.ip_range,
        mac_track_ip_ranges.ips_max,
        mac_track_ip_ranges.ips_current,
        mac_track_ip_ranges.ips_max_date,
        mac_track_ip_ranges.ips_current_date
        FROM mac_track_ip_ranges
        INNER JOIN mac_track_sites ON (mac_track_ip_ranges.site_id=mac_track_sites.site_id)
        $sql_where";
new:

Code: Select all

    $ip_ranges = "SELECT
        mac_track_sites.site_id,
        mac_track_sites.site_name,
        mac_track_ip_ranges.ip_range,
        mac_track_ip_ranges.ips_max,
        mac_track_ip_ranges.ips_current,
        mac_track_ip_ranges.ips_max_date
        FROM mac_track_ip_ranges
        INNER JOIN mac_track_sites ON (mac_track_ip_ranges.site_id=mac_track_sites.site_id)
        $sql_where";
ie, delete the ips_current_date line, and remove the ',' from the previous line.

Once you have done that, goto line 747 in the file, and change it

old

Code: Select all

                <td><?php print $ip_range["ip_range"];?></td>
                <td><?php print number_format($ip_range["ips_current"]);?></td>
                <td><?php print $ip_range["ips_current_date"];?></td>
                <td><?php print number_format($ip_range["ips_max"]);?></td>
                <td><?php print $ip_range["ips_max_date"];?></td>
new:

Code: Select all

                <td><?php print $ip_range["ip_range"];?></td>
                <td><?php print number_format($ip_range["ips_current"]);?></td>
                <td><?php print $ip_range["ips_current"];?></td>
                <td><?php print number_format($ip_range["ips_max"]);?></td>
                <td><?php print $ip_range["ips_max_date"];?></td>

ie, remove the _date from the ips_current_date line.
tadavis
Posts: 16
Joined: Thu Apr 06, 2006 1:38 pm

Post by tadavis »

I've attached a diff file, that can be applied by doing 'patch -p0 < mactrack.diff' in the mactrack plugin directory.

This is what I had to modify to get IP reports to work.
Attachments
mactrack.patch
patch for mactrack to fix IP reports
(2.32 KiB) Downloaded 241 times
pepj
Cacti User
Posts: 324
Joined: Thu Sep 29, 2005 5:03 am
Location: switzerland

Post by pepj »

very good


can you report this bug under
http://bugs.cacti.net/main_page.php
Jean-Michel
cacti 0.8.7e | cmd & cactid (cactid 0.8.x) | Linux | MySQL Ver 14.7 Distrib 4.1.12, for Win32 | PHP v5.2.6 | Apache v2.x | Thold | Plugin Architecture | plugin "configuration manager" http://cactiusers.org/forums/topic257.html | plugin "IP subnet calculator IPv4 / IPV6" http://forums.cacti.net/viewtopic.php?t=15428 | plugin banner http://docs.cacti.net/userplugin:banner | Net-SNMP 5.5.2 | cygwin 1.5.18 of 02.07.2005
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

tadavis wrote:I've attached a diff file, that can be applied by doing 'patch -p0 < mactrack.diff' in the mactrack plugin directory.

This is what I had to modify to get IP reports to work.
Have you just tried to add the ips_current_date column to your mac_track_ip_ranges table?

After I did that I did not need to edit any of the scripts...
tadavis
Posts: 16
Joined: Thu Apr 06, 2006 1:38 pm

Post by tadavis »

chadd wrote:
tadavis wrote:I've attached a diff file, that can be applied by doing 'patch -p0 < mactrack.diff' in the mactrack plugin directory.

This is what I had to modify to get IP reports to work.
Have you just tried to add the ips_current_date column to your mac_track_ip_ranges table?

After I did that I did not need to edit any of the scripts...
No, there was more problems than that..
knobdy
Cacti User
Posts: 495
Joined: Wed Sep 28, 2005 1:39 pm

Post by knobdy »

tadavis wrote:I've attached a diff file, that can be applied by doing 'patch -p0 < mactrack.diff' in the mactrack plugin directory.

This is what I had to modify to get IP reports to work.
There were all rejected on my box.
tadavis
Posts: 16
Joined: Thu Apr 06, 2006 1:38 pm

Post by tadavis »

knobdy wrote:
tadavis wrote:I've attached a diff file, that can be applied by doing 'patch -p0 < mactrack.diff' in the mactrack plugin directory.

This is what I had to modify to get IP reports to work.
There were all rejected on my box.
Sorry, I just checked..

If you pulled the mactrack out of zip file, it has DOS line format; you need to do 'unzip -a filename.zip' to convert from DOS to UNIX format.

The diff file I've uploaded expects UNIX file format.
tadavis
Posts: 16
Joined: Thu Apr 06, 2006 1:38 pm

Post by tadavis »

Here's the files mactrack_view.php and poller_mactrack.php; I've patched them directly from the zip file (after doing the CR/LF to LF conversion on them..)

Remove the .txt name after downloading..
Attachments
mactrack_view.php.txt
patched mactrack_view.php
(55.14 KiB) Downloaded 237 times
poller_mactrack.php.txt
patched poller_mactrack.php
(19.69 KiB) Downloaded 223 times
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests