
198
Configuring a monitor policy
You can configure a monitor policy by using the CLI or Tcl.
Configuration restrictions and guidelines
When you configure monitor policies, follow these restrictions and guidelines:
•
Make sure the actions in different policies do not conflict. Policy execution result will be
unpredictable if policies that conflict in actions are running concurrently.
•
You can assign the same policy name to a CLI-defined policy and a Tcl-defined policy, but you
cannot assign the same name to policies that are the same type.
•
The system executes the actions in a policy in ascending order of action IDs. When you add
actions to a policy, you must make sure the execution order is correct.
Configuring a monitor policy from the CLI
Step Command
Remarks
1.
Enter system view.
system-view
N/A
2.
Enter CLI-defined
policy view.
rtm cli-policy
policy-name
If the policy does not exist, this
command creates the policy first.
3.
Configure an event in
the policy.
•
Configure a CLI event:
event cli
{
async
[
skip
] |
sync
}
mode
{
execute
|
help
|
tab
}
pattern
regular-exp
•
Configure a hotplug event:
event hotplug
[
slot
slot-number
]
•
Configure an interface event:
event interface
interface-type
interface-number
monitor-obj
monitor-obj
start-op
start-op
start-val
start-val restart-op
restart-op restart-val restart-val
[
interval interval
]
•
Configure a process event:
event process
{
exception
|
restart
|
shutdown
|
start
}
[
name
process-name
[
instance
instance-id
] ]
[
slot
slot-number
]
•
Configure an SNMP event:
event snmp
oid
oid
monitor-obj
{
get
|
next
}
start-op
start-op
start-val start-val
restart-op
restart-op
restart-val restart-val
[
interval
interval
]
•
Configure an SNMP-Notification
event:
event snmp
-
notification oid
oid
oid-val
oid-val
op
op
[
drop
]
•
Configure a Syslog event:
event syslog priority level msg msg
occurs times period period
By default, a monitor policy does
not contain an event.
You can configure only one
event in a monitor policy. If the
monitor policy already contains
an event, the new event
overrides the old event.
4.
Configure the actions
to take when the
event occurs.
•
Configure the action to execute a
command:
action number
cli command-line
By default, a monitor policy does
not contain any actions.