orangeqs.juice.orchestration.telegraf#

Telegraf Utilities.

Module Contents#

Functions#

add_influxdb_gpg_key

Download and add the InfluxDB GPG key.

add_influxdb_repo

Create the InfluxDB repository file.

install_telegraf

Check if Telegraf is installed and install via native package manager.

influxdb2_token_exists

Check if the Telegraf systemd env file exists and contains an INFLUX_TOKEN.

write_token_to_service_env

Write influxDB2 token to the systemd services env file.

configure_rsyslog_for_telegraf

Create an rsyslog config file to forward logs to Telegraf using RFC 5424.

render_telegraf_config

Render the configuration for telegraf.

add_telegraf_to_sudoers

Add sudo permissions to telegraf to run podman stats.

API#

orangeqs.juice.orchestration.telegraf.add_influxdb_gpg_key(package_manager: orangeqs.juice.orchestration._package_manager.PackageManager, url: str = 'https://repos.influxdata.com/influxdata-archive.key', apt_key_path: str = _APT_GPG_KEY_PATH) None#

Download and add the InfluxDB GPG key.

Parameters#

  • package_manager (PackageManager): Host package manager (apt or dnf).

  • url (str): URL of the InfluxData signing key.

  • apt_key_path (str): Destination path for the dearmored key when using apt.

orangeqs.juice.orchestration.telegraf.add_influxdb_repo(package_manager: orangeqs.juice.orchestration._package_manager.PackageManager, dest: str | None = None) None#

Create the InfluxDB repository file.

Parameters#

  • package_manager (PackageManager): Host package manager (apt or dnf).

  • dest (str | None): Optional output path for the repository configuration.

orangeqs.juice.orchestration.telegraf.install_telegraf(package_manager: orangeqs.juice.orchestration._package_manager.PackageManager) bool#

Check if Telegraf is installed and install via native package manager.

Parameters#

  • package_manager (PackageManager): Host package manager (apt or dnf).

Returns#

  • bool (False if Telegraf was already installed.)

orangeqs.juice.orchestration.telegraf.influxdb2_token_exists() bool#

Check if the Telegraf systemd env file exists and contains an INFLUX_TOKEN.

orangeqs.juice.orchestration.telegraf.write_token_to_service_env(token: str) None#

Write influxDB2 token to the systemd services env file.

Parameters#

  • token (str): The token to be written to Telegraf services environment.

orangeqs.juice.orchestration.telegraf.configure_rsyslog_for_telegraf() None#

Create an rsyslog config file to forward logs to Telegraf using RFC 5424.

orangeqs.juice.orchestration.telegraf.render_telegraf_config(config: orangeqs.juice.orchestration.settings.TelegrafSettings) None#

Render the configuration for telegraf.

Overwrites the file if it already exists.

Parameters#

  • config (TelegrafSettings): The telegraf settings to render.

orangeqs.juice.orchestration.telegraf.add_telegraf_to_sudoers() None#

Add sudo permissions to telegraf to run podman stats.