[Check_mk (english)] Perfdata values in web/plugins/metrics/custom_check.py

Hello All,

I have a custom check that parses output like:

hw.sensors.mfi0.drive0=online (sd0), OK

hw.sensors.mfi0.drive1=online (sd1), OK

The check is working as expected, and the graphs are display correctly. However, I have not figured out how supply a “real” value for the MAX_HD variable (show in the snippet below).
As you can see, this host has only 2 drives, so an extra graph is drawn outside
of my defined graph (see below). I created a “drive_count”
perfdata point and I can use this variable in web/plugins/metrics/custom_check.py, but I have not figured out how to make “drive_count” the value for “MAX_HD”. Can anyone point me in the right direction?

MAX_HD =
3

for
i in
range(MAX_HD):

metric_info["drive%d"

% i] =
{

    "title"

: “Drive %s” %(i),

    "unit" 

: “count”,

    "color"

: “#eeabee”,

}

this generator creates data for a single graph using all found “drives”

drives_generator
= ( (drive, “line”) for drive
in re.findall(“drive\d+”,
“”.join(metric_info.keys())) )

graph_info[“drives” ]
= {

"title"    

: “Active Drives”,

"metrics"  

: [m for m
in drives_generator],

}