Generic vs. Specific Simple Network Management Tools
J¨ urgen Sch¨
- nw¨
alder
<schoenw@informatik.uni-osnabrueck.de>
University of Osnabr¨ uck Germany
SANE 2002 – p.1
Generic vs. Specific Simple Network Management Tools J urgen Sch - - PowerPoint PPT Presentation
Generic vs. Specific Simple Network Management Tools J urgen Sch onw alder <schoenw@informatik.uni-osnabrueck.de> University of Osnabr uck Germany SANE 2002 p.1 Network Management Standards 1.0 2.0 2.2 2.3 2.4 2.5
J¨ urgen Sch¨
alder
<schoenw@informatik.uni-osnabrueck.de>
University of Osnabr¨ uck Germany
SANE 2002 – p.1
[P] Proposed Standard [E] Experimental [S] Standard [D] Draft Standard Legend: 1988 1990 1992 1994 1996 1998 2000 1986 1980 1982 1984 2002 SMI (IETF) SNMPv3 [S] [P] [D/E] [P] [D] [S] [S] [P] [D] CMIP CMIS GDMO OSI RM.4 M.30 M.3010 M.3100 M.3400 DMI (DMTF) 2.0s 2.0 1.0 SPPI (IETF) CORBA (OMG) [P] [P] COPS−PR (IETF) 2.2 2.0 1.0 2.3 2.4 2.6 2.5 1.0 2.0 2.2 2.3 2.4 2.5 [P] [D] LDAP [P] LDAPv3 LDAP (IETF) LDAPv2 SNMPv3 [S] SNMPv3 SNMPv2c SNMPv2p SNMPv1 SMIv2 SMIv2 SMIv2 SMIv1 SPPIv1 COPS−PRv1 TMN (ITU) CMIP (ISO) SNMP (IETF) CIM (DMTF)
SANE 2002 – p.2
SANE 2002 – p.3
SANE 2002 – p.3
SANE 2002 – p.3
SANE 2002 – p.3
generator command generator command generator command generator command responder command responder command responder command responder command notification
notification
notification receiver notification receiver Inform Get Response Response GetNext Trap Response Response Response GetBulk Set SANE 2002 – p.4
generator command generator command generator command generator command responder command responder command responder command responder command notification
notification
notification receiver notification receiver Inform Get Response Response GetNext Trap Response Response Response GetBulk Set
SANE 2002 – p.4
Mappings Transport Dispatcher Message Dispatcher PDU
v3MP v2cMP v1MP Subsystem Message Processing Security Model Other Security Model User-based Security Model Community Security Subsystem Originator Notification Command Responder Proxy Forwarder Access Control View-based Access Control Subsystem MIB Instrumentation UDP IPX Command Generator Notification Receiver Notification Originator Message Processing Subsystem v2cMP v3MP v1MP Security Subsystem Security Model Security Model Community Other Security Model Transport Dispatcher Message Dispatcher PDU
Mappings UDP IPX User-based
Traditional Agent Traditional Manager Communication Network
SANE 2002 – p.5
len tag
0x02 - integer
msgID len tag
0x02 - integer
msgMaxSize len tag
0x04 - octet string
msgFlags len tag msgSecurityModel
0x02 - integer
tag len
0x30 - sequence
SNMPv3Message len tag
0x02 - integer
msgVersion len tag
0x04 - octet string
msgSecurityParameters len tag
0x30 or 0x04 - sequence or octet string
msgData len tag
0x30 - sequence
msgGlobalData len tag
0x30 - sequence
UsmSecurityParameters len tag
0x04 - octet string
msgAuthEngineID len tag
0x02 - integer
msgAuthEngBoots len tag
0x02 - integer
msgAuthEngTime len tag
0x04 - octet string
msgUserName len tag
0x04 - octet string
msgPrivParam len tag
0x04 - octet string
msgAuthParam len tag
0x04 - octet string
contextEngineID len tag
0x04 - octet string
contextName len tag
depends on PDU type
PDU len tag
0x30 - sequence
variable-bindings len tag
0x02 - integer
error-index / max-repetitions tag len error-status / non-repeaters
0x02 - integer
len tag
0x02 - integer
request-id len tag
0x30 - sequence
VarBind len tag
0x30 - sequence
VarBind len tag
0x08 - object identifier
name len tag
depends on type of value
value / exception len tag
0x08 - object identifier
name len tag
depends on type of value
value / exception
SANE 2002 – p.6
SANE 2002 – p.7
SANE 2002 – p.7
SANE 2002 – p.7
SANE 2002 – p.7
SANE 2002 – p.7
SANE 2002 – p.8
SANE 2002 – p.8
SANE 2002 – p.8
SANE 2002 – p.8
SANE 2002 – p.9
package require Tnm 3.0 proc walkproc {s stat vbl} { if {$stat == "noError"} { set i [Tnm::mib unpack [Tnm::snmp oid $vbl 0]] set o [Tnm::snmp value $vbl 0] set a [Tnm::snmp value $vbl 1] puts "[$s cget -address]\t$i\t$o\t$a" } } puts "ADDRESS\t\tIFACE\tOPER\tADMIN" foreach host $argv { set s [Tnm::snmp generator -address $host] $s walk {ifOperStatus ifAdminStatus} { walkproc %S %E "%V" } } Tnm::snmp wait exit
SANE 2002 – p.10
package require Tnm 3.0 proc checkproc {s stat vbl} { if {$stat == "noError"} { puts "[$s cget -address]\t[$s cget -community]\t$vbl" } } proc check {hosts community} { foreach h $hosts { set s [Tnm::snmp generator -address $h -community $community \
$s get sysDescr.0 { checkproc %S %E "%V"; %S destroy } } } while {! [eof stdin]} { check $argv [gets stdin] } Tnm::snmp wait exit
SANE 2002 – p.11
SANE 2002 – p.12
SANE 2002 – p.12
SANE 2002 – p.13
SANE 2002 – p.14
SANE 2002 – p.15
SANE 2002 – p.16
SANE 2002 – p.17
delete nortel bridge vlan "ˆ(134|ibr-)" # regexps are cool :-) create nortel bridge vlan 544 ibr-core create nortel bridge vlan 545 ibr-cip create nortel bridge vlan 546 ibr-test create nortel bridge vlan 547 ibr-wlan define(UP,‘25,185’) # uplink ports define(WLAN,‘2,56’) # wireless vlan define(CORE,‘1,3-24,33-55,65-88’) # core vlan include(vlan-all.scli) # create the vlans set nortel bridge vlan ports ibr-core UP,CORE set nortel bridge vlan default ibr-core CORE set nortel bridge vlan ports ibr-wlan UP,WLAN set nortel bridge vlan default ibr-wlan UP,WLAN
SANE 2002 – p.18
SANE 2002 – p.19
scli interpreter core
scli command implementations glib gsnmp stubs libxml2 curses readline history procedures
SANE 2002 – p.20
SANE 2002 – p.21
typedef struct { gint32 hrDeviceIndex; gint32 prtConsoleLightIndex; gint32 *prtConsoleOnTime; gint32 *prtConsoleOffTime; gint32 *prtConsoleColor; guchar *prtConsoleDescription; gsize _prtConsoleDescriptionLength; } printer_mib_prtConsoleLightEntry_t; extern void printer_mib_get_prtConsoleLightTable(GSnmpSession *s, printer_mib_prtConsoleLightEntry_t ***prtConsoleLightEntry, gint mask); extern void printer_mib_free_prtConsoleLightTable( printer_mib_prtConsoleLightEntry_t **prtConsoleLightEntry); /* ... more stub prototypes deleted ... */
SANE 2002 – p.22
static int show_printer_console_lights(scli_interp_t *interp, int argc, char **argv) { printer_mib_prtConsoleLightEntry_t **lightTable; int i, width = 12; if (argc > 1) return SCLI_SYNTAX; printer_mib_get_prtConsoleLightTable(interp->peer, &lightTable, 0); if (interp->peer->error_status) return SCLI_SNMP; if (lightTable) { for (i = 0; lightTable[i]; i++) { if (lightTable[i]->_prtConsoleDescriptionLength > width) width = lightTable[i]->_prtConsoleDescriptionLength; } g_string_sprintfa(interp->header, "PRINTER LIGHT %-*s STATUS COLOR", width, "DESCRIPTION"); for (i = 0; lightTable[i]; i++) { fmt_printer_console_light(interp->result, lightTable[i], width); } } if (lightTable) printer_mib_free_prtConsoleLightTable(lightTable); return SCLI_OK; }
SANE 2002 – p.23
static void fmt_printer_console_light(GString *s, printer_mib_prtConsoleLightEntry_t *lightEntry, int width) { const char *state = "off", *e; g_string_sprintfa(s, "%6d ", lightEntry->hrDeviceIndex); g_string_sprintfa(s, "%4d ", lightEntry->prtConsoleLightIndex); if (lightEntry->prtConsoleDescription) { g_string_sprintfa(s, "%-*.*s ", width, (int) lightEntry->_prtConsoleDescriptionLength, lightEntry->prtConsoleDescription); } else { g_string_sprintfa(s, "%*s", width, ""); } if (*lightEntry->prtConsoleOnTime && !*lightEntry->prtConsoleOffTime) { state = "on"; } else if (!*lightEntry->prtConsoleOnTime && *lightEntry->prtConsoleOffTime) { state = "off"; } else if (*lightEntry->prtConsoleOnTime && *lightEntry->prtConsoleOffTime) { state = "blink"; } g_string_sprintfa(s, " %-*s ", 5, state); e = fmt_enum(printer_mib_enums_prtConsoleColor, lightEntry->prtConsoleColor); g_string_sprintfa(s, "%s\n", e ? e : ""); }
SANE 2002 – p.24
void scli_init_printer_mode(scli_interp_t * interp) { static scli_cmd_t cmds[] = { { "show printer console lights", NULL, "The ‘show printer console lights’ command shows the current\n" "status of the lights attached to the printer. The command\n" "generates a table with the following columns:\n" "\n" " PRINTER logical printer number\n" " LIGHT number identifying the light/led\n" " DESCRIPTION description of the light/led\n" " STATUS current status (on, off, blink)\n" " COLOR current color of the light", SCLI_CMD_FLAG_NEED_PEER, NULL, NULL, show_printer_console_lights }, { NULL, NULL, NULL, 0, NULL, NULL, NULL } }; static scli_mode_t printer_mode = { "printer", "The scli printer mode is based on the Printer-MIB as\n" "published in RFC 1759.", cmds }; scli_register_mode(interp, &printer_mode); }
SANE 2002 – p.25
SANE 2002 – p.26