NOT TESTED.
I haven't gotten into the template stuff others have mentioned earlier. But using those or rolling your own HTML, either way is easier if you choose a better data structure, which you can step throguh using
keys or
each.
If it was me I'd change the structure to look like:
$info{$hostkey}{$if}{if_name} = &get_snmp("$Cisco.$IfName.$if");
$info{$hostkey}{$if}{hw_type} = &get_snmp("$Cisco.$IfHwType.$if");
$info{$hostkey}{$if}{if_desc} = &get_snmp("$Generic.$ifDesc.$if");
$info{$hostkey}{$if}{if_speed} = &get_snmp("$Generic.$ifSpeed.$if");
$info{$hostkey}{$if}{bw_in} = &get_snmp("$Cisco.$IfInBitSec.$if");
$info{$hostkey}{$if}{bw_out} = &get_snmp("$Cisco.$IfOutBitSec.$if");
$info{$hostkey}{$if}{if_lineprot} = &get_snmp("$Cisco.$LineProto.$if")
+;
$info{$hostkey}{$if}{vm_Vlan} = &get_snmp("$Specific.$vmvlan.$if");
Then you can say:
use CGI;
$q = new CGI;
print $q->start_table();
for ( keys %{ $info{$hostkey}{$if} } )
{
print $q->Tr([$q->td([$_, $info{$hostkey}{$if}{$_}])]) . "\n";
}
print end_table();
or the more understandable, but less approved:
print "<table>\n";
for ( keys %{ $info{$hostkey}{$if} } )
{
print "<tr><td>$_</td><td>$info{$hostkey}{$if}{$_}</td></tr>\n"
}
print "</table>"
or use one of the templates mentioned above.
--Bob Niederman, http://bob-n.com
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.