A few changes for scotty-2.0.2 and its use with tkined 1.3.4

John P. Rouillard (rouilj@dstar.iddis.com)
Tue, 07 Nov 1995 21:09:32 -0500

There are two files that are patched by my patches
below. scotty-2.0.2/tkined/Makefile.in and
scotty-2.0.2/tkined/library.tcl.

Patching the Makefile.in is caused by my keeping the source code under
CVS control. CVS doesn't like the symbolic links that are provided to
keep mibtree in sync with its real source file. The diff adds support
to the Makefile to make the mibtree program by copying it from its
parent file.

The second patch is actually useful. I wanted to create a default
ThresholdAction for all of the icons that are associated with
IP_Monitor. With this patch you can add:

monitor.Monitor.ThresholdAction: syslog write flash

to your .tkined file and get the default action when the node doesn't
define its own Monitor:ThresholdAction attribute. If the node has the
Monitor:ThresholdAction attribute, the nodes attribute is used.

To turn off the default monitor for a node (useful for temprarily
shutting up a warning on a stripchart for round trip times without
disabiling the display on the chart), just set the
Monitor:ThresholdAction attribute on the stripchart to "none" or some
other string that doesn't contain the action words.

While I was at it, I also added support for:

monitor.Monitor.RisingThreshold: 10
monitor.Monitor.FallingThreshold: 5

type defaults, although I can't see them being very useful.

One item to add to the wish list is the ability to bundle defaults
inherited from the tkined.defaults file into the map. A fast hack for
doing this would be to be able to set a variable to be the contents of
a tkined.defaults file, and parse that string after loading the
tkined.defaults file.

Well here are the diffs against a stock scotty-2.0.2 installation.

Index: Makefile.in
===================================================================
RCS file: /sources/cvsrepos/scotty_tkined/scotty-2/tkined/Makefile.in,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 Makefile.in
*** Makefile.in 1995/11/01 22:14:28 1.1.1.2
--- Makefile.in 1995/11/07 23:43:33
***************
*** 50,59 ****
snmp_cisco.tcl snmp_hp.tcl snmp_tubs.tcl \
cmip_trouble.tcl clock.tcl game.tcl

! all: tclIndex

$(SRC_DIR)/tclIndex: ../scotty $(SRC_DIR)/library.tcl
../scotty -nc "cd $(SRC_DIR); auto_mkindex . library.tcl; exit"

install: $(SRC_DIR)/tclIndex
@if [ ! -d $(APPS_DIR) ] ; then \
--- 50,62 ----
snmp_cisco.tcl snmp_hp.tcl snmp_tubs.tcl \
cmip_trouble.tcl clock.tcl game.tcl

! all: tclIndex mibtree

$(SRC_DIR)/tclIndex: ../scotty $(SRC_DIR)/library.tcl
../scotty -nc "cd $(SRC_DIR); auto_mkindex . library.tcl; exit"
+
+ mibtree: ../examples/mibtree
+ cp ../examples/mibtree .

install: $(SRC_DIR)/tclIndex
@if [ ! -d $(APPS_DIR) ] ; then \
Index: library.tcl
===================================================================
RCS file: /sources/cvsrepos/scotty_tkined/scotty-2/tkined/library.tcl,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 library.tcl
*** library.tcl 1995/11/01 22:14:37 1.1.1.2
--- library.tcl 1995/11/08 01:21:34
***************
*** 519,530 ****
}

proc MoJoCheckThreshold { id txt value {unit ""} } {

set action [ined attribute $id "Monitor:ThresholdAction"]
! if {$action == ""} return

set rising [ined attribute $id Monitor:RisingThreshold]
set falling [ined attribute $id Monitor:FallingThreshold]
if {$rising == "" && $falling == ""} return

for {set i 0} {$i < [llength $value]} {incr i} {
--- 519,549 ----
}

proc MoJoCheckThreshold { id txt value {unit ""} } {
+ global default

set action [ined attribute $id "Monitor:ThresholdAction"]
! if {$action == ""} {
! if {[info exists default(Monitor.ThresholdAction)]} {
! set action $default(Monitor.ThresholdAction)
! } else {
! return
! }
! }

set rising [ined attribute $id Monitor:RisingThreshold]
+ if {$rising == ""} {
+ if {[info exists default(Monitor.RisingThreshold)]} {
+ set rising $default(Monitor.RisingThreshold)
+ }
+ }
+
set falling [ined attribute $id Monitor:FallingThreshold]
+ if {$falling == ""} {
+ if {[info exists default(Monitor.FallingThreshold)]} {
+ set falling $default(Monitor.FallingThreshold)
+ }
+ }
+
if {$rising == "" && $falling == ""} return

for {set i 0} {$i < [llength $value]} {incr i} {
***************
*** 551,558 ****
##

proc MoJoAction { id msg } {
set action [ined attribute $id "Monitor:ThresholdAction"]
! if {$action == ""} return

if {[lsearch $action syslog] >= 0} {
syslog warning $msg
--- 570,586 ----
##

proc MoJoAction { id msg } {
+
+ global default
+
set action [ined attribute $id "Monitor:ThresholdAction"]
! if {$action == ""} {
! if {[info exists default(Monitor.ThresholdAction)]} {
! set action $default(Monitor.ThresholdAction)
! } else {
! return
! }
! }

if {[lsearch $action syslog] >= 0} {
syslog warning $msg

-- John
John Rouillard
===============================================================================
My employers don't acknowledge my existence much less my opinions.