Quote:
Originally Posted by era
Show us the code.
|
Hi the code is as following
#!/bin/sh
#WORKDIR='X:/Tivoli/bin/w32-ix86/TME/TEC/TCS_ACTIVE/TECTASK'
email_id=`perl X:/Tivoli/bin/w32-ix86/TME/TEC/TCS_ACTIVE/TECTASK/ip_mail.pl $hostname`
echo "|$email_id|\n"
#echo "|$branch|\n"
#echo "|$location|\n"
branch=`echo $email_id|cut -d ";" -f 1`
location=`echo $email_id|cut -d ";" -f 2`
email=`echo $email_id|cut -d ";" -f 3`
to_email_id=`echo $email|cut -d ":" -f 1`
cc_email_id=`echo $email|cut -d ":" -f 2`
alias_name=`echo $email|cut -d ":" -f 3`
TO=$to_email_id
CC=$cc_email_id
MAIL_MESSAGE="
Dear Administrator,\n
Tivoli Monitoring event received with the following information :\n
\n
HostName : $hostname\n
IP_Address : $origin\n
SITUATION : $situation_name \n
Severity : $severity\n
Cause : $situation_displayitem\n
Occurence : $situation_time\n
\n
The details of the event are as below :\n
\n
Message : The Logical VOlume $situation_displayitem on the server $hostname is $pct__used % full. Currently the free space is $free_megabytes MB.\n
\n
To view the current status of the server, log on to \n
http://XX.XX.XX.XX///cnp/kdh/lib/cnp.html
\n
Note: This is a auto generated email please do not reply back.\n
In case of any queries please contact local Tivoli Coordinators.\n
\n
\n
SUBJECT="The Situation $situation_name triggered on the server $hostname "
X="$(X:/sendEmail -f tivoli.monitoring@tcs.com -t $TO -cc $CC -u $SUBJECT -m "$MAIL_MESSAGE" -s XX.XX.XX.XX)"
echo "$branch;$location;$hostname;$situation_name;$X to $TO " >>X:/mail.log
echo "$branch;$location;$hostname;$situation_name;$timestamp;$msg;$TO;$X" >>X:/event.log
X:/count/disk_mail.sh $cms_hostname $situation_name $situation_origin $origin $adapter_host $timestamp $TO $CC
The last line in bold is where i am calling the db2 stored procedure from the shell file disk_mail.sh. All the above code is ment for sending the email based on the parameters recived from Tivoli.
Db2 stored procedure is inside X:/count/disk_mail.sh and this has the following code.
db2cmd /w /i << EOF
echo "--------------------------------------------------------------------------------------------------------" >> "X:/reports/track_disk.txt"
db2 connect to XXXX User XXXX using XXXX
db2 call ITMUSER.MAIL_TRACK_SP('$1','$2','$3',current_timestamp,'$4','$5','$6','$7','$8') >> "X:/reports/track_disk.txt"
EOF
echo "inserted values sucessfully $2 $3" >> "X:/reports/track_disk.txt"
echo "---------------------------------------------------------------------------------------------------------" >> "X:/reports/track_disk.txt"