<?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 Re: MRTG and scripting issue in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/mrtg-and-scripting-issue/m-p/5062946#M437086</link>
    <description>Okay - turns out it was my mrtg.cfg file - not the incoming date.&lt;BR /&gt;&lt;BR /&gt;I was using options: nopercent,growright,perhour&lt;BR /&gt;&lt;BR /&gt;Well, the data was already being supplied as the difference between the last 5 minute snapshot.&lt;BR /&gt;&lt;BR /&gt;Mrtg by default treats variable as a counter and calculates the difference between the current and the previous value and divides that by the elapsed time between the last two readings to get the value to be plotted. &lt;BR /&gt;&lt;BR /&gt;With the perhour, it was also multiplying that result by 3600!&lt;BR /&gt;&lt;BR /&gt;So, I changed it to: nopercent, growright, gauge&lt;BR /&gt;&lt;BR /&gt;And from the host I do my own calculation to get a "per hour"&lt;BR /&gt;&lt;BR /&gt;LPSTATNEW=`expr \( $LPSTATCUR - $LPSTATOLD \) \* 12`&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
    <pubDate>Tue, 14 Aug 2007 13:22:22 GMT</pubDate>
    <dc:creator>Geoff Wild</dc:creator>
    <dc:date>2007-08-14T13:22:22Z</dc:date>
    <item>
      <title>MRTG and scripting issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mrtg-and-scripting-issue/m-p/5062945#M437085</link>
      <description>Okay - I'm generating stats for lp requests and ftp requests.&lt;BR /&gt;&lt;BR /&gt;Every now and then - the numbers are skewed - way to large...&lt;BR /&gt;&lt;BR /&gt;My script:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;# generate mrtg file for stats&lt;BR /&gt;SERVER=`uname -n`&lt;BR /&gt;MRTGLP=/tmp/iprprt.lp.stats.mrtg&lt;BR /&gt;mv /tmp/LPSTATCUR /tmp/LPSTATOLD&lt;BR /&gt;LPSTATOLD=`cat /tmp/LPSTATOLD`&lt;BR /&gt;LPSTATCUR=`/usr/bin/grep ^End /var/adm/lp/log |wc -l'`&lt;BR /&gt;&lt;BR /&gt;echo $LPSTATCUR&amp;gt;/tmp/LPSTATCUR&lt;BR /&gt;&lt;BR /&gt;LPSTATNEW=`expr $LPSTATCUR - $LPSTATOLD`&lt;BR /&gt;&lt;BR /&gt;echo $LPSTATNEW &amp;gt; $MRTGLP&lt;BR /&gt;echo 0 &amp;gt;&amp;gt; $MRTGLP&lt;BR /&gt;uptime | awk '{print $3,$4,$5}' |sed s/,//g &amp;gt;&amp;gt;$MRTGLP&lt;BR /&gt;echo $SERVER &amp;gt;&amp;gt;$MRTGLP&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;MRTGFTP=/tmp/iprdbci.ftp.stats.mrtg&lt;BR /&gt;mv /tmp/FTPSTATCUR /tmp/FTPSTATOLD&lt;BR /&gt;FTPSTATOLD=`cat /tmp/FTPSTATOLD`&lt;BR /&gt;FTPSTATCUR=`/usr/bin/grep FTP /var/adm/syslog/syslog.log |wc -l`&lt;BR /&gt;&lt;BR /&gt;echo $FTPSTATCUR&amp;gt;/tmp/FTPSTATCUR&lt;BR /&gt;&lt;BR /&gt;FTPSTATNEW=`expr $FTPSTATCUR - $FTPSTATOLD`&lt;BR /&gt;&lt;BR /&gt;echo $FTPSTATNEW &amp;gt; $MRTGFTP&lt;BR /&gt;echo 0 &amp;gt;&amp;gt; $MRTGFTP&lt;BR /&gt;uptime | awk '{print $3,$4,$5}' |sed s/,//g &amp;gt;&amp;gt;$MRTGFTP&lt;BR /&gt;echo $SERVER &amp;gt;&amp;gt;$MRTGFTP&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;That create 2 files which are uploaded to the MRTG server every 5 minutes.&lt;BR /&gt;&lt;BR /&gt;Contents look like this - most of the time:&lt;BR /&gt;&lt;BR /&gt;# cat /tmp/iprprt.lp.stats.mrtg&lt;BR /&gt;18&lt;BR /&gt;0&lt;BR /&gt;74 days 3:51&lt;BR /&gt;svr004&lt;BR /&gt;&lt;BR /&gt;root@pc0004 [ /var/adm/lp ]&lt;BR /&gt;# cat /tmp/iprdbci.ftp.stats.mrtg&lt;BR /&gt;147&lt;BR /&gt;0&lt;BR /&gt;74 days 3:51&lt;BR /&gt;svr004&lt;BR /&gt;&lt;BR /&gt;On the MRTG server - looking in the log (stat) files, I see numbers like this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1187041800 344746669 0 51711980689 0&lt;BR /&gt;1187041500 51711980689 0 51711980689 0&lt;BR /&gt;1187041200 51711980689 0 51711980689 0&lt;BR /&gt;1187040900 51711980689 0 51711980689 0&lt;BR /&gt;1187040600 51194860884 0 51711980689 0&lt;BR /&gt;1187040300 228 0 228 0&lt;BR /&gt;1187040000 227 0 228 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Well - it is pretty obvious that I didn't have 51194860884 ftp connections in 1 5 minute period...&lt;BR /&gt;&lt;BR /&gt;So, I have to manually edit thos files later in order for the graph to look right...&lt;BR /&gt;&lt;BR /&gt;Question is - where did that number come from?&lt;BR /&gt;&lt;BR /&gt;In other words - is my script flawed? &lt;BR /&gt;Can it be improved?&lt;BR /&gt;&lt;BR /&gt;No matter how many times I run it manually - I can not duplicate the error...&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Aug 2007 09:37:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mrtg-and-scripting-issue/m-p/5062945#M437085</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-08-14T09:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: MRTG and scripting issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mrtg-and-scripting-issue/m-p/5062946#M437086</link>
      <description>Okay - turns out it was my mrtg.cfg file - not the incoming date.&lt;BR /&gt;&lt;BR /&gt;I was using options: nopercent,growright,perhour&lt;BR /&gt;&lt;BR /&gt;Well, the data was already being supplied as the difference between the last 5 minute snapshot.&lt;BR /&gt;&lt;BR /&gt;Mrtg by default treats variable as a counter and calculates the difference between the current and the previous value and divides that by the elapsed time between the last two readings to get the value to be plotted. &lt;BR /&gt;&lt;BR /&gt;With the perhour, it was also multiplying that result by 3600!&lt;BR /&gt;&lt;BR /&gt;So, I changed it to: nopercent, growright, gauge&lt;BR /&gt;&lt;BR /&gt;And from the host I do my own calculation to get a "per hour"&lt;BR /&gt;&lt;BR /&gt;LPSTATNEW=`expr \( $LPSTATCUR - $LPSTATOLD \) \* 12`&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Tue, 14 Aug 2007 13:22:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mrtg-and-scripting-issue/m-p/5062946#M437086</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-08-14T13:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: MRTG and scripting issue</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/mrtg-and-scripting-issue/m-p/5062947#M437087</link>
      <description>See above...</description>
      <pubDate>Tue, 14 Aug 2007 13:57:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/mrtg-and-scripting-issue/m-p/5062947#M437087</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2007-08-14T13:57:40Z</dc:date>
    </item>
  </channel>
</rss>

