On 31/03/2016 15:56:01, Tom Laermans <tom.laermans@powersource.cx> wrote:
only convenience - I don't need to ssh and grep 'manually'.
Usage scenario would be something like:
- "slow internet" complains
- one edge port has high utilization.
- MACs on the port are show
- If also PC IP/name is shown (hopefully with descriptive name), you can immediately see who is the problematic user.
Br Justin
On 03/31/2016 04:21 PM, Adam Armstrong wrote:
I'm not sure how useful it is to get information about the hosts that the Observium server itself can see at layer 2.
adam.On 31/03/2016 15:06:17, Justin Cinkelj <justin.cinkelj@xlab.si> wrote:
Hi
I here and there search for IP address belonging to certain MAC address.
Below is a tiny patch to show that info in observium.
Data is read from arpwatch datafile (path to datafile is set in config.php):
// enable arpwatch
$config['arpwatch']['datafile'] = "/var/lib/arpwatch/arp.dat";
And once IP is known, reverse DNS name is informative too.
Patch acceptable for inclusion?
BR Justin
diff --git a/html/ajax/entity_popup.php b/html/ajax/entity_popup.php
index 86c2b43..ef2fe18 100644
--- a/html/ajax/entity_popup.php
+++ b/html/ajax/entity_popup.php
@@ -73,6 +73,25 @@ switch ($vars['entity_type'])
} else {
echo 'Not Found';
}
+ // search for mac in arpwatch datafile
+ $aw_on = array_key_exists("arpwatch", $config) &&
+ array_key_exists("datafile", $config["arpwatch"]) &&
+ $config["arpwatch"]["datafile"];
+ if ($aw_on) {
+ // lines are formated: mac ip timestamp name
+ $aw_file = "/var/lib/arpwatch/arp.dat";
+ $aw_data = file_get_contents($aw_file);
+ $aw_data = explode("\n", $aw_data);
+ for ($line = 0; $line < count($aw_data);="" $line++)="">
+ if (strpos($aw_data[$line], $vars['entity_id']) !== false) {
+ list($aw_mac, $aw_ip, $aw_timestamp, $aw_name) =
preg_split("/\s+/", $aw_data[$line]);
+ echo "
arpwatch: " . $aw_ip . " " . $aw_name;
+ // with IP, rev DNS can be tried
+ $rdns_name = gethostbyaddr($aw_ip );
+ echo "
rDNS: " . $rdns_name;
+ }
+ }
+ }
} else {
echo 'Not correct MAC address';
}
_______________________________________________
observium mailing list
observium@observium.org
http://postman.memetic.org/cgi-bin/mailman/listinfo/observium
_______________________________________________ observium mailing list observium@observium.org http://postman.memetic.org/cgi-bin/mailman/listinfo/observium