Skip to content
Snippets Groups Projects
Commit e376c129 authored by MJB's avatar MJB
Browse files

templated agent config #36

parent ed10b307
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,32 @@
#// Created for Project : FLAME
#//
#/////////////////////////////////////////////////////////////////////////
# Define ipendpoint configuration parameters
ipendpoints = {
"ipendpoint1" => {
:ip_address => "192.168.50.11",
:location => "DC1",
:sfc_id => "MS_Template_1",
:sfc_id_instance => "MS_I1",
:sf_id => "adaptive_streaming",
:sf_id_instance => "adaptive_streaming_I1",
:ipendpoint_id => "adaptive_streaming_I1_ipendpoint1",
:influxdb_url => "http://192.168.50.10:8086",
:database_name => "CLMCMetrics"
},
"ipendpoint2" => {
:ip_address => "192.168.50.12",
:location => "DC2",
:sfc_id => "MS_Template_1",
:sfc_id_instance => "MS_I1",
:sf_id => "adaptive_streaming",
:sf_id_instance => "adaptive_streaming_I1",
:ipendpoint_id => "adaptive_streaming_I1_ipendpoint2",
:influxdb_url => "http://192.168.50.10:8086",
:database_name => "CLMCMetrics"
}
}
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
......@@ -52,8 +78,7 @@ Vagrant.configure("2") do |config|
end
config.vm.define "ipendpoint1" do |my|
config.vm.network :private_network, ip: "192.168.50.11", virtualbox__intnet: "clmc-net"
config.vm.network :private_network, ip: "#{ipendpoints['ipendpoint1'][:ip_address]}", virtualbox__intnet: "clmc-net"
my.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 512]
......@@ -61,20 +86,20 @@ Vagrant.configure("2") do |config|
end
# Install CLMC agent 1
config.vm.provision :shell, :path => 'scripts/influx/install-clmc-agent.sh', :args => "/vagrant/scripts/influx/telegraf_ipendpoint1.conf"
config.vm.provision :shell, :path => 'scripts/influx/install-clmc-agent.sh', :args => "/vagrant/scripts/influx/telegraf_ipendpoint_template.conf #{ipendpoints['ipendpoint1'][:location]} #{ipendpoints['ipendpoint1'][:sfc_id]} #{ipendpoints['ipendpoint1'][:sfc_id_instance]} #{ipendpoints['ipendpoint1'][:sf_id]} #{ipendpoints['ipendpoint1'][:sf_id_instance]} #{ipendpoints['ipendpoint1'][:ipendpoint_id]} #{ipendpoints['ipendpoint1'][:influxdb_url]} #{ipendpoints['ipendpoint1'][:database_name]}"
end
config.vm.define "ipendpoint2" do |my|
config.vm.network :private_network, ip: "192.168.50.12", virtualbox__intnet: "clmc-net"
config.vm.network :private_network, ip: "#{ipendpoints['ipendpoint2'][:ip_address]}", virtualbox__intnet: "clmc-net"
my.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", 512]
v.customize ["modifyvm", :id, "--cpus", 1]
end
# Install CLMC agent 2
config.vm.provision :shell, :path => 'scripts/influx/install-clmc-agent.sh', :args => "/vagrant/scripts/influx/telegraf_ipendpoint2.conf"
# Install CLMC agent
config.vm.provision :shell, :path => 'scripts/influx/install-clmc-agent.sh', :args => "/vagrant/scripts/influx/telegraf_ipendpoint_template.conf #{ipendpoints['ipendpoint2'][:location]} #{ipendpoints['ipendpoint2'][:sfc_id]} #{ipendpoints['ipendpoint2'][:sfc_id_instance]} #{ipendpoints['ipendpoint2'][:sf_id]} #{ipendpoints['ipendpoint2'][:sf_id_instance]} #{ipendpoints['ipendpoint2'][:ipendpoint_id]} #{ipendpoints['ipendpoint2'][:influxdb_url]} #{ipendpoints['ipendpoint2'][:database_name]}"
end
end
......@@ -25,11 +25,46 @@
#/////////////////////////////////////////////////////////////////////////
# Install telegraf
if [ "$#" -ne 9 ]; then
echo "Error: illegal number of arguments: "$#
echo "Usage: install-clmc-agent.sh TELEGRAF_CONF_FILE LOCATION SFC_ID SFC_ID_INSTANCE SF_ID SF_ID_INSTANCE IP_ENDPOINT_ID INFLUXDB_URL DATABASE_NAME"
exit
fi
TELEGRAF_CONF_FILE=$1
LOCATION=$2
SFC_ID=$3
SFC_ID_INSTANCE=$4
SF_ID=$5
SF_ID_INSTANCE=$6
IP_ENDPOINT_ID=$7
INFLUXDB_URL=$8
DATABASE_NAME=$9
if [ ! -f $TELEGRAF_CONF_FILE]; then
echo "Error: Telegraf conf template file not found: "$TELEGRAF_CONF_FILE
exit
fi
wget https://dl.influxdata.com/telegraf/releases/telegraf_1.3.2-1_amd64.deb
dpkg -i telegraf_1.3.2-1_amd64.deb
# Copy configuration
cp $1 /etc/telegraf/telegraf.conf
echo "Telegraf config file: " $TELEGRAF_CONF_FILE
cp $TELEGRAF_CONF_FILE /etc/telegraf/telegraf.conf
echo "INFLUXDB_URL: " $INFLUXDB_URL
echo "DATABASE_NAME: " $DATABASE_NAME
# Replace template parameters
sed -i 's/{{LOCATION}}/'$LOCATION'/g' /etc/telegraf/telegraf.conf
sed -i 's/{{SFC_ID}}/'$SFC_ID'/g' /etc/telegraf/telegraf.conf
sed -i 's/{{SFC_ID_INSTANCE}}/'$SFC_ID_INSTANCE'/g' /etc/telegraf/telegraf.conf
sed -i 's/{{SF_ID}}/'$SF_ID'/g' /etc/telegraf/telegraf.conf
sed -i 's/{{SF_ID_INSTANCE}}/'$SF_ID_INSTANCE'/g' /etc/telegraf/telegraf.conf
sed -i 's/{{IP_ENDPOINT_ID}}/'$IP_ENDPOINT_ID'/g' /etc/telegraf/telegraf.conf
sed -i 's|{{INFLUXDB_URL}}|'$INFLUXDB_URL'|g' /etc/telegraf/telegraf.conf
sed -i 's/{{DATABASE_NAME}}/'$DATABASE_NAME'/g' /etc/telegraf/telegraf.conf
# Start telegraf
systemctl start telegraf
\ No newline at end of file
# Telegraf configuration
# Telegraf is entirely plugin driven. All metrics are gathered from the
# declared inputs, and sent to the declared outputs.
# Plugins must be declared in here to be active.
# To deactivate a plugin, comment out the name and any variables.
# Use 'telegraf -config telegraf.conf -test' to see what metrics a config
# file would generate.
# Global tags can be specified here in key="value" format.
[global_tags]
location="DC1"
sfc="MS_Template_1"
sfc_i="MS_I1"
sf="adaptive_streaming"
sf_i="adaptive_streaming_I1"
ipendpoint="adaptive_streaming_I1_ipendpoint1"
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "10s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
## Telegraf will cache metric_buffer_limit metrics for each output, and will
## flush this buffer on a successful write.
metric_buffer_limit = 1000
## Flush the buffer whenever full, regardless of flush_interval.
flush_buffer_when_full = true
## Collection jitter is used to jitter the collection by a random amount.
## Each plugin will sleep for a random time within jitter before collecting.
## This can be used to avoid many plugins querying things like sysfs at the
## same time, which can have a measurable effect on the system.
collection_jitter = "0s"
## Default flushing interval for all outputs. You shouldn't set this below
## interval. Maximum flush_interval will be flush_interval + flush_jitter
flush_interval = "10s"
## Jitter the flush interval by a random amount. This is primarily to avoid
## large write spikes for users running a large number of telegraf instances.
## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
flush_jitter = "0s"
## Logging configuration:
## Run telegraf in debug mode
debug = false
## Run telegraf in quiet mode
quiet = false
## Specify the log file name. The empty string means to log to stdout.
logfile = "G:/Telegraf/telegraf.log"
## Override default hostname, if empty use os.Hostname()
hostname = ""
###############################################################################
# OUTPUTS #
###############################################################################
# Configuration for influxdb server to send metrics to
[[outputs.influxdb]]
# The full HTTP or UDP endpoint URL for your InfluxDB instance.
# Multiple urls can be specified but it is assumed that they are part of the same
# cluster, this means that only ONE of the urls will be written to each interval.
# urls = ["udp://127.0.0.1:8089"] # UDP endpoint example
urls = ["http://192.168.50.10:8086"] # required
# The target database for metrics (telegraf will create it if not exists)
database = "CLMCMetrics" # required
# Precision of writes, valid values are "ns", "us" (or "µs"), "ms", "s", "m", "h".
# note: using second precision greatly helps InfluxDB compression
precision = "s"
## Write timeout (for the InfluxDB client), formatted as a string.
## If not provided, will default to 5s. 0s means no timeout (not recommended).
timeout = "5s"
# username = "telegraf"
# password = "metricsmetricsmetricsmetrics"
# Set the user agent for HTTP POSTs (can be useful for log differentiation)
# user_agent = "telegraf"
# Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
# udp_payload = 512
[[outputs.file]]
## Files to write to, "stdout" is a specially handled file.
files = ["stdout", "/tmp/metrics.out"]
## Data format to output.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
data_format = "influx"
###############################################################################
# INPUTS #
###############################################################################
# # Influx HTTP write listener
[[inputs.http_listener]]
## Address and port to host HTTP listener on
service_address = ":8186"
## timeouts
read_timeout = "10s"
write_timeout = "10s"
## HTTPS
#tls_cert= "/etc/telegraf/cert.pem"
#tls_key = "/etc/telegraf/key.pem"
## MTLS
#tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
\ No newline at end of file
# Telegraf configuration
# Telegraf is entirely plugin driven. All metrics are gathered from the
# declared inputs, and sent to the declared outputs.
# Plugins must be declared in here to be active.
# To deactivate a plugin, comment out the name and any variables.
# Use 'telegraf -config telegraf.conf -test' to see what metrics a config
# file would generate.
# Global tags can be specified here in key="value" format.
[global_tags]
location="DC2"
sfc="MS_Template_1"
sfc_i="MS_I1"
sf="adaptive_streaming"
sf_i="adaptive_streaming_I1"
ipendpoint="adaptive_streaming_I1_ipendpoint2"
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "10s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
## Telegraf will cache metric_buffer_limit metrics for each output, and will
## flush this buffer on a successful write.
metric_buffer_limit = 1000
## Flush the buffer whenever full, regardless of flush_interval.
flush_buffer_when_full = true
## Collection jitter is used to jitter the collection by a random amount.
## Each plugin will sleep for a random time within jitter before collecting.
## This can be used to avoid many plugins querying things like sysfs at the
## same time, which can have a measurable effect on the system.
collection_jitter = "0s"
## Default flushing interval for all outputs. You shouldn't set this below
## interval. Maximum flush_interval will be flush_interval + flush_jitter
flush_interval = "10s"
## Jitter the flush interval by a random amount. This is primarily to avoid
## large write spikes for users running a large number of telegraf instances.
## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
flush_jitter = "0s"
## Logging configuration:
## Run telegraf in debug mode
debug = false
## Run telegraf in quiet mode
quiet = false
## Specify the log file name. The empty string means to log to stdout.
logfile = "G:/Telegraf/telegraf.log"
## Override default hostname, if empty use os.Hostname()
hostname = ""
###############################################################################
# OUTPUTS #
###############################################################################
# Configuration for influxdb server to send metrics to
[[outputs.influxdb]]
# The full HTTP or UDP endpoint URL for your InfluxDB instance.
# Multiple urls can be specified but it is assumed that they are part of the same
# cluster, this means that only ONE of the urls will be written to each interval.
# urls = ["udp://127.0.0.1:8089"] # UDP endpoint example
urls = ["http://192.168.50.10:8086"] # required
# The target database for metrics (telegraf will create it if not exists)
database = "CLMCMetrics" # required
# Precision of writes, valid values are "ns", "us" (or "µs"), "ms", "s", "m", "h".
# note: using second precision greatly helps InfluxDB compression
precision = "s"
## Write timeout (for the InfluxDB client), formatted as a string.
## If not provided, will default to 5s. 0s means no timeout (not recommended).
timeout = "5s"
# username = "telegraf"
# password = "metricsmetricsmetricsmetrics"
# Set the user agent for HTTP POSTs (can be useful for log differentiation)
# user_agent = "telegraf"
# Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes)
# udp_payload = 512
[[outputs.file]]
## Files to write to, "stdout" is a specially handled file.
files = ["stdout", "/tmp/metrics.out"]
## Data format to output.
## Each data format has its own unique set of configuration options, read
## more about them here:
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
data_format = "influx"
###############################################################################
# INPUTS #
###############################################################################
# # Influx HTTP write listener
[[inputs.http_listener]]
## Address and port to host HTTP listener on
service_address = ":8186"
## timeouts
read_timeout = "10s"
write_timeout = "10s"
## HTTPS
#tls_cert= "/etc/telegraf/cert.pem"
#tls_key = "/etc/telegraf/key.pem"
## MTLS
#tls_allowed_cacerts = ["/etc/telegraf/clientca.pem"]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment