#!/usr/bin/env bash
set -u
echo "NICE Monitoring template catalog"
echo "================================"
printf "Upstream YAML files: "
find /usr/share/zabbix/templates -type f \( -name '*.yaml' -o -name '*.yml' \) 2>/dev/null | wc -l
printf "NICE YAML files:     "
find /usr/share/nice-monitoring/templates -type f \( -name '*.yaml' -o -name '*.yml' \) 2>/dev/null | wc -l
echo
if [[ -r /var/lib/nice-monitoring/template-state/upstream-import-failures.txt ]]; then
    printf "Deferred upstream imports: "
    wc -l < /var/lib/nice-monitoring/template-state/upstream-import-failures.txt
else
    echo "Deferred upstream imports: 0 or not synchronized yet"
fi
