Hi Mario! As @r.sander said: it seems that you just forgot the third > in the section header. Correct is <<<customcheck:sep(32)>>>.
If the section header is wrong then checkmk doesn’t recognise the data as a new section and just adds the line <<<customcheck>> (with two >) to the data of the previous section (which apparantly was the <<<local>>> section) and that usually crashes because of unexpected input.
Allow me to give you some hints:
Hint #1: :sep(32) is a single blank character. If you omit the separator (as in <<<customcheck>>>) then checkmk will automatically split the input at (any amount of) whitespace (blank or tab). This is the default behaviour.
Hint #2 I like your parse function. But you could write the for loop a bit easier. Instead of iterating over the index (1…n) whithin the string_table:
# orginal code
def parse_customcheck(string_table):
parsed = {}
for line in range(len(string_table)):
parsed[string_table[line][0]] = {
"size": string_table[line][1],
"used": string_table[line][2],
"free": string_table[line][3]
}
return parsed
… you may directly iterate the string_table line by line:
def parse_customcheck(string_table):
parsed = {}
for line in string_table:
parsed[line[0]] = {
"size": line[1],
"used": line[2],
"free": line[3]
}
return parsed
Because line itself is a list of strings you may also immediately assign it to individual variables while iterating. Like so:
def parse_customcheck(string_table):
parsed = {}
for name, size, used, free in string_table:
parsed[name] = {
"size": size,
"used": used,
"free": free
}
return parsed
But be aware that the number of variables (name, size, used, free) must now match the number of “items” in the line. So if you encounter a line with 3 or 5 items, this last code will crash. I think this code is easier to read.