telegraf for syslog

This commit is contained in:
Kameron Kenny 2025-01-09 23:06:27 -05:00
parent 3ca8d63104
commit 0c1114597f
5 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,6 @@
FROM telegraf
LABEL description="telegraf"
RUN test -d /etc/telegraf || mkdir -p /etc/telegraf
COPY telegraf-syslog/telegraf.conf /etc/telegraf/telegraf.conf

15
Jenkinsfile vendored
View File

@ -30,6 +30,20 @@ pipeline {
}
}
stage('Build telegraf-syslog-ng') {
steps {
script {
def dockerfile = 'Dockerfile.telegraf-syslog'
def telegrafImage = docker.build("tlp/telegraf-syslog:${env.BUILD_ID}", "-f ${dockerfile} .")
docker.withRegistry('http://docker-registry1.in.thelinuxpro.net:5000') {
telegrafImage.push()
telegrafImage.push('latest')
}
}
}
}
stage('Create contexts') {
steps {
sh 'docker context ls | grep pi502 || docker context create pi502 --docker "host=ssh://pi502.in.thelinuxpro.net"'
@ -41,6 +55,7 @@ pipeline {
script {
//#def status_s = sh(returnStatus: true, script: 'grep $(docker --context pi502 compose ps | tail -n1 | awk \'{ print $2 }\') docker-compose.yml')
sh 'docker --context pi502 compose pull telegraf'
sh 'docker --context pi502 compose pull telegraf-syslog
//if (status_s != 0) {
// sh 'docker --context pi502 compose up -d'

View File

@ -37,3 +37,19 @@ services:
ipv4_address: 10.99.23.42
env_file:
- influxv2.env
telegraf-syslog:
container_name: telegraf-syslog
#build:
#dockerfile: Dockerfile.telegraf
image: docker-registry1.in.thelinuxpro.net:5000/tlp/telegraf:latest
depends_on:
- influxdb
#volumes:
# Mount for telegraf config
#- ./telegraf/mytelegraf.conf:/etc/telegraf/telegraf.conf:ro
networks:
infra_dev_net:
ipv4_address: 10.99.23.43
env_file:
- influxv2-syslog-ng.env

8
influxv2-syslog-ng.env Normal file
View File

@ -0,0 +1,8 @@
DOCKER_INFLUXDB_INIT_MODE=setup
DOCKER_INFLUXDB_INIT_USERNAME=flux
DOCKER_INFLUXDB_INIT_PASSWORD=forty6and2
DOCKER_INFLUXDB_INIT_ORG=darkstar
DOCKER_INFLUXDB_INIT_BUCKET=syslog-ng
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=admintoken
INFLUX_TOKEN=UQ-2s21_SQn2mwEVOfnsowoOGDQL1_HjkFmqPZumy1nxnapbVaPXkU2aUFWzsszcxlYU0afl6fuzH_U5KLw2Xg==

View File

@ -0,0 +1,42 @@
# Configuration for telegraf agent
[agent]
interval = "90s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
# quiet = false
# logtarget = "file"
# logfile = ""
# logfile_rotation_interval = "0d"
# logfile_rotation_max_size = "0MB"
# logfile_rotation_max_archives = 5
# log_with_timezone = ""
hostname = ""
omit_hostname = false
[[outputs.influxdb_v2]]
urls = ["http://influxdb.in.thelinuxpro.net:8086"]
token = "$INFLUX_TOKEN"
organization = "darkstar"
bucket = "syslog-ng"
# bucket_tag = ""
# exclude_bucket_tag = false
# timeout = "5s"
# http_headers = {"X-Special-Header" = "Special-Value"}
# http_proxy = "http://corporate.proxy:3128"
# user_agent = "telegraf"
# content_encoding = "gzip"
# influx_uint_support = false
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
# insecure_skip_verify = false
[[inputs.syslog]]
server = "tcp://:6514"