Check Dokumentation cmk2

Authenticate via URL in Checkmk

In Checkmk you can pass credentials in the URL to access Pages and Dashboard in Checkmk, without the need of an authentication.

The simplest way is to access a Page directly from Checkmk like the View of Hosts, a Dashboard or Nagvis. In case of view, I would recommend opening the View in a new Tab, so that you get the clean URL without the Sidebar (Even Checkmk will redirect you to the full page again).

http://localhost:8080/cmk/check_mk/view.py?view_name=allhosts

Make sure in the Global settings, that you enabled „Login via GET requests“

Next, try to access your target URL, when not logged in. You get the URL to the Login Page but with redirect back to the initial Page:

http://localhost:8080/cmk/check_mk/login.py?_origtarget=index.py%3Fstart_url%3Dview.py%253Fview_name%253Dallhosts

Now you add &_username=YOURUSER&_password=YOURPASSWORD&_login=1 to that url.
Be aware that the Apache Web server Log will now contain this password.

When using the URL from now, you are logged in automatically.

Hints with Nagvis

If you want to use Nagvis in this way, you may want to add header_menu=0 as URL Parameter

Use Automation Secrets

If you would like to use this with Automation Secrets, use _secret instead of _password

Use a Page as Backend for an Automation

This was possible in old Versions of Checkmk. There is the parameter __output_format__ which can be set to CSV or JSON. In the new Version, you need to set an option in the Global Settings first:

Then the URL like this will work and returns JSON:

http://localhost:8080/cmk/check_mk/view.py?view_name=allhosts&output_format=json&_username=automation&_secret=Ae6SoJkJB$wcZtuU

Please ensure that use an automation User, and _secret as Parameter instead of Password.