Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


jq_json_check_mk

jq - Command-line JSON processor / Check_MK

  • Extract all configured hosts from Check_MK and print hostname and folder:
    curl "https://<server>/<site>/check_mk/webapi.py?action=get_all_hosts&_username=$user&_secret=$secret" \
    | jq '.result[] | {hostname: .hostname, path: .path}'
  • Extract CSV:
    curl "https://<server>/<site>/check_mk/webapi.py?action=get_all_hosts&_username=$user&_secret=$secret" \
    | jq -r '.result[] | [.hostname, .path] | join (";")'
jq_json_check_mk.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1