getwithrob has asked for the wisdom of the Perl Monks concerning the following question:
Again, please keep in mind my programming skills are pretty much zero.1. Read Cisco devices from a file I create: host1.domain.com host2.domain.com host3.domain.com 2. For each device in this list do snmpgets to get: a. a port description for each port (devices will have 16, 24, 48 or m +ore ports) b. the oper status for each port c. the admin status for each port d. the last change status for each port 3. I want the output to be in a CSV format so the file can be opened w +ith Excel 4. The variables I will be polling are: a. snmpwalk interfaces.ifTable.ifEntry.ifDescr public $host b. snmpwalk interfaces.ifTable.ifEntry.ifOperStatus public $host c. snmpwalk interfaces.ifTable.ifEntry.ifAdminStatus public $host d. snmpwalk interfaces.ifTable.ifEntry.ifLastChange public $host 5. Here is a sample snmpwalk for each variable above. a. johnsonr@nmscrme01 > snmpwalk 10.245.159.57 public interfaces.ifTa +ble.ifEntry.ifDescr interfaces.ifTable.ifEntry.ifDescr.1 = FastEthernet0/1 interfaces.ifTable.ifEntry.ifDescr.2 = FastEthernet0/2 interfaces.ifTable.ifEntry.ifDescr.3 = FastEthernet0/3 ..... b. johnsonr@nmscrme01 > snmpwalk 10.245.159.57 public interfaces.ifTa +ble.ifEntry.ifOperStatus interfaces.ifTable.ifEntry.ifOperStatus.1 = up(2) interfaces.ifTable.ifEntry.ifOperStatus.2 = up(2) interfaces.ifTable.ifEntry.ifOperStatus.3 = down(2) ..... c. johnsonr@nmscrme01 > snmpwalk 10.245.159.57 public interfaces.ifTa +ble.ifEntry.ifAdminStatus interfaces.ifTable.ifEntry.ifAdminStatus.1 = up(2) interfaces.ifTable.ifEntry.ifAdminStatus.2 = up(2) interfaces.ifTable.ifEntry.ifAdminStatus.3 = down(2) ..... d. johnsonr@nmscrme01 > snmpwalk 10.245.159.57 public interfaces.ifTa +ble.ifEntry.ifLastChange interfaces.ifTable.ifEntry.ifLastChange.1 = Timeticks: (628809469) 72 +days, 18:41:34.69 interfaces.ifTable.ifEntry.ifLastChange.2 = Timeticks: (2297919248) 26 +5 days, 23:06:32.48 interfaces.ifTable.ifEntry.ifLastChange.3 = Timeticks: (5370) 0:00:53. +70 ..... My goal is this, open the csv file using Excel so the output will look + something like this: FastEthernet0/1 up(2) up(2) Timeticks: (628809469) 72 days, 1 +8:41:34.69 FastEthernet0/2 up(2) up(2) Timeticks: (2297919248) 265 days, + 23:06:32.48 FastEthernet0/3 down(2) down(2) Timeticks: (5370) 0:00:53.70 Of course it would like this before opening it as a .csv FastEthernet0/1,up(2),up(2),Timeticks: (628809469) 72 days, 18:41:34.6 +9 FastEthernet0/2,up(2),up(2),Timeticks: (2297919248) 265 days, 23:06:32 +.48 FastEthernet0/3,down(2),down(2),Timeticks: (5370) 0:00:53.70
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: snmpwalk to CSV #2
by graff (Chancellor) on Sep 23, 2005 at 14:12 UTC | |
by getwithrob (Initiate) on Sep 23, 2005 at 15:24 UTC | |
by graff (Chancellor) on Sep 23, 2005 at 15:57 UTC | |
by getwithrob (Initiate) on Sep 23, 2005 at 17:22 UTC | |
by graff (Chancellor) on Sep 23, 2005 at 22:30 UTC | |
by getwithrob (Initiate) on Sep 23, 2005 at 17:13 UTC |