Operating System - HP-UX
1753487 Members
4740 Online
108794 Solutions
New Discussion юеВ

Re: script to email ping output

 
SOLVED
Go to solution
Seun Ewulomi_1
Honored Contributor

script to email ping output

Hi Guys,

My scripting is less to be desired for. Just bear with me. I have a script /opt/OV/bin/scripts/alarm with just the line see below (doesn't even count as a script it just contains one line) to mail me when a router goes down.

mailx -s "Router Down"

The script is called alarm in /opt/OV/bin/scripts/alarm

I have the following line for the automatic action on Openview Node manager
echo $A Router down at Sx on SX | /opt/OV/bin/scripts/alarm
$A = node name
$x = time
$X = date
The above are pre-defined variables within NNM

in the /opt/OV/bin/scripts/alarm executable I have just the line to mail a user.
mailx -s "Router Down" seun.ewulomi@arup.com

When a router goes down I get a mail as shown below in my microsoft exchange email

Boston Router down at 17:05:08 on 06/10/02

I will like to be able to add ping output(below) emailed as well within the email sent. I will be using the ping command as per below
ping -s 100 10

How can I extend the script to contain the ping output show by the command above
Please Any suggestions will be greatly appreciated.

regards,
gab
Jesus Christ is LORD
5 REPLIES 5
Seun Ewulomi_1
Honored Contributor

Re: script to email ping output

Hi,

My apologies. I am running Solaris 2.6 with Hp openview Network Node manager

regards,
gab
Jesus Christ is LORD
harry d brown jr
Honored Contributor

Re: script to email ping output


Create a named pipe:

mknod /tmp/probpipe p

ping vpart2 100 10 >/tmp/probpipe &


echo HELLO WORLD>/tmp/probpipe &


dd if=/tmp/probpipe | /opt/OV/bin/scripts/alarm

live free or die
harry
Live Free or Die
Seun Ewulomi_1
Honored Contributor

Re: script to email ping output

Hi harry,

Dont seem to have got this working.
the command ping vpart2 100 10 >/tmp/probpipe &

what is vpart2. Do you mean the parameters e.g -s

I presume I will put
dd if=/tmp/probpipe | /opt/OV/bin/scripts/alarm - in the automatic action within NNM

Sorry for being naive but I have to ask these questions.

regards,
gab
Jesus Christ is LORD
harry d brown jr
Honored Contributor
Solution

Re: script to email ping output

Gab,

Sorry, I left my system name on the "ping" line, try this:

Put the "ping", the "echo", AND the "dd" in the same spot:


ping -s 100 10 > /tmp/probpipe &

echo $A Router down at $x on $X > /tmp/probpipe &

dd if=/tmp/probpipe | /opt/OV/bin/scripts/alarm


live free or die
harry
Live Free or Die
Seun Ewulomi_1
Honored Contributor

Re: script to email ping output

Hi Harry,

It worked like a charm. I have even extended it to send me a traceroute output aswell.

Feel free to visit us on the otherside of the HP forum world with any queries relating to OpenView Network Node Manager.

Thank you very much.

regards,
gab
Jesus Christ is LORD