[xymon] MAC address in the client data?

Tim McCloskey tm at freedom.com
Thu Jul 22 05:33:41 CEST 2010


From a Solaris 10 ifconfig man page:

ether [ address ]
         If no address is given and the user is root or has  suf-
         ficient  privileges  to open the underlying device, then
         display the current Ethernet address information.

Vernon is right, arp is probably your friend here. There are other ways of doing this, arp being one of them.  If it were me, I would not want to run sudo or change anything to run as root when the same information is already available to the hobbit user.  For displaying information, arp will work in child zones as well.
 
Certainly you would do something a bit more sane than the following, laziness provides the following example, there are better ways to do this:

for ip in `ifconfig -a | gegrep -A1  "bge0: " | tail -1 | awk '{print $2}'`; do arp -na | grep $ip | awk '{print $NF}'; done

some:mac:addres:displayed:here

Regards, 




________________________________________
From: Vernon Everett [everett.vernon at gmail.com]
Sent: Wednesday, July 21, 2010 8:00 PM
To: xymon at xymon.com
Subject: Re: [xymon] MAC address in the client data?

Hi Martin

I believe this to be a Solaris feature. And looks like it is also the case on others.
See here http://www.coffer.com/mac_info/locate-unix.html

And yes, I think sudo is the simplest way of getting round it.
However, if you have conscientious objections to using root and/or sudo, you could try messing about with the output of arp -a.
A bit of creative scripting, and you should get something you could tack onto the output of ifconfig -a.
YMMV.

Cheers
      Vernon



On Thu, Jul 22, 2010 at 12:10 AM, Ward, Martin <Martin.Ward at colt.net<mailto:Martin.Ward at colt.net>> wrote:
All,

I don't know if this quirk is peculiar to Solaris or is the same on other flavours of UNIX, but if you are not the root user and you run the ifconfig(1m) command it does not show the MAC address assigned to the interfaces. Here is what I see in Xymon's client data view for one host:

[ifconfig]
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
ce0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.5.2.46 netmask ffffffe0 broadcast 10.5.2.63

If I login as root and run the command I see:
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
ce0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet 10.5.2.46 netmask ffffffe0 broadcast 10.5.2.63
        ether 0:3:ba:96:e6:4f

I am currently writing a script to retrieve information from the stored client data and to populate a database with that info. In this manner when I install Xymon on a new server the configuration information is automatically updated in my server database. The question is: How can I get the MAC address? By default the Xymon client is installed and run under the hobbit user ID. Is there any way I can configure the hobbitclient-sunos.sh script to run as root?  I guess I could run the ifconfig command using sudo and configure sudo so that it doesn't require a password, but is there any other/better/easier/more elegant ways of doing this?

|\/|artin
--
[cid:image001.jpg at 01CB28F6.36AD1610]
Martin Ward
Manager, Technical Services

DDI:+44 (0) 20 7863 5218 / Fax: +44 (0)20 7863 9999 /  www.colt.net<http://www.colt.net/>
Colt Technology Services, Unit 12, Powergate Business Park, Volt Avenue, Park Royal, London, NW10 6PW, UK.

Help reduce your carbon footprint | Think before you print. Registered in England and Wales, registered number 02452736, VAT number GB 645 4205 50

[Colt Disclaimer] The message is intended for the named addressee only and may not be disclosed to or used by anyone else, nor may it be copied in any way. The contents of this message and its attachments are confidential and may also be subject to legal privilege. If you are not the named addressee and/or have received this message in error, please advise us by e-mailing abuse at colt.net<mailto:abuse at colt.net> and delete the message and any attachments without retaining any copies. Internet communications are not secure and Colt does not accept responsibility for this message, its contents nor responsibility for any viruses. No contracts can be created or varied on behalf of Colt Technology Services, its subsidiaries, group companies or affiliates ("Colt") and any other party by email communications unless expressly agreed in writing with such other party. Please note that incoming emails will be automatically scanned to eliminate potential viruses and unsolicited promotional emails. For more information refer to www.colt.net<http://www.colt.net> or contact us on +44(0)20 7390 3900



More information about the Xymon mailing list