diff --git a/show_ttls.sh b/show_ttls.sh index 6fa112578647396e4e3a385628caf2baf343d8d8..d24b762d56d222af0bb9cf881a81ef852238e924 100755 --- a/show_ttls.sh +++ b/show_ttls.sh @@ -6,9 +6,10 @@ # # ---------------------------------------------------------------------- # 2022-09-14 v1.0 <axel.hahn@iml.unibe.ch> initial version +# 2022-09-15 v1.1 <axel.hahn@iml.unibe.ch> check required jq # ====================================================================== -_version="1.0" +_version="1.1" # ---------------------------------------------------------------------- # HELP @@ -22,6 +23,7 @@ Search for hostnames in Infoblox API and show all hosts that have an activated custom ttl value. It uses dns-api.sh and adds the return field for aliases. +The filter functionality of json data requires jq. SYNTAX: dns-search.sh REGEX @@ -41,5 +43,10 @@ mysearch=$1 >&2 echo ";" >&2 echo "; >>>>>>>>>> INFOBLOX DNS HELPER TTL v$_version" >&2 echo ";" + +which jq >/dev/null || exit + "$( dirname $0 )"/dns-api.sh GET "/record:host?name~=${mysearch}&_return_fields%2B=ttl,use_ttl" \ | jq -r '.[] | select ( .use_ttl == true and .ttl != null ) | .name,.ttl' + +# ---------------------------------------------------------------------- \ No newline at end of file