<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic scripting headache in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-headache/m-p/2758602#M71897</link>
    <description>Hi People,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;I currently use the snmpget command to get values of mib tables for nodes(routers) from the command line e.g&lt;BR /&gt;&lt;BR /&gt;snmpget &lt;HOSTNAME&gt; .1.3.6.1.2.1.1.3.0 &lt;BR /&gt;&lt;BR /&gt;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:&lt;BR /&gt;&lt;BR /&gt;ping -s $2 100 5 &amp;gt; /space/probpipe &amp;amp; echo "Subject: $A Router Down\n" &amp;gt; /space/probpipe &amp;amp; echo $A Router - Node Status $s at $x on $X Ping OUTPUT: \r &amp;gt; /space/probpipe &amp;amp; dd if=/space/probpipe | /usr/lib/sendmail -bm -F $2 &lt;EMAIL address=""&gt;; /usr/bin/traceroute $2 &amp;gt;  /space/probpipe &amp;amp; echo "Subject: $A Router Down\n" &amp;gt; /space/probpipe &amp;amp; echo $A Router Node Status $s at $x on $X Traceroute OUTPUT: \r &amp;gt; /space/probpipe &amp;amp; dd if=/space/probpipe | /usr/lib/sendmail -bm -F $2 &lt;EMAIL address=""&gt;&lt;BR /&gt;&lt;BR /&gt;(I KNOW ITS a MESS)&lt;BR /&gt;&lt;BR /&gt;$2 and = hostname of the router &lt;BR /&gt;$x = time&lt;BR /&gt;$X = date&lt;BR /&gt;$s = status&lt;BR /&gt;This variables are handled automatically by NNM and when running the command in converts them to the relevant value&lt;BR /&gt;&lt;BR /&gt;Basically when I get the email(I get two emails sent per event) &lt;BR /&gt;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)&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;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,&lt;BR /&gt;&lt;BR /&gt;e.g my ideal output&lt;BR /&gt;&lt;BR /&gt;New-York router down at 17:00 on 07/05/02&lt;BR /&gt;&lt;BR /&gt;&lt;SYS up=""&gt;&lt;BR /&gt;&lt;LINK /&gt;&lt;BR /&gt;and a few other more&lt;BR /&gt;&lt;BR /&gt;Ping output:&lt;BR /&gt;&lt;BR /&gt;(ping output)&lt;BR /&gt;&lt;BR /&gt;Traceroute output:&lt;BR /&gt;&lt;BR /&gt;(output of trace route)&lt;BR /&gt;&lt;BR /&gt;Im not much of a scripter just learning.(please be kind with me and be as basic as possible).&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;gab&lt;/SYS&gt;&lt;/EMAIL&gt;&lt;/EMAIL&gt;&lt;/HOSTNAME&gt;</description>
    <pubDate>Fri, 05 Jul 2002 16:58:02 GMT</pubDate>
    <dc:creator>Seun Ewulomi_1</dc:creator>
    <dc:date>2002-07-05T16:58:02Z</dc:date>
    <item>
      <title>scripting headache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-headache/m-p/2758602#M71897</link>
      <description>Hi People,&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;I currently use the snmpget command to get values of mib tables for nodes(routers) from the command line e.g&lt;BR /&gt;&lt;BR /&gt;snmpget &lt;HOSTNAME&gt; .1.3.6.1.2.1.1.3.0 &lt;BR /&gt;&lt;BR /&gt;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:&lt;BR /&gt;&lt;BR /&gt;ping -s $2 100 5 &amp;gt; /space/probpipe &amp;amp; echo "Subject: $A Router Down\n" &amp;gt; /space/probpipe &amp;amp; echo $A Router - Node Status $s at $x on $X Ping OUTPUT: \r &amp;gt; /space/probpipe &amp;amp; dd if=/space/probpipe | /usr/lib/sendmail -bm -F $2 &lt;EMAIL address=""&gt;; /usr/bin/traceroute $2 &amp;gt;  /space/probpipe &amp;amp; echo "Subject: $A Router Down\n" &amp;gt; /space/probpipe &amp;amp; echo $A Router Node Status $s at $x on $X Traceroute OUTPUT: \r &amp;gt; /space/probpipe &amp;amp; dd if=/space/probpipe | /usr/lib/sendmail -bm -F $2 &lt;EMAIL address=""&gt;&lt;BR /&gt;&lt;BR /&gt;(I KNOW ITS a MESS)&lt;BR /&gt;&lt;BR /&gt;$2 and = hostname of the router &lt;BR /&gt;$x = time&lt;BR /&gt;$X = date&lt;BR /&gt;$s = status&lt;BR /&gt;This variables are handled automatically by NNM and when running the command in converts them to the relevant value&lt;BR /&gt;&lt;BR /&gt;Basically when I get the email(I get two emails sent per event) &lt;BR /&gt;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)&lt;BR /&gt;&lt;BR /&gt;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.&lt;BR /&gt;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,&lt;BR /&gt;&lt;BR /&gt;e.g my ideal output&lt;BR /&gt;&lt;BR /&gt;New-York router down at 17:00 on 07/05/02&lt;BR /&gt;&lt;BR /&gt;&lt;SYS up=""&gt;&lt;BR /&gt;&lt;LINK /&gt;&lt;BR /&gt;and a few other more&lt;BR /&gt;&lt;BR /&gt;Ping output:&lt;BR /&gt;&lt;BR /&gt;(ping output)&lt;BR /&gt;&lt;BR /&gt;Traceroute output:&lt;BR /&gt;&lt;BR /&gt;(output of trace route)&lt;BR /&gt;&lt;BR /&gt;Im not much of a scripter just learning.(please be kind with me and be as basic as possible).&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;gab&lt;/SYS&gt;&lt;/EMAIL&gt;&lt;/EMAIL&gt;&lt;/HOSTNAME&gt;</description>
      <pubDate>Fri, 05 Jul 2002 16:58:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-headache/m-p/2758602#M71897</guid>
      <dc:creator>Seun Ewulomi_1</dc:creator>
      <dc:date>2002-07-05T16:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: scripting headache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-headache/m-p/2758603#M71898</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;My apologies. I am running Solaris 2.6 with Hp openview Network Node manager. I send the emails using sendmail.&lt;BR /&gt;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.&lt;BR /&gt;&lt;BR /&gt;Any help will be appreciated.&lt;BR /&gt;&lt;BR /&gt;many thanks to harry d brown jr for helping and giving me a good start on this.&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xab75107d277ad611abdb0090277a778c,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xab75107d277ad611abdb0090277a778c,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards, &lt;BR /&gt;gab&lt;BR /&gt;</description>
      <pubDate>Fri, 05 Jul 2002 17:09:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-headache/m-p/2758603#M71898</guid>
      <dc:creator>Seun Ewulomi_1</dc:creator>
      <dc:date>2002-07-05T17:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: scripting headache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-headache/m-p/2758604#M71899</link>
      <description>This would be my prefered method:&lt;BR /&gt;mailx -m -s "${subj_var} at ${time_var} on ${date_var}" ${sendto} &amp;lt;&amp;lt; __EOM__&lt;BR /&gt;First line of message&lt;BR /&gt;&lt;BR /&gt;Ping output:&lt;BR /&gt;$(ping blabla)&lt;BR /&gt;&lt;BR /&gt;Following makes attachment of $tmp appearing as $name.txt&lt;BR /&gt;$(cat $tmp | ux2dos - | uuencode ${name}.txt)&lt;BR /&gt;&lt;BR /&gt;Rest of message&lt;BR /&gt;&lt;BR /&gt;__EOM__&lt;BR /&gt;</description>
      <pubDate>Fri, 05 Jul 2002 17:17:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-headache/m-p/2758604#M71899</guid>
      <dc:creator>Rich Wright</dc:creator>
      <dc:date>2002-07-05T17:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: scripting headache</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/scripting-headache/m-p/2758605#M71900</link>
      <description>Stick the entire set of commands in a script, and redirect the script output to mailx:&lt;BR /&gt;&lt;BR /&gt;gab.ksh &lt;ROUTER_NAME&gt; | mailx -s "$A Router - Node Status $s at $x" &lt;EMAIL address=""&gt; &lt;BR /&gt;&lt;BR /&gt;In the script gab.ksh:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;&lt;BR /&gt;ROUTER=$1&lt;BR /&gt;&lt;BR /&gt;# &lt;SYS up=""&gt; &lt;BR /&gt;# &amp;lt; link speed: (from the snmp get)&amp;gt; &lt;BR /&gt;# and a few other more &lt;BR /&gt;# insert those commands here&lt;BR /&gt;&lt;BR /&gt;print "Ping output: "&lt;BR /&gt;&lt;BR /&gt;ping -s $ROUTER 100 5&lt;BR /&gt;&lt;BR /&gt;print "Traceroute output: "&lt;BR /&gt;&lt;BR /&gt;/usr/bin/traceroute $ROUTER &lt;BR /&gt;&lt;BR /&gt;# end of script&lt;BR /&gt;&lt;BR /&gt;All of the script output will be sent (in the body of the message) via mailx.&lt;BR /&gt;&lt;BR /&gt;Tom&lt;BR /&gt;&lt;/SYS&gt;&lt;/EMAIL&gt;&lt;/ROUTER_NAME&gt;</description>
      <pubDate>Fri, 05 Jul 2002 17:25:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/scripting-headache/m-p/2758605#M71900</guid>
      <dc:creator>Tom Maloy</dc:creator>
      <dc:date>2002-07-05T17:25:43Z</dc:date>
    </item>
  </channel>
</rss>

