<div>Hi Henrik,</div>
<div> </div>
<div>Since the DESCR tab doesn't get sent automatically (that I know of) to a custom alert script, what is the easiest way to accomplish obtaining it. The script is written in Bourne Shell (standard /bin/sh). This is what my current script looks like (very simple for now):
</div>
<div> </div>
<div>#!/bin/sh</div>
<div>
<p># Start Section for Time Formatting<br>#-----------------------------------------------------<br>mkstring () {<br>  TIME_VALUE=$1<br>  UNIT=$2<br>  if [ $TIME_VALUE -eq 0 ]; then<br>    OUT=""<br>  elif [ $TIME_VALUE -eq 1 ]; then
<br>    OUT="1 $UNIT, "<br>  else<br>    OUT="$TIME_VALUE ${UNIT}S, "<br>  fi<br>  echo "$OUT"<br>}</p>
<p>seconds2text () {<br>  # Convert seconds to week/day/hour/minute<br>  TEMP0=`expr $1 / 60`<br>  SECOND=`expr $1 - $TEMP0 \* 60`<br>  TEMP1=`expr $TEMP0 / 60`<br>  MINUTE=`expr $TEMP0 - $TEMP1 \* 60`<br>  TEMP2=`expr $TEMP1 / 24`
<br>  HOUR=`expr $TEMP1 - $TEMP2 \* 24`<br>  TEMP3=`expr $TEMP2 / 7`<br>  DAY=`expr $TEMP2 - $TEMP3 \* 7`<br>  WEEK=$TEMP3</p>
<p>  # Build the output string<br>  STRING="`mkstring $WEEK WEEK`"<br>  STRING="$STRING`mkstring $DAY DAY`"<br>  STRING="$STRING`mkstring $HOUR HOUR`"<br>  STRING="$STRING`mkstring $MINUTE MIN`"
<br>  STRING="$STRING`mkstring $SECOND SEC`"</p>
<p>  # Remove the trailing comma<br>  DOWNSECS=`echo $STRING | sed 's/,$//'`</p>
<p>}</p>
<p># If the seconds don't equal zero (ie event just started) then format the duration<br>if [ $DOWNSECS -ne 0 ]; then</p>
<p>seconds2text $DOWNSECS</p>
<p>else</p>
<p>DOWNSECS="0 SECONDS"</p>
<p>fi</p>
<p># Check if the status is recovered<br>if [ $RECOVERED -eq 1 ]; then</p>
<p>        echo -e "STATUS: RECOVERED\nDATE: `date`\nSYSTEM TYPE: PRODUCTION\nSYSTEM NAME: $BBHOSTNAME\nDURATION: $DOWNSECS\n\n--\n\n$BBALPHAMSG\n\n" | /usr/bin/mail -s "PROD RECOVERED: $BBHOSTSVC" $RCPT                                                                        
</p>
<p># Check if the status is still down<br>else<br>        echo -e "STATUS: DOWN\nDATE: `date`\nSYSTEM TYPE: PRODUCTION\nSYSTEM NAME: $BBHOSTNAME\nALERT COLOR: $BBCOLORLEVEL\nDURATION: $DOWNSECS\n\n--\n\n$BBALPHAMSG\n\n" | /usr/bin/mail -s "PROD DOWN: $BBHOSTSVC" $RCPT                                                                                   
</p>
<p>fi<br></p><br><br> </div>
<div><span class="gmail_quote">On 1/24/07, <b class="gmail_sendername">Geoff Hallford</b> <<a href="mailto:geoff.hallford@gmail.com">geoff.hallford@gmail.com</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Thank you. Will do. 
<div><span class="e" id="q_11056fed50d1bc5b_1"><br><br>
<div><span class="gmail_quote">On 1/24/07, <b class="gmail_sendername">Henrik Stoerner</b> <<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:henrik@hswn.dk" target="_blank">henrik@hswn.dk</a>> wrote:
</span> 
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">On Wed, Jan 24, 2007 at 08:58:02AM -0500, Geoff Hallford wrote:<br><br>> I was wondering if there is anyway to change the default email alert
<br>> contents to include the DESCR tag information for a host (without creating a <br>> custom alert script)? We have many support people who don't know what all of<br>> the hosts are for or if it goes down, what that means and I want to make it
<br>> easier for them to know what is affected. <br><br>You'll either have to create a custom alert script, or tweak the<br>hobbitd/do_alert.c C code. If you choose the latter, then the<br>message_subject() and message_text() routines are the ones you're after; 
<br>you can get the DESCR tag with code like this:<br><br>    namelist_t *hinfo;<br>    char *descr;<br><br>    hinfo = hostinfo(alert->hostname);<br>    descr = bbh_item(hinfo, BBH_DESCRIPTION);<br><br>Note that this will return a NULL pointer if there is no DESCR tag for 
<br>this host.<br><br><br><br>Regards,<br>Henrik<br><br><br>To unsubscribe from the hobbit list, send an e-mail to<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:hobbit-unsubscribe@hswn.dk" target="_blank">
hobbit-unsubscribe@hswn.dk</a><br><br><br></blockquote></div><br><br clear="all"><br></span></div><span class="sg">-- <br>'If my answers frighten you then you should cease asking scary questions.' --Sam Jackson </span>
</blockquote></div><br><br clear="all"><br>-- <br>'If my answers frighten you then you should cease asking scary questions.' --Sam Jackson