mdmcertcheck v0.1 - discovery

This commit is contained in:
Mike D'Morto 2021-02-10 20:01:09 +07:00
parent 3991ea5e1c
commit b4acb96e35

View File

@ -4,7 +4,7 @@
export LC_ALL="" export LC_ALL=""
export LANG="en_US.UTF-8" export LANG="en_US.UTF-8"
version="0.0" VERSION="0.1"
CERTLIST="certlist.cfg" CERTLIST="certlist.cfg"
@ -16,10 +16,13 @@ ITEM="$2"
case "$METRIC" in case "$METRIC" in
discovery) discovery)
#records from the config file #records from the config file
RECS=`cat ` RECS=`cat $CERTLIST | awk -F: '/^[^#]/ { print $1 }' | grep -e "^cert=.*" | cut -f 2 -d "="`
JSON="{ \"data\":[" JSON="{ \"data\":["
# append data # append data
for REC_I in ${RECS}; do
JSON=${JSON}" {\"{#CERT}\":\"${REC_I}\"},"
done
# delete last simbol and add the end # delete last simbol and add the end
JSON=${JSON::-1} JSON=${JSON::-1}
@ -28,7 +31,7 @@ discovery)
exit 0 exit 0
;; ;;
script.verstion) script.version)
echo $VERSION echo $VERSION
;; ;;