Custom actions, Macros

Moin,

Ich hab da mal ne Frage: Wir nutzen CheckMK mit NeDi, und haben uns ein paar “custom actions” gebaut, mit denen z.B. auf die NeDi-Infos zu Devices und Nodes zugegriffen werden kann. Leider funktioniert das aber nur per Hostname oder IP. Ich würde nun gerne die MAC-Adresse (z.B. von Accesspoints) pro Host in CheckMK als Attribut oder Label hinterlegen und die NeDi-URL dann damit aufrufen. Das hätte den Vorteil, auch Nodes zu finden, deren Namen NeDi nicht auflösen konnte (weil z.B. die ARP-Infos auf den Routern nicht mehr vorhanden sind). Hat jemand eine Idee, wie sich das bewerkstelligen ließe?

Gruß aus Münster

Rainer

Hallo Rainer,

Wir haben uns für einen ähnlichen Fall dazu ein GUI plugin bauen lassen. Ich gehe davon aus Du kannst Dir das anpassen.

Das Plugin kommt nach:
~/local/share/check_mk/web/plugins/icons/

Hier der Code:

def paint_pilot_link(what, row, tags, host_custom_vars ):
# Available Custom Attributes:
# APP
# OS
# ENV
# DC
# HOST URL:
# FILE

# SERVIEC URL
   OS=host_custom_vars.get('OS', '')
   APP=host_custom_vars.get('APP', '')
   ENV=host_custom_vars.get('ENV','')
   SUBAPP=host_custom_vars.get('GROUP','')
   DC=host_custom_vars.get('DC','')
   FILENAME=host_custom_vars.get('FILENAME','')
   BASE=FILENAME.split('/')[2]
   HOST=row["host_name"]
   SITE=row["site"]
   if SITE.lower() == "preprod":
       PILOT_BASE_URL="https://xyz.dd/index.php?&action=start"
   else:
       PILOT_BASE_URL="https://abc.dd/wi/index.php?&action=start"
   if what == "host":
      PILOT_VAR_URL="&type=host&dc=%s&os=%s&env=%s&app=%s&host=%s&base=%s" %(DC,OS,ENV,APP,HOST,BASE)
   else:
      CHECK=row["service_check_command"]
      if "check_mk_active" in CHECK or "check-mk-custom" in CHECK:
          CHECK=CHECK.split('!')[0]
      SERVICE=row["service_description"]
      PILOT_VAR_URL="&type=service&dc=%s&os=%s&env=%s&app=%s&plugin=%s&service=%s&host=%s&base=%s" %(DC,OS,ENV,APP,CHECK,SERVICE,HOST,BASE)

   # Use the khelpcenter icon, you can use custom icons or the icons from ~/share/check_mk/web/htdocs/images/icons/
   #PILOT_VAR_URL= PILOT_VAR_URL.replace(" ", "_")
   return 'khelpcenter', _('Open pilot instructions'), ('%s%s' % (PILOT_BASE_URL, PILOT_VAR_URL) , '_blank')
multisite_icons_and_actions['pilot_object_link'] = {
    'paint':    paint_pilot_link,
    'toplevel': True,
}

Moin Mike,

Danke für den Code…ich schau mal, ob ich mir daraus was basteln kann :wink:

Gruß

Rainer

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed. Contact an admin if you think this should be re-opened.