HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- scripting headache
Operating System - HP-UX
1835221
Members
2197
Online
110078
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 09:58 AM
07-05-2002 09:58 AM
scripting headache
Hi People,
I get an email sent in the event of a node down status on our routers. This passes a few variables that shows the node that went down, the time, and date e.t.c.
I currently use the snmpget command to get values of mib tables for nodes(routers) from the command line e.g
snmpget .1.3.6.1.2.1.1.3.0
I would like to incorporate a series of snmpget commands to be included in the email at the momment the command im using as automatic action(i put all this on one line) is:
ping -s $2 100 5 > /space/probpipe & echo "Subject: $A Router Down\n" > /space/probpipe & echo $A Router - Node Status $s at $x on $X Ping OUTPUT: \r > /space/probpipe & dd if=/space/probpipe | /usr/lib/sendmail -bm -F $2; /usr/bin/traceroute $2 > /space/probpipe & echo "Subject: $A Router Down\n" > /space/probpipe & echo $A Router Node Status $s at $x on $X Traceroute OUTPUT: \r > /space/probpipe & dd if=/space/probpipe | /usr/lib/sendmail -bm -F $2
(I KNOW ITS a MESS)
$2 and = hostname of the router
$x = time
$X = date
$s = status
This variables are handled automatically by NNM and when running the command in converts them to the relevant value
Basically when I get the email(I get two emails sent per event)
In my inbox I get the output of the router that went down with the time an date and ping output all one line after the other (1st email). Then I get another email after that with the output of the same router that went down with the time an date and traceroute output 1 line after the other(2nd email)
I want to try and execute more commands in the script(I dont know wether to even call it a script because its a mess but it works) e.g a series of snmpget commands with the outputs on the email.
When I tried to play around with this I get the ping outputs mixed up with the snmpget commands, sometimes the subject header gets displaye in the body of the email, it just looks AWFUL,
e.g my ideal output
New-York router down at 17:00 on 07/05/02
and a few other more
Ping output:
(ping output)
Traceroute output:
(output of trace route)
Im not much of a scripter just learning.(please be kind with me and be as basic as possible).
regards,
gab
I get an email sent in the event of a node down status on our routers. This passes a few variables that shows the node that went down, the time, and date e.t.c.
I currently use the snmpget command to get values of mib tables for nodes(routers) from the command line e.g
snmpget
I would like to incorporate a series of snmpget commands to be included in the email at the momment the command im using as automatic action(i put all this on one line) is:
ping -s $2 100 5 > /space/probpipe & echo "Subject: $A Router Down\n" > /space/probpipe & echo $A Router - Node Status $s at $x on $X Ping OUTPUT: \r > /space/probpipe & dd if=/space/probpipe | /usr/lib/sendmail -bm -F $2
(I KNOW ITS a MESS)
$2 and = hostname of the router
$x = time
$X = date
$s = status
This variables are handled automatically by NNM and when running the command in converts them to the relevant value
Basically when I get the email(I get two emails sent per event)
In my inbox I get the output of the router that went down with the time an date and ping output all one line after the other (1st email). Then I get another email after that with the output of the same router that went down with the time an date and traceroute output 1 line after the other(2nd email)
I want to try and execute more commands in the script(I dont know wether to even call it a script because its a mess but it works) e.g a series of snmpget commands with the outputs on the email.
When I tried to play around with this I get the ping outputs mixed up with the snmpget commands, sometimes the subject header gets displaye in the body of the email, it just looks AWFUL,
e.g my ideal output
New-York router down at 17:00 on 07/05/02
and a few other more
Ping output:
(ping output)
Traceroute output:
(output of trace route)
Im not much of a scripter just learning.(please be kind with me and be as basic as possible).
regards,
gab
Jesus Christ is LORD
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 10:09 AM
07-05-2002 10:09 AM
Re: scripting headache
Hi,
My apologies. I am running Solaris 2.6 with Hp openview Network Node manager. I send the emails using sendmail.
Il like to put all the commands into a shell script and ust have that file executed instead of typig all that into the automatic action command field in openview NNM.
Any help will be appreciated.
many thanks to harry d brown jr for helping and giving me a good start on this.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xab75107d277ad611abdb0090277a778c,00.html
regards,
gab
My apologies. I am running Solaris 2.6 with Hp openview Network Node manager. I send the emails using sendmail.
Il like to put all the commands into a shell script and ust have that file executed instead of typig all that into the automatic action command field in openview NNM.
Any help will be appreciated.
many thanks to harry d brown jr for helping and giving me a good start on this.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xab75107d277ad611abdb0090277a778c,00.html
regards,
gab
Jesus Christ is LORD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 10:17 AM
07-05-2002 10:17 AM
Re: scripting headache
This would be my prefered method:
mailx -m -s "${subj_var} at ${time_var} on ${date_var}" ${sendto} << __EOM__
First line of message
Ping output:
$(ping blabla)
Following makes attachment of $tmp appearing as $name.txt
$(cat $tmp | ux2dos - | uuencode ${name}.txt)
Rest of message
__EOM__
mailx -m -s "${subj_var} at ${time_var} on ${date_var}" ${sendto} << __EOM__
First line of message
Ping output:
$(ping blabla)
Following makes attachment of $tmp appearing as $name.txt
$(cat $tmp | ux2dos - | uuencode ${name}.txt)
Rest of message
__EOM__
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 10:25 AM
07-05-2002 10:25 AM
Re: scripting headache
Stick the entire set of commands in a script, and redirect the script output to mailx:
gab.ksh | mailx -s "$A Router - Node Status $s at $x"
In the script gab.ksh:
#!/usr/bin/ksh
ROUTER=$1
#
# < link speed: (from the snmp get)>
# and a few other more
# insert those commands here
print "Ping output: "
ping -s $ROUTER 100 5
print "Traceroute output: "
/usr/bin/traceroute $ROUTER
# end of script
All of the script output will be sent (in the body of the message) via mailx.
Tom
gab.ksh
In the script gab.ksh:
#!/usr/bin/ksh
ROUTER=$1
#
# < link speed: (from the snmp get)>
# and a few other more
# insert those commands here
print "Ping output: "
ping -s $ROUTER 100 5
print "Traceroute output: "
/usr/bin/traceroute $ROUTER
# end of script
All of the script output will be sent (in the body of the message) via mailx.
Tom
Carpe diem!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP