-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from jacquelinegarrahan/hard-coded-configs
Add hard coded config files.
- Loading branch information
Showing
65 changed files
with
1,330 additions
and
840 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Author: Jacqueline Garrahan | ||
# Create datasource directory for a Kafka configuration | ||
# | ||
usage() { | ||
cli_name=${0##*/} | ||
echo "Usage: nalms add-grafana-datasource config_names" | ||
echo "Accepts comma separated list of config names." | ||
echo "Requires setting of following environment variables: \$NALMS_GRAFANA_DATASOURCE_FILE," | ||
echo "\$NALMS_ES_HOST, \$NALMS_ES_PORT" | ||
exit 0 | ||
} | ||
|
||
if [[ -z "${NALMS_GRAFANA_DATASOURCE_FILE}" ]]; then | ||
echo "\$NALMS_GRAFANA_DATASOURCE_FILE is not set." | ||
exit 0 | ||
fi | ||
|
||
if [[ -z "${NALMS_ES_HOST}" ]]; then | ||
echo "\$NALMS_ES_HOST is not set." | ||
exit 0 | ||
fi | ||
|
||
if [[ -z "${NALMS_ES_PORT}" ]]; then | ||
echo "\$NALMS_ES_PORT is not set." | ||
exit 0 | ||
fi | ||
|
||
if [[ -z "$1" ]]; then | ||
usage | ||
else | ||
CONFIG_NAME="$1" | ||
fi | ||
|
||
export IFS="," | ||
|
||
# convert to lowercase for index | ||
CONFIG=$(echo "$CONFIG_NAME" | tr '[:upper:]' '[:lower:]') | ||
|
||
for word in $CONFIG_NAME; do | ||
# convert to lowercase for index | ||
CONFIG=$(echo "$word" | tr '[:upper:]' '[:lower:]') | ||
echo "" >> $NALMS_GRAFANA_DATASOURCE_FILE | ||
echo " - name: ${word}" >> $NALMS_GRAFANA_DATASOURCE_FILE | ||
echo " type: elasticsearch" >> $NALMS_GRAFANA_DATASOURCE_FILE | ||
echo " access: proxy" >> $NALMS_GRAFANA_DATASOURCE_FILE | ||
echo " database: \"${CONFIG}_*\"" >> $NALMS_GRAFANA_DATASOURCE_FILE | ||
echo " url: http://${NALMS_ES_HOST}:${NALMS_ES_PORT}" >> $NALMS_GRAFANA_DATASOURCE_FILE | ||
echo " jsonData:" >> $NALMS_GRAFANA_DATASOURCE_FILE | ||
echo " esVersion: 60" >> $NALMS_GRAFANA_DATASOURCE_FILE | ||
echo " timeField: \"message_time\"" >> $NALMS_GRAFANA_DATASOURCE_FILE | ||
echo " logMessageField: \"id\"" >> $NALMS_GRAFANA_DATASOURCE_FILE | ||
done | ||
|
||
echo "Completed writing file." |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Author: Jacqueline Garrahan | ||
# Create dashboard for a Kafka configuration | ||
# | ||
usage() { | ||
cli_name=${0##*/} | ||
echo "Usage: nalms build-grafana-dashboard config_name" | ||
echo "Accepts comma separated list of config names." | ||
echo "Requires setting of following environment variables: \$NALMS_GRAFANA_DASHBOARD_DIR, \$NALMS_HOME" | ||
exit 0 | ||
} | ||
|
||
if [[ -z "${NALMS_GRAFANA_DATASOURCE_DIR}" ]]; then | ||
echo "\$NALMS_GRAFANA_DATASOURCE_DIR is not set." | ||
exit 0 | ||
fi | ||
|
||
if [[ -z "${NALMS_HOME}" ]]; then | ||
echo "\$NALMS_HOME is not set." | ||
exit 0 | ||
fi | ||
|
||
if [[ -z "$1" ]]; then | ||
usage | ||
else | ||
CONFIG_NAME="$1" | ||
fi | ||
|
||
DASHBOARD_TEMPLATE="${NALMS_HOME}/grafana/dashboards/alarm_logs_dashboard.json" | ||
|
||
# create dashboards | ||
export IFS="," | ||
for CONFIG_ITEM in $CONFIG_NAME; do | ||
sed 's/$DATASOURCE_NAME/'"$CONFIG_ITEM/" $DASHBOARD_TEMPLATE > "${NALMS_GRAFANA_DASHBOARD_DIR}/${CONFIG_ITEM}.json" | ||
done |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.