Hi Frederico,

 seems I need your help on php/rrd. I tried to add the cpu_wio metrics
to the CPU-Report graphs in graph.php. Below code works fine for
hosts/clusters where cpu_wio.rrd does exist. Unfortunatelly it breaks
for those where cpu_wio.rd does not exist. The graph does not show up.

 Is there a way to conditionally just set the cpu_wio values to zero if
cpu_wio.rrd is nonexistent?

Thanks
Martin


          if($context != "host" )
               {
                  /* If we are not in a host context, then we need to
calculate the average */
                  $series =
                 
"DEF:'num_nodes'='${rrd_dir}/cpu_user.rrd':'num':AVERAGE "
                 
."DEF:'cpu_user'='${rrd_dir}/cpu_user.rrd':'sum':AVERAGE "
                  ."CDEF:'ccpu_user'=cpu_user,num_nodes,/ "
                 
."DEF:'cpu_nice'='${rrd_dir}/cpu_nice.rrd':'sum':AVERAGE "
                  ."CDEF:'ccpu_nice'=cpu_nice,num_nodes,/ "
                 
."DEF:'cpu_system'='${rrd_dir}/cpu_system.rrd':'sum':AVERAGE "
                  ."CDEF:'ccpu_system'=cpu_system,num_nodes,/ "
                 
."DEF:'cpu_wio'='${rrd_dir}/cpu_wio.rrd':'sum':AVERAGE "
                  ."CDEF:'ccpu_wio'=cpu_wio,num_nodes,/ "
                 
."DEF:'cpu_idle'='${rrd_dir}/cpu_idle.rrd':'sum':AVERAGE "
                  ."CDEF:'ccpu_idle'=cpu_idle,num_nodes,/ "
                  ."AREA:'ccpu_user'#$cpu_user_color:'User CPU' "
                  ."STACK:'ccpu_nice'#$cpu_nice_color:'Nice CPU' "
                  ."STACK:'ccpu_system'#$cpu_system_color:'System CPU'
"
                  ."STACK:'ccpu_wio'#$cpu_wio_color:'WAIT CPU' "
                  ."STACK:'ccpu_idle'#$cpu_idle_color:'Idle CPU' ";
               }
            else
               {
                  $series
="DEF:'cpu_user'='${rrd_dir}/cpu_user.rrd':'sum':AVERAGE "
                 
."DEF:'cpu_nice'='${rrd_dir}/cpu_nice.rrd':'sum':AVERAGE "
                 
."DEF:'cpu_system'='${rrd_dir}/cpu_system.rrd':'sum':AVERAGE "
                 
."DEF:'cpu_wio'='${rrd_dir}/cpu_wio.rrd':'sum':AVERAGE "
                 
."DEF:'cpu_idle'='${rrd_dir}/cpu_idle.rrd':'sum':AVERAGE "
                  ."AREA:'cpu_user'#$cpu_user_color:'User CPU' "
                  ."STACK:'cpu_nice'#$cpu_nice_color:'Nice CPU' "
                  ."STACK:'cpu_system'#$cpu_system_color:'System CPU' "
                  ."STACK:'cpu_wio'#$cpu_wio_color:'WAIT CPU' "
                  ."STACK:'cpu_idle'#$cpu_idle_color:'Idle CPU' ";
               }


=====
------------------------------------------------------
Martin Knoblauch
email: k n o b i AT knobisoft DOT de
www:   http://www.knobisoft.de

Reply via email to