Редактиране

Споделяне чрез


smi2smir

The SNMP compiler runs as a single executable file in the command-line mode. The compiler accepts one SNMP information module as input, and accepts any additional modules necessary to resolve external references. Use one of the following command-line syntax examples.

For more information about when this compiler is used, see Setting up the WMI SNMP Environment.

smi2smir [<DiagnosticArgs>] [<VersionArgs>]
     <CommandArgs> <MIB file> [<Import Files>]

smi2smir [<DiagnosticArgs>] <RegistryArgs> [<Directory>]

smi2smir <ModuleInfoArgs> <MIB file>

smi2smir <HelpArgs>

Switches

<DiagnosticArgs>

The compiler accepts the following diagnostic arguments.

/m <diagnostic-level>

Type of diagnostics to display. The default is 2.

The following is a list of the diagnostic level values that can be set:

  • 0 = Silent
  • 1 = Fatal
  • 2 = Fatal and warning
  • 3 = Fatal, warning, and information messages

/c <count>

Maximum number of fatal and warning messages to display; count must be a positive decimal integer. If /c is not specified, there is no limit to the number of errors that can be reported.

<VersionArgs>

The compiler accepts the following version arguments.

/v1

Specifies strict conformance to the SNMPv1 SMI. The compiler reports an error if it detects non-SNMPv1 statements.

/v2c

Specifies strict conformance to the SNMPv2 SMI. The compiler reports an error if it detects non-SNMPv2 statements.

<CommandArgs>

The compiler accepts the following command arguments.

/d

Deletes the specified module from the SMIR.

/p

Deletes all modules in the SMIR.

/l

Lists all modules in the SMIR.

/lc

Performs a local syntax check on the module.

/ec [<CommandModifier>]

Performs local and external checks on the module.

/a[<CommandModifier>]

Performs local and external checks and loads the module into the SMIR.

/sa[<CommandModifier>]

Same as /a, but works silently.

/g[<CommandModifier>]

Generates a SMIR .mof file that you can later load into WMI using the MOF compiler. Used by the SNMP class provider to provide classes dynamically to one or more namespaces. Use this option when you do not know which MIBs are supported by the SNMP devices being managed. The SNMP class provider checks the device at runtime for the presence of this MIB and supplies the classes dynamically to the namespace.

/gc[<CommandModifier>]

Generates a static .mof file that can be loaded later into WMI as static classes for a particular namespace. Use this option when you know which MIBs are supported by the SNMP devices being managed. You can define the .mof file to be generated by directing the output of your command to a specified file. Do not use with /ext/o.

<CommandModifiers>

The compiler accepts the following command modifiers.

/i<directory>

Specifies a directory to be searched for dependent MIB modules. Use with /a, /ec, /g, /gc, and /sa. The /i option can appear multiple times in the command; directories are searched in the order specified in the command.

/ch

Generates context information, such as the date, time, host, or user, in the MOF file header. Use with /g and /gc.

/t

Generates SnmpNotification classes. Use with /a, /g, and /sa.

/ext

Generates SnmpExtendedNotification classes. Use with /a, /g, and /sa.

/t/o

Generates only SnmpNotification classes. Use with /a, /g, and /sa.

/ext/o

Generates only SnmpExtendedNotification classes. Use with /a, /g, and /sa.

/s

Does not map the text of the DESCRIPTION clause. Use with /a, /g, /gc, and /sa. Use this option when you want to minimize storage requirements.

/auto

Rebuilds the MIB lookup table before completing the <CommandArg> switch. Use with /a, /ec, /g, and /gc.

<RegistryArgs>

The compiler accepts the following registry arguments.

/pa

Adds the specified directory to the registry. The default is the current directory.

/pd

Deletes the specified directory from the registry. The default is the current directory.

/pl

Lists the MIB lookup directories in the registry.

/r

Rebuilds the entire MIB lookup table.

<ModuleInfoArgs>

The compiler accepts the following module information arguments.

/n

Returns the ASN.1 name of the specified module.

/ni

Returns the ASN.1 names of all import modules referred to by the input module.

<HelpArgs>

The compiler accepts the following help arguments.

/h

Displays help on the SNMP compiler syntax.

/?

Displays help on the SNMP compiler syntax.

Remarks

SNMP information modules are written in a subset of the Abstract Syntax Notation One (ASN.1) The compiler performs the following functions:

  • Loads the data from the SNMP information module.

  • Performs checking operations on the information module. For example, it checks the local syntax and it checks external references against information in the subsidiary modules.

  • Removes all previously loaded data from the SMIR, or removes data loaded from one information module.

  • Returns the ASN.1 module name of a specified file or returns the ASN.1 module names of all imported modules in a specified file.

  • Returns the ASN.1 module names of all SNMP information modules currently loaded in the SMIR.

  • Performs automatic resolution of imported modules rather than requiring users to specify the required modules manually.

  • Performs a silent-loading mode of operation that does not generate any output, but can be used to load data into the SMIR during an installation operation.

  • Outputs the data from the SNMP information module into the SMIR.

  • Optionally creates a static or SMIR MOF file containing the output from the information module.

    If necessary, you can load the static .mof file into a WMI namespace. A SMIR .mof file contains the name of the SNMP namespace in which the classes should reside.

Examples

The following example defines the pra.mof file to be the output from the pra.mib file.

smi2smir /m 3 /v1 /gc /pra.mib > pra.mof

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008

See also

SNMP Compiler Error Messages

Setting up the WMI SNMP Environment

Accessing SNMP Devices