
A
PPENDIX
H:
TCL
P
ROGRAMMING
G
UIDE
145
Generating a User Event
TCL scripts are a powerful tool for performing true device management, in the form of customer-defined
monitoring and notification of events. A sample script is shown below:
#This script performs the monitoring of HTTP servers.
proc pstat {procname port_num} {
set psef [concat "ps -ef | grep " $procname | grep -v "grep" | wc -l]
ampexec "stty -echo\r" 5 "#" $port_num
set output [ampexec "$psef\r" 10 "#" $port_num]
ampexec "stty echo\r" 5 "#" $port_num
return [lindex $output 0]
}
# add subscription to an event here.
ampaddsubscription event.user.httpProcess “[email protected]”
# Run through 4 different servers to find out if HTTP service is running
# on each one of them and trigger an event appropriately.
for {set port_num 0} {$port_num < 4} {incr po1} {
ampclear $port_num
amplock $port_num
set output [pstat httpd $port_num]
ampunlock $port_num
if {$output > 0} {
puts "HTTP_SERVER_OK $port_num"
amptriggerevent event.user.httpProcess “HTTP service is up and running on
$port_num”
} else {
puts " HTTP_SERVER_ERROR $port_num"
amptriggerevent event.user.httpProcess “HTTP service down on $port_num”
}
}
In the Notification tab of the unit, the user can subscribe to either of the following:
event.user or event.user.httpProcess
to get this message: “HTTP service is up and running on 1”. To
subscribe to user-defined events (defined in the TCL script), the event name must be specified.
Note: This Event Name must match EXACTLY with the event name the user generated using the TCL
script.
event.user
will send out an notification whenever this event is triggered.
event.user.httpProcess
will
be sent out only when this specific event occurs. The entry must be entered in the notification tab exactly as
it appears in the script.
Summary of Contents for SX32
Page 2: ...This page intentionally left blank ...
Page 4: ...This page intentionally left blank ...
Page 78: ...68 DOMINION SX INSTALLATION AND OPERATIONS MANUAL ...
Page 90: ...80 DOMINION SX INSTALLATION AND OPERATIONS MANUAL ...
Page 94: ...84 DOMINION SX INSTALLATION AND OPERATIONS MANUAL ...
Page 102: ...92 DOMINION SX INSTALLATION AND OPERATIONS MANUAL ...
Page 106: ...96 DOMINION SX INSTALLATION AND OPERATIONS MANUAL ...
Page 108: ...98 DOMINION SX INSTALLATION AND OPERATIONS MANUAL ...
Page 122: ...112 DOMINION SX INSTALLATION AND OPERATIONS MANUAL ...
Page 134: ...124 DOMINION SX INSTALLATION AND OPERATIONS MANUAL ...
Page 174: ...164 DOMINION SX INSTALLATION AND OPERATIONS MANUAL ...
Page 177: ...APPENDIX J TECHNICAL FAQS 167 ...
Page 178: ...168 DOMINION SX INSTALLATION AND OPERATIONS MANUAL 255 60 2000 ...