|
Table Of Contents
About the Active Monitor Library
Using the Bulk Field Change Feature
Group and Device Active Monitor Reports
Example: Monitoring Network Printer Toner levels
Script Syntax: Flow Control Keywords
Script Syntax: SimpleExpect Keyword
Using Telnet to Determine "Expect on Connect" String
Examples: Active Script Monitor Context Code
Using the Active Script Monitor Context Object
Using Active Monitors
Active Monitors query network services installed on a device, then for the response. If a response is not received or if the response does not match what is expected, the service is considered down, and a state change occurs on the device. If the query is returned with the expected response, the service is considered up. The following Active Monitor types are available in Cisco netManager:
• DNS Monitor
• NT Service Monitor
• Ping Monitor
• Active Script Monitor
• SNMP Monitor
• TCP/IP Monitor
• Telnet Monitor
Note There are several types of TCP/IP Monitors that are configured using the same dialog box.
About Monitors and Actions
The monitors and the action systems work together in Cisco netManager to help you stay informed about what is happening on your network and the devices connected to your network. It is a cooperative relationship that can be configured to go well beyond the default setting included with the installation of the product. With some helpful examples and some creativity, a network administrator should be able to tailor the monitors and actions systems to watch over all of their important devices and troubleshoot problems that may arise.
Using Monitors and Actions
When you set up actions and monitors, keep in mind the following, to help you maximize the usefulness of the features and minimize problems.
• Action Coverage. Set up your notification actions so that the people who have to be notified are sent the alert. Consider creating vacation Action types that will not send alerts to people who cannot do anything about it.
• Understanding SNMP. It will take a little research, but when you find out which of your network devices have SNMP capabilities, you can configure Monitors to listen for all types of information and trigger an Action accordingly.
• Security Features. Pay careful attention to the devices and services that are critical to your network security.
• Network Resources. Configure Cisco netManager to perform an Action when your network resource availability diminishes across a certain threshold.
• Assigning Actions to Devices or Monitors. Assign actions to the device if you only want one notification when the device goes down. Assign an action to a specific Active Monitor if it requires special attention.
About the Active Monitor Library
The Active Monitor Library is the central storehouse of all Active Monitors that have been configured for your network. When changes are made to the Active Monitors listed in this dialog box, the changes affect each instance of that particular monitor across your device groups.
Access the Active Monitor Library from the main menu of the Cisco netManager. In the web interface, click Go > Configure > Active Monitor Library.
This dialog box is used to configure new or existing active monitor types. The list shows all types currently configured for use in Cisco netManager.
•To configure a new active monitor type, click New.
• To change the current configuration of an active monitor type, select an existing type, then click Edit.
•To make a copy of that type and add it to the list, select an active monitor type, then click Copy.
• To remove an active monitor type, select it from the list, then click Delete.
Supported Active Monitors
The following is a list of all of the Active Monitor types that are supported by Cisco netManager:
• Active Script Monitor. The Active Script Monitors let you write either VBScript or JScript code to perform a check on a device. If the script returns an error code, the monitor is considered down.
Note Cisco netManager does not support the scripts that you create, only the ability to use them in the Active Script Monitor.
• DNS Monitor. The DNS monitor checks for the Domain Name Server (DNS) on port 53. If no DNS service responds on this port, then the service is considered down.
• SNMP Monitor. The Simple Network Management Protocol is the protocol governing network management and monitoring of network devices and their functions. This monitor queries the SNMP device and tries to match the expected returned value.
• Telnet Monitor. Telnet is a simple service monitor that checks for a Telnet server on port 23. If no Telnet service responds on this port, then the service is considered down.
• Ping Monitor. The Ping Monitor sends an ICMP (ping) command to the device. If the device does not respond, the monitor is considered down.
• TCP/IP Monitor. The TCP/IP Monitor is used to monitor a TCP/IP service that either does not appear in the list of standard services or uses a nonstandard port number.
Assigning Active Monitors
There are two steps in assigning an Active Monitor to a device. The first is to configure the Active Monitor in the Active Monitor Library, and the second is to add that Monitor to a device. For most users, the default configuration is sufficient and there is no need to make any changes to the Active Monitors in the library.
To configure an active monitor:
Step 1 From the web interface main menu, select Go > Configure > Active Monitor Library to view the Active Monitor Library.
Step 2 Do one of the following:
•Click New to configure a new active monitor.
•Select a monitor from the list and click Edit to make changes to an existing configuration.
Step 3 After you make the necessary changes, click OK to add the monitor to the list, or to save the changes you made to one already on the list.
To add an active monitor to a device:
Step 1 Select the active monitors you want to scan for during Device Discovery. When you select the discovered devices and add them to your database, Cisco netManager creates a monitor for each network service found.
Step 2 In the Device Properties Active Monitor dialog box, click Discover. Cisco netManager scans the device and creates a monitor for each network service found.
Step 3 Manually assign an active monitor to the device:
a. In the Device Properties Active Monitor dialog box, click Add. The Active Monitor Properties dialog box opens.
b. Select the active monitor type you want to assign to the device, then click Next.
c. Set the polling properties for the monitor, then click Next.
d. Setup actions for the monitor state changes.
e. Click Finish to add the monitor to the device.
–In the web interface, click Go > Devices > New Device. The Add New Device dialog box opens.
Step 5 Click Advance. The Device Discovery Properties dialog box opens.
Step 6 In the Select Active Monitors to be used in the scan process section, select the active monitors type you want to assign to the device.
Step 7 Click OK.
Step 8 Use Bulk Field Change to add an active monitor to multiple devices:
a. Select the devices in the device list, then right-click on one of the selected items.
b. From the right-mouse menu, select Bulk Field Change > Active Monitor.
c. Select the active monitor type you want to add.
d. Click OK.
Deleting Active Monitors
Unless you are absolutely sure you need to remove an active monitor type from the Active Monitor Library, you should never have to delete an item from this list. If you do, and you find you need it later, you will have to reconfigure it completely, including the default types that were added during initial installation of Cisco netManager. We recommended that you only delete the custom monitors that you create.
Caution When you remove an active monitor type from the library, all active monitors of that type are deleted from the devices you are monitoring, and all related report data is lost.
The best course of action is to remove the monitors at the device level or to disable the monitor by clearing the selection on the Device Properties.
To remove a monitor from a device:
Step 1 Right-click the device you want to remove the monitor from, then click Properties. The Device Properties dialog box opens.
Step 2 Click Active Monitors. The active monitors attached to the selected device displays in the list.
Step 3 Select the monitor you want to remove.
Step 4 Click Remove. A warning dialog box opens, stating that all data for that monitor will be deleted if the monitor is removed.
Step 5 Click Yes to remove the monitor.
Note If you want to stop monitoring an active monitor on a device, but want to keep the historical data, then you must disable the monitor instead of deleting it from a device.
Using the Bulk Field Change Feature
To remove an active monitor from multiple devices:
Step 1 Select the devices in the Device View or Map View, then right-click on one of the selected items. The context menu opens.
Step 2 Select Bulk Field Change > Active Monitor. The Bulk Field Change: Active Monitor dialog box opens.
Step 3 In the Operation list, click Remove.
Step 4 In the Active Monitor type list, select the active monitor that you want to remove.
Step 5 Click OK to remove the monitor from the selected devices.
Group and Device Active Monitor Reports
The following reports display information for devices or device groups that have active monitors configured and enabled. Access these reports from the Reports tab on the web interface.
• State Change Acknowledgement
• Active Monitor Availability
• Active Monitor Outage
• Health
• State Change Timeline
• State Summary
• Device Status
Example: Monitoring Network Printer Toner levels
To avoid running out of printer ink in the middle of print jobs, or wasting toner by switching toner cartridges before they are empty, through Cisco netManager you can create a custom SNMP Active Monitor that will notify you when toner levels are low.
To configure the printer monitor:
Step 1 From the Cisco netManager web interface, click Go > Configure > Active Monitor Library. The Active Monitor Library dialog box opens.
You need to create an active monitor for each printer type in use. It may be that the office uses the same printer type in each office. In this example, we are using a Hewlett Packard LaserJet 4050N. Check your network printers for their specific maximum capacity toner levels.
Step 2 Click New, select SNMP Monitor, then click OK. The Add SNMP Monitor dialog box opens.
Step 3 Enter a Name and Description for the monitor; for example, TonerMonitor and Toner monitor for the Hewlett Packard LaserJet 4050N.
For the Object ID and Instance, click the browse (...) button; then locate and find the prtMarkerSuppliesLevel (OID 1.3.6.1.2.1.43.11.1.1.9) SNMP object in the MIB object tree. This SNMP object is found in the MIB tree at:
- mgmt
- mib 2
- printmib
- prtMarkerSupplies
- prtMarkerSuppliesEntry
- prtMarkerSuppliesLevel
Step 4 Select Range of Values from the type drop down menu and enter 4600 (the maximum capacity toner level) as the High value and 100 as the Low Value, then click OK. The action will fail when the printer toner level reaches 99.
Step 5 Test the newly created active monitor and make appropriate changes, if needed.
Step 6 Assign the active monitor to the printer device by clicking Device Properties > Active Monitors.
Step 7 In the Active Monitor dialog box, click Add.
Step 8 During the configuration wizard, create or select an action to notify you when the printer's toner levels are low.
Step 9 Repeat steps 6 through 8 for each network printer that requires monitoring.
Expression Editor
Cisco netManager knows the proper connecting commands for checking the standard services listed on the Services dialog box, but to monitor a custom service, you may want to specify what commands to send to the service and what responses to expect from the service in order for Cisco netManager to consider the service up. It is up to you to determine the proper command strings to expect and send for a custom service.
You can use a rule expression to test a string of text for particular patterns.
Script Syntax
You create a script using keywords. In general, the Script Syntax is Command=String. Command is either Send, Expect, SimpleExpect or Flow Control.
Note A script can have as many send and receive lines as needed. However, the more you have, the slower the service checking.
Keywords
• To send a string to a port, use the Send= keyword.
• To expect a string from a port, use the SimpleExpect= or the Expect= keyword.
• To comment out a line, use the # symbol as the first character of the line.
• To have conditional responses on "error" or "success" of a step within the scripts, use Flow Control Keywords.
ExamplesIf you have a TCP service to check where you needed to do the following:
•Expect something on connection
•Send a command
•Check for a response
•Send something to disconnect
Script Syntax: Expect=Keyword
This keyword provides you a great amount of flexibility to accept variable responses and choose only the information you need. This is accomplished using special control characters and regular expressions. If you do not need all this flexibility or are new to writing your own custom TCP/UDP scripts, then you may want to start off using the SimpleExpect keyword first.
Variations of the Expect Keyword
There are four variations of the Expect keyword:
• Expect. Returns true when the expected value is matched.
• Expect(MatchCase). Returns true only when the case matches the expected value.
• DontExpect. Returns true when the value is not found.
• DontExpect(MatchCase). Returns true when the value is not found.
The Expect syntax has the form Expect=Response where the Response is specified either as an exact text string or as a mixture of regular expression rules and text. The Add/Edit Expect Rule button will help you construct and test a regular expression response string. It will automatically choose the variation of Expect for you based on options you select in that dialog box. The Add/Edit Expect Rule button does not aid in the generation of SimpleExpect keywords.
Note The ~, ^, ! and = = codes have been replaced with variations on the Expect keyword itself. Migrated definitions will be converted automatically.
Example 1: # # Note: script comments start with a # character # # Send a simple text command # Send = Hello There # # Expect a nice response that begins with, "Hi, How are you" # Expect=^Hi, How are you
Example 2: # # Send a command followed by CR/LF # Send=Select * from Accounts\r\n # # Expect a large response, but we only care to check that somewhere # in the response John Doe is mentioned # Expect=John Doe
Example 3: # # Send a binary escape (27) and an x y and z and then a nak (21) # Send=\x1Bxyz\x15 # # Expect something that does *not* contain 123 escape (27) # DontExpect=123\x1B
Script Syntax: Flow Control Keywords
The script language has been expanded to have conditional responses on "error" or "success" of a step within the scripts. This is done by using the following keywords:
• IfState. Checks for the current state (ok or error) and jumps to a label if true.
Valid syntax: IfState {ERR|OK} label
Example:
IfState ERR End
IfState OK Bye• Goto. This immediately jumps to a label.
Valid syntax: Goto End
Example:
Goto End• Exit. This immediately ends the script with an optional state (ok or error). The optional state overrides the current state.
Valid syntax: Exit {ERR|OK}
Example:
Exit ERR
Exit OK• :Label. This defines a label that can be the target of a jump. A label is defined by a single word beginning with the ":" character.
Valid syntax: :(with a name following)
Example:
:Bye• OnError. This allows for a global handling of an error situation.
Valid Syntax: OnError {EXIT|CONTINUE|GOTO} label
Example:
OnError EXIT (Default behavior)
OnError CONTINUE
OnError GOTO LogoffScript Syntax: Send=Keyword
To send a command on a connection, use a Send=keyword. The form is Send=Command. The command is exactly the message you want to send. You may use a combination of literal characters and binary representations.
Cisco netManager understands the C0 set of ANSI 7-bit control characters. A binary can be represented as \x##, where ## is a hexadecimal value. Those familiar with the table may also choose to use shorthand such as \A (\x01) or \W (\x17).
You can use \r and \n as the conventions for sending the carriage return and line feed control characters to terminate a line.
The following table shows the keywords you can use.
Keyword Description\x##
Binary value in hexadecimal, for example, \x1B is escape\\
The "\" character\t
The tab character (\x09)\r
The return character (\x0D)\n
The new line character \x0A)
Note The %### decimal syntax for specifying binary octets has been replaced with the \x## hexadecimal syntax. Migrated definitions will be converted automatically.
Example 1: # # Note: script comments start with a # character # # Send a simple text command # Send=Hello There
Example 2: # # Send a command followed by CR/LF # Send=Select * from Accounts\r\n
Example 3: # # Send a binary escape (27) an x y and z and then a nak (21) # Send=\x1Bxyz\x15
Script Syntax: SimpleExpect Keyword
The SimpleExpect keyword lets you specify expected responses from your server. Responses can be binary (that is, nonprintable ASCII character) responses. If you know exactly (or even approximately) what to expect you can construct a simple expect response string to match against.
This keyword allows you some flexibility in accepting variable responses and choosing only the information you need. If you need additional flexibility you may want to consider using the regular expression syntax available in the Expect Keyword.
The SimpleExpect form is SimpleExpect=Response. Where the response is just a series of characters you expect back from the service. The following table displays keywords that match logic and wildcards to compare responses byte by byte expanding escape codes as you go.
Command Options
Keyword Description\x##
Binary value in hexadecimal; for example,\x00 is null
.
Matches any character
\%
The "%" character
\.
The "." character
\\
The "\" character
Note Only the number of characters specified in the expect string are used to match the response. The response is expected to start with these characters. Any extra trailing characters received are just ignored.
Example 1: # # Note: script comments start with a # character # # Send=Hello There # # Expect a nice response # SimpleExpect=Hi, how are you?
Example 2: # # Send a command followed by CR/LF # Send=Select * from Accounts\r\n # # Expect a large response, be we only care to check that first word # received is "Customer" # SimpleExpect=Customer
Example 3: # # Send a binary escape (27) an x y and z and then a nak (21) # Send=\x1B\x15 # # Expect any byte (we don't care) then an abc and an ack (6) # SimpleExpect=.abc\x06
Send to Disconnect Examples
For a service such as FTP, the command would be QUIT/r/n. If a command string is not specified, the connection is closed by sending a FIN packet and then an RST packet.
The /r (carriage return) and /n (line feed) are the conventions for sending these control characters to terminate a string. You can use:
• /r = 0x0a
• /n = 0x0d
• /t = 0x09 or /xnn where nn is any hexadecimal value from 00 to FF
The disconnect string is:
Send=QUIT/r/n
Regular Expression Syntax
This table lists the meta-characters understood by the Cisco netManager Regex Engine.
Table 8-1 Matching a Single Character
Table 8-2 Quantifiers
Table 8-3 Matching Position
Table 8-4 Other
Table 8-5 Abbreviations
Text String Example
To check an Internet Relay Chat (IRC) service, you can send the command Version/r/n and the expected response from the IRC service is: irc.
Name: IRC; Port: 6667; TCP.
Send=Version/r/n
Expect=irc
Send=QUIT/r/n
Note You can use Telnet to find the proper value for SimpleExpect, or an Expect string for a particular service. Packet capture tools can also be very useful.
Using Telnet to Determine "Expect on Connect" String
Telnet to the desired port on the host when you are certain it is working properly, and see what comes back. You can enter just an identifying portion of a SimpleExpect or Expect keyword.
For example, if you expect to get "220 hostname.domain.com Imail v1.3" back from the host, you could use "220 host" as a response string (that is, SimpleExpect=220 host, or Expect=^220 host).
Note Some services are based on binary protocols (such as DNS) and will not provide you with a simple response string to use. You can use a packet capture tool to view these types of responses.
Using Active Script Monitor
• The Active Script Monitors let you write either VBScript or JScript code to perform a check on a device. If the script returns an error code, the monitor is considered down.
Note Cisco netManager does not support the scripts that you create, only the ability to use them in the Active Script Monitor.
• Name. The name of the monitor as it appears in the Active Monitor Library.
• Description. The description of the monitor as it appears in the Active Monitor Library.
• Timeout. The amount of time (in seconds) Cisco netManager should wait for a response to the poll.
Note Though the maximum timeout is 60 seconds, you should not use a timeout longer than the default of 10 seconds. You should use the shortest timeout possible.
• Script type. VBScript or JScript
• Script text. Write or insert your monitor code here.
• Use in discovery. Select this option to have the monitor appear in the active monitor list during discovery. From there, you can select the monitor to have Cisco netManager discover that monitor type in your devices.
This script monitor has a context object that you can use to poll for specific information about the device.
Examples: Active Script Monitor Context Code
The following table lists several active script monitor context code examples that you can use to create useful active monitors for your devices. To use these examples, select the text of the context and then copy and paste the code into the Script text box of the Active Script Monitor dialog box.
Note You may have to remove the copyright information from the cut and paste if it appears when you copy from this help file.
Table 8-6 Context Code Examples
Using the Active Script Monitor Context Object
The context object is available to the script programmer when scripts are executing. It delivers context aspects of the device that it is operating upon. All methods and properties are retrieved using the "Context" namespace.
We have provided several code samples for you to create useful Active Script Monitors for your devices.
Properties
GetProperty(sPropertyName);
This property offers access to many device-specific aspects. You obtain access to these items using the names listed. These names are case sensitive.
Properties Examples 1
JScript:
var sAddress = Context.GetProperty("Address"); var sReadCommunity = Context.GetProperty("CredSnmpV1:ReadCommunity"); var nDeviceID = Context.GetProperty("DeviceID");
JScript:
//Sending log message to the Cisco netManager Event Viewer Context.LogMessage ( "Checking Mode flag");
var nFlag = Context.GetProperty("Mode"); if (nFlag == 1) { Context.LogMessage ("Doing a discovery"); } else if (nFlag == 2) { Context.LogMessage ("Doing a poll"); } else if (nFlag == 3) { Context.LogMessage ("Must be just a test."); } else { Context.LogMessage ("Do not know the mode."); }
//Set the result code of the check (0=Success, 1=Error) Context.SetResult (0, "No error");
(GetDB);
This property returns an open connection to the Cisco netManager database.
Properties Example 2
This example gets the Open connection and reads some values out of the Cisco netManager "Device" table using the deviceID context. Please refer to the Cisco netManager Database Schema for more information about the Cisco netManager schema.
var oDb = Context.GetDB; if (null == oDb) { Context.SetResult( 1, " Problem creating the PRO DB object"); } else { var oRs = new ActiveXObject("ADODB.Recordset"); // Get the device ID var nDeviceID = Context.GetProperty("DeviceID"); var sSql = "SELECT * from Device WHERE nDeviceID = " + nDeviceID; oRs = oDb.Execute(sSql); if ( !oRs.EOF ) { var sDisplay; sDisplay = "" + oRs("sDisplayName"); Context.LogMessage("Display Name=" + sDisplay); sDisplay = "" + oRs("nWorstStateID"); Context.LogMessage("WorstStateID=" + sDisplay); sDisplay = "" + oRs("sNote"); Context.LogMessage("Note=" + sDisplay); sDisplay = "" + oRs("sStatus"); Context.LogMessage("Status=" + sDisplay); } Context.SetResult( 0, " Ok"); }
Posted: Thu Oct 18 12:08:38 PDT 2007
All contents are Copyright © 1992--2007 Cisco Systems, Inc. All rights reserved.
Important Notices and Privacy Statement.