Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


jq_json_check_mk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
jq_json_check_mk [2017/04/18 13:13] – created adminjq_json_check_mk [2017/04/18 13:30] – [jq - Command-line JSON processor / Check_MK] admin
Line 1: Line 1:
 {{tag>[linux jq jason query check_mk]}} {{tag>[linux jq jason query check_mk]}}
  
-=====jq - Command-line JSON processor====+=====jq - Command-line JSON processor / Check_MK====
  
   * Extract all configured hosts from Check_MK and print hostname and folder:<code>   * Extract all configured hosts from Check_MK and print hostname and folder:<code>
 curl "https://<server>/<site>/check_mk/webapi.py?action=get_all_hosts&_username=$user&_secret=$secret" \ curl "https://<server>/<site>/check_mk/webapi.py?action=get_all_hosts&_username=$user&_secret=$secret" \
-| jq '.result[] | {hostname: .hostname, path: .path'}  +| jq '.result[] | {hostname: .hostname, path: .path}' 
 +</code> 
 +  * Extract CSV:<code> 
 +| jq -r '.[] | map([.hostname, .path] | join (", ")) | join ("\n")' 
 </code> </code>
jq_json_check_mk.txt · Last modified: 2021/10/09 15:14 by 127.0.0.1