Common Module - Telegraf ADd Scripts option

This commit is contained in:
Mike Reeves
2018-11-20 10:35:10 -05:00
parent 523cd3313b
commit 440fc3d757
3 changed files with 29 additions and 7 deletions

View File

@@ -124,6 +124,20 @@ tgrafetcdir:
- name: /opt/so/conf/telegraf/etc - name: /opt/so/conf/telegraf/etc
- makedirs: True - makedirs: True
tgrafetsdir:
file.directory:
- name: /opt/so/conf/telegraf/scripts
- makedirs: True
tgrafsyncscripts:
file.recurse:
- name: /opt/so/conf/telegraf/scripts
- user: 939
- group: 939
- mode: 755
- template: jinja
- source: salt://common/telegraf/scripts
tgrafconf: tgrafconf:
file.managed: file.managed:
- name: /opt/so/conf/telegraf/etc/telegraf.conf - name: /opt/so/conf/telegraf/etc/telegraf.conf
@@ -154,6 +168,10 @@ so-telegraf:
- /etc/pki/ca.crt:/etc/telegraf/ca.crt:ro - /etc/pki/ca.crt:/etc/telegraf/ca.crt:ro
- /etc/pki/influxdb.crt:/etc/telegraf/telegraf.crt:ro - /etc/pki/influxdb.crt:/etc/telegraf/telegraf.crt:ro
- /etc/pki/influxdb.key:/etc/telegraf/telegraf.key:ro - /etc/pki/influxdb.key:/etc/telegraf/telegraf.key:ro
- /opt/so/conf/telegraf/scripts:/scripts:ro
- watch:
- /opt/so/conf/telegraf/etc/telegraf.conf
- /opt/so/conf/telegraf/scripts
# If its a master or eval lets install the back end for now # If its a master or eval lets install the back end for now
{% if grains['role'] == 'so-master' or grains['role'] == 'so-eval' %} {% if grains['role'] == 'so-master' or grains['role'] == 'so-eval' %}

View File

@@ -604,13 +604,11 @@
# # Read metrics from one or more commands that can output to stdout # # Read metrics from one or more commands that can output to stdout
# [[inputs.exec]] [[inputs.exec]]
# ## Commands array # ## Commands array
# commands = [ commands = [
# "/tmp/test.sh", "/scripts/stenoloss.sh"
# "/usr/bin/mycollector --foo=bar", ]
# "/tmp/collect_*.sh"
# ]
# #
# ## Timeout for each command to complete. # ## Timeout for each command to complete.
# timeout = "5s" # timeout = "5s"
@@ -622,7 +620,7 @@
# ## Each data format has its own unique set of configuration options, read # ## Each data format has its own unique set of configuration options, read
# ## more about them here: # ## more about them here:
# ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md # ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
# data_format = "influx" data_format = "influx"
# # Read metrics from fail2ban. # # Read metrics from fail2ban.

View File

@@ -0,0 +1,6 @@
#!/bin/bash
# Get the data
DROP=$(tac /opt/so/log/stenographer/stenographer.log | grep -m1 drop | awk '{print $14}' | awk -F "=" '{print $2}')
echo "stenodrop drop=$DROP"