First and foremost, thank you for all the time you are putting into helping me! I am not the best scripter (I know, it's quite obvious)!!
Here is the code I used. Note, I am including everything in the shell script that has to do with my output:
Code:
echo_info()
{
echo " "
echo "============>>> NEW Alarm Notification from SPECTRUM <<<============"
echo "=========================================================================="
echo " A ${SEV} ALARM JUST OCCURRED ON ${MNAME}"
echo "=========================================================================="
echo ""
echo "===>>> ALERT TYPE: ${ONELINE}"
echo ""
echo "Date: " $DATE
echo "Time: " $TIME
echo "Alarm Severity: " $SEV
echo "Alarm Acknowledged? " ${ACK}
echo " "
echo "########### DEVICE/MODEL INFORMATION ###########"
echo "${MNAME} is modeled on ${SERVER} "
echo "IPAddress: " $IPADDRESS
echo "ModelName: " $MNAME
echo ""
echo "Global AlarmID: " $GLOBAL_ALARM_ID
#******************************
# Test Section
#******************************
echo ""
DJL=$(printf "%s\n" "$EVENTMSG" | sed -ne "s/.*Device\s[ ]*\(.*\)/\1/p")ABC=$(printf "%s\n" "$EVENTMSG" | sed -ne 's/.*of\stype\s[ ]*\([^.]\{1,\}\).*/\1/p')printf " MODEL NAME:\t%s\n MODEL TYPE:\t%s\n" "$DJL" "$ABC"
###########################################################################
# The following parameters contain values only when
# the SPECTRUM Alarm Notification Manager is enabled.
###########################################################################
if [ "$SANM" ]
then
echo ""
echo "SANM AlarmAge Setting: ${AGE} minute(s)"
echo "NotificationData:" $NOTIFDATA
echo "" # insert blank line
fi
# This variable has substituted placeholder chars, echo them inside quotes
echo "EventMessage: $EVENTMSG"
echo ""
echo ""
}
When an alarm came in that followed the alarm filtering criteria the output is as follows:
Code:
============>>> NEW Alarm Notification from SPECTRUM <<<============
==========================================================================
A MAJOR ALARM JUST OCCURRED ON lp-webtactst01
==========================================================================
===>>> ALERT TYPE: MANAGEMENT AGENT LOST
Date: 10/03/2012
Time: 08:58:02
Alarm Severity: MAJOR
Alarm Acknowledged? No
########### DEVICE/MODEL INFORMATION ###########
lp-webtactst01 is modeled on uta-specpol01
IPAddress: 10.10.15.250
ModelName: lp-webtactst01
ModelHandle: 0x206dd0
DeviceType: Net-SNMP Linux
Mtype: Host_Device
ModelTypeHandle: 0x1160089
Global AlarmID: 506c527a-bfe8-1006-02cd-0050569d7aa8
MODEL NAME: is no longer responding to primary management requests (e.g. SNMP), but appears to be responsive to other communication protocol (e.g. ICMP). This condition has persisted for an extended amount of time. An alarm will be generated. (event [0x00010daa])
MODEL TYPE: Host_Device is no longer responding to primary management requests (e
SANM AlarmAge Setting: 0 minute(s)
NotificationData:
EventMessage: Wed 03 Oct, 2012 - 08:58:02 - Device lp-webtactst01.c.utah.com of type Host_Device is no longer responding to primary management requests (e.g. SNMP), but appears to be responsive to other communication protocol (e.g. ICMP). This condition has persisted for an extended amount of time. An alarm will be generated. (event [0x00010daa])
As you can see, I am not getting my desired outcome. I was expecting the following output:
Code:
============>>> NEW Alarm Notification from SPECTRUM <<<============
==========================================================================
A MAJOR ALARM JUST OCCURRED ON lp-webtactst01
==========================================================================
===>>> ALERT TYPE: MANAGEMENT AGENT LOST
Date: 10/03/2012
Time: 08:58:02
Alarm Severity: MAJOR
Alarm Acknowledged? No
########### DEVICE/MODEL INFORMATION ###########
lp-webtactst01 is modeled on uta-specpol01
IPAddress: 10.10.15.250
ModelName: lp-webtactst01
ModelHandle: 0x206dd0
DeviceType: Net-SNMP Linux
Mtype: Host_Device
ModelTypeHandle: 0x1160089
Global AlarmID: 506c527a-bfe8-1006-02cd-0050569d7aa8
MODEL NAME: lp-webtactst01.c.utah.com
MODEL TYPE: Host_Device
SANM AlarmAge Setting: 0 minute(s)
NotificationData:
EventMessage: Wed 03 Oct, 2012 - 08:58:02 - Device lp-webtactst01.c.utah.com of type Host_Device is no longer responding to primary management requests (e.g. SNMP), but appears to be responsive to other communication protocol (e.g. ICMP). This condition has persisted for an extended amount of time. An alarm will be generated. (event [0x00010daa])
What am I doing wrong?
Last edited by Scrutinizer; 10-07-2012 at 04:09 AM..
Reason: cleaned up formatting (spurious font definitions)
Hi all,
How can I use sed to perform a substitution if the string that I'm going to substitute is stored in a variable:
Let's say:
sed 's/abcdefg/good'
VS
tmp="abcdefg"
sed 's/$tmp/good'
The second case doesn't work. Guess it's due to the single quotes on the outside. How can I... (1 Reply)
Hi, I am getting the error
01.30 Invalid shell error
I am running the bash shell script in the korn login shell.
I have mentioned the #!/bin/bash statement in the my script but not sure why it is giving this error to me.. (4 Replies)
Here is the question...
Create a new script, sub2, taking three parameters...
1.) the string to be replaced
2.) the string with which to replace it
3.) the name of the file in which to make the substitution
...that treats the string to be replaced as plain text instead of as a regular... (1 Reply)
Guys,
May i know how can we de reference the code reference variable.?
my $a = sub{$a=shift;$b=shift;print "SUM:",($a+$b),"\n";};
print $a->(4,5);
How can we print the whole function ?
Please suggest me regarding this.
Thanks for your time :)
Cheers,
Ranga :) (0 Replies)
Hi,
I have this script which gives me output as Invalid null command
set recent_file=`grep '^-.*xlsx$' $FTP_LOG |\
sed -e 's/Jan/1/g' \
-e 's/Feb/2/g' \
-e 's/Mar/3/g' \
-e... (6 Replies)
I am trying to change a single line of a special file whose comment character is ! to show a path to the file in the comment. such as:
!!HFSS and mcm path: \Signal_Integrity\Package_SI\Section_Models\C4toTrace\28nm\D6HS\SLC_5-2-5\GZ41_ICZ\NSSS\
to a different path and replace the !!HFSS... (1 Reply)
Hi,
I need a ksh script to replace indirect directory references in an .ini file with a env variable using sed or awk.
The .ini file is for example as such:
A=..
B=../
C=../..
D=../../
E=../bin
F=../../bin
G=../../bin/xml
H=../../bin/xml/
Need to replace an instance of .. or... (2 Replies)
i have a text
20 21 22 23 24 25 26
i want to get 22 using sed back reference.
I have used sed 's/{6}\(..\).*/\1/'
but, it does not work.
I am missing something somewhere.
Please help. (5 Replies)
I have data that looks like this:
<Country code="US"><tag>adsf</tag><tag>bdfs</tag></Country><Country code="CA"><tag>asdf</tag><tag>bsdf</tag></Country>
I want to grab the country code save it, then drop each new "<..." onto a new line with the country code added to the beginning of each
So,... (9 Replies)