New Bareos/Bacula check

Hey there!

I used https://github.com/sts/checkmk/blob/master/bacula/checks/bacula as basis for fitting a bareos check.

What I’ve done so far:

  • adjust the monitoring target’s side (check plugin for the usage of mysql/mariadb)
  • adjust the parameters of the inventory function (too much arguments…)

What I need:
The name of the check within the inventory function. The old version worked like this:

key = checkname.replace('bacula.','')

The variable checkname was passed by cmk in the past.

#<<<bacula>>>
#freshness 12 24 HOUR 'bareos-fd,web01,cloud02,ucs01,ox01,netmon01,comm01,splunk01,project01,erp91,erp01,pbx01,'
#fullbackups 12 'bareos-fd,web01,cloud02,ucs01,ox01,netmon01,comm01,splunk01,project01,erp91,erp01,pbx01,'
#fullbackupspool 3 'cloud01-MariaDB.2020-12-30_11.04.56_10,cloud01-MariaDB.2020-12-30_11.27.29_41,mailsync01-MBSync.2020-12-30_11.45.38_01,'
#errorvols 0

def inventory_bareos(info, name):
    print("Info ist: " + str(info))

    items = {}

    # return if agent data is empty
    if len(info) < 1:
	return []

    # return if checkname is in agent output
    for i in info:
        return[(None, "", None)]
	#if i[0] == key:
        #    print(i[0] + " " + key)
	#    return[(None, "", None)]

    return []

check_info['bareos.freshness'] = (check_bareos_freshness, "bareos.freshness", 0, inventory_bareos)
check_info['bareos.fullbackups'] = (check_bareos_fullbackups, "bareos.fullbackups", 0, inventory_bareos)
check_info['bareos.fullbackupspool'] = (check_bareos_fullbackupspool, "bareos.fullbackupspool", 0, inventory_bareos)
check_info['bareos.errorvols'] = (check_bareos_errorvols, "bareos.errorvols", 0, inventory_bareos)

This is my critical point. All checks uses the same inventory functions. Is this still possible after changing the inventory function’s parameters?