IP:PORT granularity in CLI scripts

Anything that you think should be in Cacti.

Moderators: Developers, Moderators

Post Reply
Big Networks
Posts: 3
Joined: Wed Sep 09, 2009 5:46 pm

IP:PORT granularity in CLI scripts

Post by Big Networks »

Correctly, using the Web UI you can add hosts where 192.168.1.1:1000 and 192.168.1.1:2000 are considered two different devices.

This is not the case in the CLI scripts.

Why the discrepancy?

Wouldn't it make more sense for the two to behave in the same manner?

I've hacked the PHP code and written some Perl to side-step this discrepancy, but I really think this should be implemented in the CLI scripts.

Thanks for listening. :)
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

That is definitely not right....

Please submit a bug at http://www.cacti.net/bugs.php
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Big Networks
Posts: 3
Joined: Wed Sep 09, 2009 5:46 pm

Post by Big Networks »

Reported - 0001534

Here's the diff of my hack of cli/add_device.php versus the original just to show what's going:

266,268c266,268
< db_execute("update host set hostname='$ip' where id=" . $hosts[$description]);
< echo "This host already exists in the database ($description) device-id: (" . $hosts[$description] . ")\n";
< exit(1);
---
> # db_execute("update host set hostname='$ip' where id=" . $hosts[$description]);
> # echo "This host already exists in the database ($description) device-id: (" . $hosts[$description] . ")\n";
> # exit(1);
277c277
< if (isset($addresses[$ip]) && $snmp_port == "161" ) {
---
> if (isset($addresses[$ip])) {
279,280c279,280
< echo "ERROR: This IP already exists in the database ($ip) device-id: (" . $addresses[$ip] . ")\n";
< exit(1);
---
> #echo "ERROR: This IP already exists in the database ($ip) device-id: (" . $addresses[$ip] . ")\n";
> #exit(1);
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

In fact in the web UI you can have two devices with the same IP AND port.

The cli will rename the existing device if you try to add a second one. It also doesn't tell you that it did that.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests