DS as $KEY=>$VAL) { if(preg_match('/(.*)_([^_].*)$/',$VAL['LABEL'],$matches)){ $queue = $matches[1]; $state = $matches[2]; if($state == "waiting"){ $i++; $opt[$i]=''; $def[$i]=''; } $opt[$i] = "-l0 --title \"Gearman Queue '$queue'\" "; # $ds_name[$i] = "$queue"; $def[$i] .= rrd::def("var$KEY", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE") ; $def[$i] .= rrd::line1("var$KEY", $color[$state], rrd::cut($state,16)); $def[$i] .= rrd::gprint("var$KEY", array('LAST', 'MAX', 'AVERAGE'), "%6.2lf".$VAL['UNIT']) ; }else{ $i++; $opt[$i] = "-l0 --title \"Gearman Statistics\" "; # $ds_name[$i] = $VAL['NAME']; $def[$i] = rrd::def("var$KEY", $VAL['RRDFILE'], $VAL['DS'], "AVERAGE") ; $def[$i] .= rrd::line1("var$KEY", '#00C600', rrd::cut($VAL['NAME'],16)); $def[$i] .= rrd::gprint("var$KEY", array('LAST', 'MAX', 'AVERAGE'), "%6.2lf") ; } }