fun little patch for ip_monitor.tcl

Doug Hughes (Doug.Hughes@Eng.Auburn.EDU)
Thu, 21 Sep 1995 14:03:27 -0500

I wrote a little patch to ip_monitor.tcl. Normally, tkined will
blink and flash red if a machine goes down, and then return to normal
when it comes back up again. What I wanted was a way to know if a machine
had gone down and I wasn't around. So, I modified ip_monitor.tcl
(part of scotty but integrated into tkined) so that when a machine comes
back up, it turns blue. Also, the group icon it is a part of turns
blue (if it's part of a group). Also, in IP-Monitor under
Round Trip Time I added a button that says "Acknowledge". This way you
can select all of the blue icons and acknowledge that you see they
were down, and they return to their normal color. If you select a group
and do an acknowledge, it acknowledges all the icons within that group.

*** ip_monitor.tcl.orig Tue Sep 19 11:21:14 1995
--- ip_monitor.tcl Tue Sep 19 14:04:03 1995
***************
*** 61,66 ****
--- 61,95 ----
}

##
+ ## Once an icon has turned blue, we need to acknowledge it to
+ ## Get it back to its original color
+ ##
+
+ proc Acknowledge { list } {
+ global reachability_color
+
+ if {![info exists reachability_ids]} { set reachability_ids "" }
+
+ foreach litem $list {
+ set type [lindex $litem 0]
+ set id [lindex $litem 1]
+ if {$type == "GROUP"} {
+ ined -noupdate color $id $reachability_color($id)
+ set reachability_color($id) ""
+ foreach m [ined member $id] {
+ if {[ined type $m] != "NODE"} { continue }
+ if {[ined color $m] == "blue"} {
+ ined -noupdate color $m $reachability_color($m)
+ set reachability_color($m) ""
+ }
+ }
+ }
+ set reachability_color($id) ""
+ ined -noupdate color $id $reachability_color($id)
+ }
+ }
+
+ ##
## Restart a monitor job by calling cmd. Build the list of objects
## from tkined using ined retrieve commands.
##
***************
*** 177,182 ****
--- 206,219 ----
set reachability_color($id) [ined -noupdate color $id]
set reachability_label($id) [ined -noupdate label $id]
ined -noupdate color $id red
+ exec echo "[ined name $id] is down - [exec date]" | /usr/ucb/mail -s "host [ined name $id] is down" help
+ set p [ined parent $id]
+ if {$p != ""} {
+ if {[ined type $p] == "GROUP"} {
+ set reachability_color($p) [ined -noupdate color $p]
+ ined -noupdate color $p red
+ }
+ }
}
ined flash $id [expr {[[job current] interval] / 1000}]
ined -noupdate attribute $id \
***************
*** 188,194 ****
} else {
if {$reachability_color($id) != ""} {
ined -noupdate color $id $reachability_color($id)
! set reachability_color($id) ""
}
if {$reachability_label($id) != ""} {
ined -noupdate label $id $reachability_label($id)
--- 225,239 ----
} else {
if {$reachability_color($id) != ""} {
ined -noupdate color $id $reachability_color($id)
! ined -noupdate color $id blue
! # set reachability_color($id) ""
! set p [ined parent $id]
! if {$p != ""} {
! if {[ined type $p] == "GROUP"} {
! ined -noupdate color $p $reachability_color($p)
! ined -noupdate color $p blue
! }
! }
}
if {$reachability_label($id) != ""} {
ined -noupdate label $id $reachability_label($id)
***************
*** 1002,1008 ****
}

set menus [ ined create MENU "IP-Monitor" \
! "Check Reachability" "Round Trip Time" "" \
"NTP Offset" "" \
"System Load" "CPU Activity" \
"Disk Activity" "Interface Activity" "" \
--- 1047,1053 ----
}

set menus [ ined create MENU "IP-Monitor" \
! "Check Reachability" "Round Trip Time" "Acknowledge" "" \
"NTP Offset" "" \
"System Load" "CPU Activity" \
"Disk Activity" "Interface Activity" "" \

You'd want to change the exec that sends mail. All this does is send
mail to the 'help' alias we have local here when a machine goes down.
Either comment it out or change it to reflect your site if you decide
to use it.

Versions: scotty-2.0.0 (tkined version should be completely irrelevant)

May work on others (I think ip_monitor.tcl has remained relatively
constant throughout the revisions)

Doug Hughes Engineering Network Services
doug@eng.auburn.edu Auburn University