![](https://secure.gravatar.com/avatar/0fa97865a0e1ab36152b6b2299eedb49.jpg?s=120&d=mm&r=g)
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 + 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