1) for( $cpu_n=0; $cpu_n<$no_cpu; $cpu_n++) { $def[$def_n]=''; $ds_name[$def_n] = "CPU Utlilization for core: $cpu_n"; $opt[$def_n] = "--vertical-label \"% Usage\" --lower-limit 0 --upper-limit 100 --title \"CPU for $hostname / $servicedesc\" --slope-mode -N"; $index_of_threshold_val = $index; $def[$def_n] = "DEF:total_cpu_in=$RRDFILE[$index]:$DS[$index]:AVERAGE " ; $index += 1; $def[$def_n] .= "DEF:system_cpu_in=$RRDFILE[$index]:$DS[$index]:AVERAGE " ; $index += 1; $def[$def_n] .= "DEF:user_cpu_in=$RRDFILE[$index]:$DS[$index]:AVERAGE " ; $index += 1; $def[$def_n] .= "DEF:idle_cpu_in=$RRDFILE[$index]:$DS[$index]:AVERAGE " ; $index += 1; $def[$def_n] .= "CDEF:user_cpu_out=user_cpu_in "; $def[$def_n] .= "LINE1:user_cpu_out#0000FF:\"User\t\t\" "; $def[$def_n] .= rrd::gprint("user_cpu_out", array("LAST", "AVERAGE", "MAX"), "%6.2lf%%"); $def[$def_n] .= rrd::cdef("system_cpu_out", "system_cpu_in"); $def[$def_n] .= "LINE1:system_cpu_out#008000:\"System\t\" "; $def[$def_n] .= rrd::gprint("system_cpu_in", array("LAST", "AVERAGE", "MAX"), "%6.2lf%%"); $def[$def_n] .= rrd::cdef("total_cpu_out", "total_cpu_in"); $def[$def_n] .= "LINE1:total_cpu_out#800079:\"Total\t\t\" "; $def[$def_n] .= rrd::gprint("total_cpu_in", array("LAST", "AVERAGE", "MAX"), "%6.2lf%%"); if ($WARN[$index_of_threshold_val] != ""){ $def[$def_n] .= "LINE2:$WARN[$index_of_threshold_val]#FFFF00:\"Warning\\n\" "; } if ($CRIT[$index_of_threshold_val] != ""){ $def[$def_n] .= "LINE2:$CRIT[$index_of_threshold_val]#FF0000:\"Critical\\n\" "; } $def_n++; } ?>