ALARMPROGRAM
Posted in 1997
In my ALARMPROGRAM, I tried to modify the Log Complete part of the case
statement, to page me if the logs where greater than a certain percentag
full. It is not working. The alarm program is called, and this part of
the case statement completes, but the page is never sent. I put a line
at the end of this, to print some values to a file, but, the CURR_PCT and
MAX PCT return no values.
Now I've cut this out to a separate script file, and run it and it runs
fine. I think its something that when its called by the Log completeing,
maybe the syslogs table is still being updated and the query does not
work??? I've put a sleep in there, but that did not help. If anyone can
give me a hand I would be very appreciative.
Thanks in advance.
JP
23) class_text="Logical Log Complete"
# how many logs are full now (in %) ?
#################################################################
USED_LOGS=`echo "select count (*) \\
from syslogs \\
where is_used = 1 \\
and is_backed_up = 0" |
dbaccess sysmaster - 2>/dev/null | sed
's/[^0-9]*[\\n]*//g' |
sed '/^$/ d' `
MAX_LOGS=`echo "select count (*) \\
from syslogs" |
dbaccess sysmaster - 2>/dev/null | sed
's/[^0-9]*[\\n]*//g' | sed
'/^$/ d' `
# how many logs are full now (in %) ?
CURR_PCT=`expr "$USED_LOGS" "*" "100" "/" "$MAX_LOGS"`
#################################################################
# if we're over the threshhold set in MAX_PCT, try to backup
if [ "$CURR_PCT" -ge "$MAX_PCT" ] ; then
mail -s "LOGICAL LOGS" team818@mh1.panasonic.com <<EOF
The LOGICAL LOGS ARE $CURR_PCT % FULL on $HOST this
message is sent if logs are more than $MAX_PCT FULL
EOF
echo "$CURR_PCT $MAX_PCT $MAX_LOGS" > $INFORMIXDIR/etc/log.text
fi
;;