Skip to content

UpperM/telegraf-ha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Telegraf - High Avaibility

  1. Description
  2. Installation
    1. Setup
    2. Configuration
    3. Run
  3. Usage

Description

This project adds a basic fail over mode to Telegraf. It's useful when you use Telegraf in pull mode.

Slave server check master status (reachable and telegraf service status) each 60s (default interval) and sync telegraf config of master.
If the master is not reachable, or telegraf service is down, the slave start his telegraf-slave instance with the configuration synced.
When master come back, salve server stop telegraf-slave service.

A copy of telegraf service is created (telegraf-salve.service), so you can run your telegraf for monitoring your slave server.

Tested on

Other versions will probably work but are untested.

Installation

Setup

Download telegraf-ha.deb

cd /tmp
wget https://github.com/UpperM/telegraf-ha/releases/latest/download/telegraf-ha.deb

Install package

dpkg -i telegraf-ha.deb

Reload systemd

systemctl daemon-reload

Configuration

The configuration file is stored in /etc/telegraf-ha/telegraf-ha.conf

# Hostname or IP of master server
MASTER_HOSTNAME=srv-telegraf1

# Private key used for ssh connection to master
AUTH_PRIVATE_KEY="~/.ssh/id_rsa"

# User used for ssh connection to master
AUTH_USER=root

# Folder where are stored config in master
CONF_PATH_REMOTE="/etc/telegraf"

# Local folder where are stored config from master
CONF_PATH_SYNC="/etc/telegraf-ha"

# Interval to check master (in second)
CHECK_INTERVAL=60

# Path where are sotred the log
LOG_FILE="/var/log/telegraf-ha.log"

# Enable debug mode
DEBUG=TRUE

Run

Start telegraf-ha service

systemctl start telegraf-ha

You can see the log while process is running

tail -f /var/log/telegraf-ha.log

About

Run Telegraf in fail-over mode

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages