Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add Custom Metrics Manually to CircleCI Server
#!/bin/bash
#
# This script is a workaround to a Replicated issue in which the configuration sections do not appear in the admin console.
# It should be run on the services box from a new/clean directory where a backup will be created.
#
if [ ! -f metrics.txt ];then
echo "Please run this script in a clean directory with a 'metrics.txt' file containing desired telegraf config"
exit 1
fi
# install JQ, a json manipulation tool (must be version 1.5+)
curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 -o jq
chmod a+x jq
sudo mv jq /usr/bin
jq --version
# backup existing config, augment with metrics, and pipe back into config import
replicatedctl app-config export | tee backup.json | jq --arg metrics "$(<metrics.txt)" '. += {"custom_metrics_enabled": {"value": "1"},"custom_telegraf_config": {"value":$metrics}}' | replicatedctl app-config import
[[outputs.cloudwatch]]
region = 'us-east-2'
namespace = 'eddies-autoscale-metrics'
namepass = [
'circle.nomad.server_agent.*'
]
[[outputs.datadog]]
apikey = 'YOURKEY'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.