- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- snmpget result and ip name on the same row
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-15-2007 10:25 PM
тАО03-15-2007 10:25 PM
snmpget result and ip name on the same row
I need a command to show the nodename and ip address on the same row, example of result:
system.sysName.0 : DISPLAY STRING- (ascii): MANROUTER9 192.168.0.1
I think something like this:
snmpget -c public 192.168.0.1 system.sysName.0 |echo "192.168.0.1"
but don't work.
Thanks to all
Points for all reply
- Tags:
- snmpget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 12:31 AM
тАО03-16-2007 12:31 AM
Re: snmpget result and ip name on the same row
snmpget -c public -v 1 192.168.0.1 system.sysName.0 | awk '{print $0, "#", $4}' | perl -MSocket -ne '($snmp, $host) = split (/#/, $_); $host =~ s/^\s+|\s+$//g; print $snmp; print inet_ntoa(scalar gethostbyname($host));'
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 12:46 AM
тАО03-16-2007 12:46 AM
Re: snmpget result and ip name on the same row
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 12:49 AM
тАО03-16-2007 12:49 AM
Re: snmpget result and ip name on the same row
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 01:14 AM
тАО03-16-2007 01:14 AM
Re: snmpget result and ip name on the same row
Don't appear anything.
Remain in wait status.
thks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 01:22 AM
тАО03-16-2007 01:22 AM
Re: snmpget result and ip name on the same row
snmpget -c public -v 1 192.168.0.1 system.sysName.0
if so see if this works:
snmpget -c public -v 1 192.168.0.1 system.sysName.0 | awk '{print $0, "#", $4}'
Let me know and we can work from there. Maybe you left of the trailing '.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-16-2007 03:01 AM
тАО03-16-2007 03:01 AM
Re: snmpget result and ip name on the same row
I have created this.
This scan all the 192.168.1.xxx subnet and output a file with "hostname ipaddress".
I hope this helpful for someone!
i=1
while [[ ${i} -lt 255 ]]
do
export IP="192.168.1.${i}"
snmpget -c public -t 1 -r 0 ${IP} system.sysName.0 2> /dev/null | awk '{ print $6 }' |while read a
do
echo $a $IP >> nodes.txt
done