End Device Tracking Add-On for Cacti
Moderators: Developers, Moderators
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..
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.
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
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
Has someome a idea?
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
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
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
Can you provide the exact command?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.
DNS resolution has never worked for me, btw...
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;
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;
Re: Has someome a idea?
I just dealt with this last night..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
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"] . ")");
Code: Select all
VALUES ('" .
$ip_range["ip_range"] . "','" .
$ip_range["site_id"] . "'," .
$ip_range["ips_current"] . "','" .
$ip_range["ips_current_date"] . "')");
The proper index.php file should simply have the contents of:chadd wrote:try:
http://cacti/plugins/mactrack/mactrack_view.php
There is no "index" file in the mactrack plugin directory.
-chadd.
<?php
header("Location:../index.php");
?>
This fixes one problem that occurs when click on the 'Console -> Mac Track Viewer' http link.
I edited mactrack_view.php, found this join at line 248, and changed it.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"
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";
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";
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>
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>
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.
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 240 times
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
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
Have you just tried to add the ips_current_date column to your mac_track_ip_ranges table?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.
After I did that I did not need to edit any of the scripts...
No, there was more problems than that..chadd wrote:Have you just tried to add the ips_current_date column to your mac_track_ip_ranges table?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.
After I did that I did not need to edit any of the scripts...
Sorry, I just checked..knobdy wrote:There were all rejected on my box.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.
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.
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..
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
Who is online
Users browsing this forum: No registered users and 0 guests