[rrd-users] seg-fault when making png's

Eidmark, Andre andre.eidmark at upc.no
Wed Jan 17 14:32:16 MET 2001


Hello people :-)

Question from a newbie :

I've got a segmentation fault problem. Enclosed is _parts_ of a script i'm
using, and it is the part that causes the problem.
Updating the rrd is no problem, but the script exits with a segmentation
fault when this script tries to update the graph. I do not understand why??
Can anyone help?

Cheers 
Andre



#!/usr/bin/tclsh

package require Tnm 2.1.10
package require Rrd 1.0.13

# rrd directory
set rrddir "/home/rrd/tmp/rrddata"
set wwwdir "/home/rrd/tmp/wwwdata"

# connectivity variables
set community "*********"
set controllers "h5c3 h5c4"


proc getSnmpData { hostname community } {
   if {[catch { snmp session -address $hostname -community $community}
session ]} {
      puts stderr "Error connecting to $hostname"
      return
   }

   if {[catch { lindex [lindex [$session get .1.3.6.1.4.1.1456.1.2.3.1.3.1 ]
0] 2} res_bwalloc ]} {
      puts stderr "Error querying $hostname (.1.3.6.1.4.1.1456.1.2.3.1.3.1)"
      return
   }

   $session destroy

# puts $res_bwalloc   
# puts "ingenting gjort : $hostname $res_traffic_up"
# set test [$res_traffic_up/402653184]
# puts "express med desimal : [expr $res_traffic_up/402653184.0]"
# set res_traffic_up [expr $res_traffic_up/402653184]
# puts "bare res_traf_up, resultat etter utregning :$res_traffic_up"
# puts "ingenting gjort med down : $res_traffic_down"
# set res_traffic_down [expr $res_traffic_down/402653184.0]
# puts "resultat down : $res_traffic_down"

   rrdUpdate $hostname $res_bwalloc
   wwwUpdate $hostname
}

proc rrdUpdate { hostname bwalloc } {
   global rrddir

   set rrdfile "$rrddir/$hostname.bwalloc.rrd"
   # create rrdfile if not yet existent
   if {[file exists $rrdfile] == 0} {
       Rrd::create $rrdfile --step 30 \
               DS:intbwalloc:GAUGE:1000:0:64000 \
               RRA:AVERAGE:0.5:1:6000
   }
   Rrd::update $rrdfile --template intbwalloc N:$bwalloc

}

proc wwwUpdate { hostname } {
   global rrddir
   global wwwdir

#   Rrd::graph $pngfile --title "Bandwidth usage ($hostname)" \
#   --height 256 \
#   --width 480 \
#   --start -86400 \
#   DEF:trafficUp=$rrdfile:intTrafficUp:AVERAGE \
#   DEF:trafficDown=$rrdfile:intTrafficDown:AVERAGE \   
#   AREA:trafficUp#0000FF:Upstream \
#   LINE2:trafficDown#00C000:Downstream \
#   GPRINT:trafficDown:MAX:Max: \
#   GPRINT:trafficDown:MAX:%6.2lf" \
#   GPRINT:trafficUp:MAX:Max: \
#   GPRINT:trafficUp:MAX:%6.2lf"

#   /usr/local/rrdtool/bin/rrdtool graph /home/rrd/traftest.gif
#   --height 256 --start -86400 --vertical-label kb/s \
#   DEF:mytrafup=$rrdfile:trafficUp:AVERAGE \
#   DEF:mytrafdw=$rrdfile:trafficDown:AVERAGE \
#   "CDEF:realup=mytrafup,402653184,/" \
#   "CDEF:realdw=mytrafdw,402653184,/" \
#   AREA:realup#FF0000 \
#   LINE2:realdw#00ff00


   set pngfile "$wwwdir/$hostname.bwalloc.day.png"
   set rrdfile "$rrddir/$hostname.bwalloc.rrd"

#   set avg "GPRINT:intbwalloc:MIN:Min: \
#   GPRINT:intbwalloc:MIN:%6.2lf \
#   GPRINT:intbwalloc:AVERAGE:Average: \
#   GPRINT:intbwalloc:AVERAGE:%6.2lf \
#   GPRINT:intbwalloc:MAX:Max: \
#   GPRINT:intbwalloc:MAX:%6.2lf"


   Rrd::graph $pngfile --title Bandwidth Usage ($hostname) \
   --height 256    \
   --width 480     \
   --start -86400  \
   --vertical-label kb/s \
   DEF:bw=$rrdfile:intbwalloc:AVERAGE      \
   AREA:bw#FF0000:Bandwidth  \
   GPRINT:bw:MIN:Min: \
   GPRINT:bw:MIN:%6.2lf \
   GPRINT:bw:AVERAGE:Average: \
   GPRINT:bw:AVERAGE:%6.2lf \  
   GPRINT:bw:MAX:Max: \
   GPRINT:bw:MAX:%6.2lf

}

   mib load terra.mib
   puts "terayon_rrd v0.00003 Alpha by Jon Suphammer/Andre Eidmark"

   foreach hostname $controllers {
      getSnmpData $hostname $community
   }


--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list