[mrtg] Re: Monitoring SQL

Thierry Silly thierry.silly at db.com
Wed Feb 14 09:12:51 MET 2001



Hello,

     Please find below a script I use to send informations to mrtg. This script make the sum of all the ports on my switch
and then try to make an estimation of my backplain traffic before 2 times (I retrieve the values 2 times and then divide by the delta time).

You can call the perl script in mrtg the following way:

Target[xxxxx]: `perl c:\mrtg-2.9.4\yyyyy.pl`

The script is:

########################################################################
#!/usr/local/bin/perl


use SNMP_Session        "0.77";
use SNMP_util           "0.77";




     $commu="public";
     $host="ciscoswitch";



     @valin1  = &snmpwalk($commu."@".$host,'1.3.6.1.2.1.2.2.1.10');
    $t1= time();

     @valin2  = &snmpwalk($commu."@".$host,'1.3.6.1.2.1.2.2.1.10');

#here I do a snmpwalk, you can use snmpget with the same arguments


    $t2=time();

    $dt=$t2-$t1;

    if ($dt<=0)
    {
    print "0\n0\n";
    exit (0);
    }



    $taille= "". at valin1;

  for ($i=0; $i<$taille; ++$i)
  {
      push (@valiin1, split (/:/, $valin1[$i]));
      push (@valiin2, split (/:/, $valin2[$i]));
  }

     $taiille="". at valiin1;

   for ($ii=1; $ii<$taiille; $ii=$ii+2)
  {
      $resultin1=$resultin1+ $valiin1[$ii];
      $resultin2=$resultin2+ $valiin2[$ii];

  }

      $finalresultin=$resultin2-$resultin1;


      $finalresultin=($finalresultin*2)/$dt;


      @backplin=split (/\./, $finalresultin);
#needed to send integers (3.36 --> 3)

      print "$backplin[0]\n$backplin[0]\n";

#mrtg will take the "printed" values as they are returned and will put it in the log.
#He will use the values the same way as if it gets them by itself.
#I send to mrtg both time the same date as I'm only monitoring in traffic.
#\n is very important as mrtg use chomp while receiving datas from this script

exit (0);

############################################################################################

I hope it's that you were looking for,
BRgds,
Thierry



---------------------------------------- Message History ----------------------------------------


From: Adrian.Mink at fidata.com on 13.02.2001 23:02 GMT

To:   mrtg at list.ee.ethz.ch
cc:
Subject:  [mrtg] Re: Monitoring SQL




Looks like your right. Oh, well, thanks to everyone who tried to help!
Looks like I need to write a external script to pass the data to mrtg,
can someone point me to any information on how to do that? Thanks,

Adrian

-----Original Message-----
From: Daniel J McDonald [mailto:dmcdonald at digicontech.com]
Sent: Tuesday, February 13, 2001 4:06 PM
To: 'Adrian Mink'
Subject: RE: [mrtg] Re: Monitoring SQL


looks like a bug in the snmp daemon on the sql server.  wish I could say
more, but Ive got a similar problem on Arrowpoint 11052 switches - you can
walk it fine, but when you poll it it comes back with no such instance.

almost wants to make you change the snmpget lines in mrtg to snmpgetnext...
except that that would really torque your mind trying to figure out what
happened to everything else that used to work.

Dan

<snip>

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi






--

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list