Created
April 21, 2019 16:05
-
-
Save mda590/beeb6ebd81b0fb36b565ba8eeba9e06c to your computer and use it in GitHub Desktop.
Looks in a directory and echos out a YAML formatted string containing a list of rules files which can be put into a Prometheus configuration file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
FILES=$(ls -1) | |
BASE_RULES_PATH="/etc/rules" | |
FILE_LIST="" | |
for file in $FILES; do | |
if [[ $file =~ .*.yaml|.*.yml ]]; then | |
FILE_LIST+=" - $BASE_RULES_PATH/$file\n" | |
fi | |
done | |
echo -e "$FILE_LIST" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment