How to: Use Telegraf for Nodegrid Telemetry

How to: Use Telegraf for Nodegrid Telemetry

Overview

Nodegrid OS comes with Telegraf which is an agent that can gather server metrics and output to various databases for real-time monitoring and analysis.  This article will show you how to enable Telegraf and configure to export the Nodegrid OS metrics to your database of choice.

Enable Telegraf

Login to your Nodegrid as admin user, navigate to Security-->Services and check the box for Telegraf.



Modify Default Telegraf Configuration

Telegraf configuration file is located /etc/telegraf/telegraf.conf.  You must connect to your Nodegrid console as admin and become root user to modify this file, from the console, run these commands:

  1. shell sudo su -
  2. cd /etc/telegraf
  3. vi telegraf.conf

These commands will do the following:
  1. from your CLI console, elevate your user as root shell user
  2. change to the telegraf configuration directory
  3. start 'vi' editor to make changes on telegraf.conf.

Sample Configuration

Here is a sample configuration.  In this sample, we use Prometheus output plugin, but there are others available, refer to Telegraf documentation.  To use the output, you will need to use your existing Prometheus server and configure a scrape job to gather the metrics exposed by Telegraf.

Explanation for this configuration is below.

  1. [global_tags]

      nodegrid = "true"

    [agent]

      interval = "10s"

      round_interval = true

      metric_batch_size = 1000

      metric_buffer_limit = 10000

      collection_jitter = "0s"

      flush_interval = "10s"

      flush_jitter = "0s"

      precision = ""

      hostname = ""

      omit_hostname = false

      debug = true

    [[outputs.prometheus_client]]

      listen = ":9273"

      metric_version = 2

    [[inputs.cpu]]

      percpu = true

      totalcpu = true

      collect_cpu_time = false

      report_active = false

    [[inputs.disk]]

      ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]

    [[inputs.diskio]]

    [[inputs.kernel]]

    [[inputs.mem]]

    [[inputs.processes]]

    [[inputs.swap]]

    [[inputs.system]]

    [[inputs.net]]


Configuration Explanation

Breaking down this telegraf configuration.

Global Tags

  1. [global_tags]
  2.   nodegrid = "true"
  1. global_tags: These tags are added to all metrics collected by Telegraf. Here, a tag nodegrid with the value true is added

Agent Configuration

  1. [agent]

      interval = "10s"

      round_interval = true

      metric_batch_size = 1000

      metric_buffer_limit = 10000

      collection_jitter = "0s"

      flush_interval = "10s"

      flush_jitter = "0s"

      precision = ""

      hostname = ""

      omit_hostname = false

      debug = true
  1. interval: The time interval between metric collections (10 seconds).
  2. round_interval: If true, rounds collection intervals to the nearest interval.
  3. metric_batch_size: The number of metrics to send in each batch (1000).
  4. metric_buffer_limit: The maximum number of metrics that can be buffered (10000).
  5. collection_jitter: Adds a random jitter to the collection interval to avoid spikes (0 seconds).
  6. flush_interval: The time interval between metric flushes (10 seconds).
  7. flush_jitter: Adds a random jitter to the flush interval (0 seconds).
  8. precision: Sets the precision of the metrics (empty means default).
  9. hostname: Overrides the hostname (empty means default).
  10. omit_hostname: If true, omits the hostname from the metrics.
  11. debug: If true, enables debug logging.

Outputs

  1. [[outputs.prometheus_client]]

      listen = ":9273"

      metric_version = 2

  1. outputs.prometheus_client: Configures Telegraf to expose metrics in Prometheus format.
    1. listen: The address and port to listen on (port 9273).
    2. metric_version: The Prometheus metric format version (2).

Inputs

CPU

  1. [[inputs.cpu]]

      percpu = true

      totalcpu = true

      collect_cpu_time = false

      report_active = false


  1. inputs.cpu: Collects CPU metrics.
    1. percpu: If true, collects metrics per CPU.
    2. totalcpu: If true, collects total CPU metrics.
    3. collect_cpu_time: If false, does not collect CPU time metrics.
    4. report_active: If false, does not report active CPU metrics.

Disk

  1. [[inputs.disk]]

      ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]

  1. inputs.disk: Collects disk usage metrics.
    1. ignore_fs: A list of filesystem types to ignore.

Disk I/O, Kernel, Memory, Processes, Swap, System, Network

The remaining input definitions have no parameters and are self explanatory, these are:
  1. diskio: Collects disk I/O metrics
  2. kernel: Collects kernel metrics
  3. mem: Collects memory usage metrics
  4. processes: Collects process metrics
  5. swap: Collects swap usage metrics
  6. system: Collects system metrics
  7. net: Collects network metrics


References

Depending on the version of Telegraf installed on Nodegrid, some telegraf capabilities may not be available.  As of Nodegrid OS 6.0.20, Telegraf version is 1.19.0






    • Related Articles

    • Nodegrid Serial Console: Pinouts, Cables and Connectors

      The tables below show the serial port pinout information of the NSC TxxR (Cisco Pinout) and NSC Txx (Legacy Pinout). NSC TxxR - Cisco-like Pinout Pin Signal Name Input/Output 1 CTS IN 2 DCD IN 3 RxD IN 4 GND N/A 5 GND N/A 6 TxD OUT 7 DTR OUT 8 RTS ...
    • How to Telnet and SSH to the Nodegrid Serial Ports

      Note: by default, Telnet access is turned off with your Nodegrid Serial Console. Authorized users can use Telnet or SSH to connect directly to the console of a managed device if all of the following are true: Telnet / SSH protocol is enabled under ...
    • Use any interface for Iptables from Nodegrid UI

      New for Nodegrid 6.0 and later, you can now use any interface in Iptables firewall or NAT rules. You can use interfaces that don't show in the interface drop-down menu. You can also use an interface that doesn't exist yet, such as VTI interfaces for ...
    • Formating to use the USB thumb drive

      Introduction: This article show how to enable and use the USB drive in the ZPE Nodegrid. The Nodegrid recognizes EXT4 file system. Other file system may not be recognizable in the Nodegrid. Having the USB thumb drive in the Nodegrid allows extended ...
    • How to: Use API keys as authentication method

      Nodegrid enables using different methods for API authentication, they are: ticket, username, and API key. In this guide you will learn how to create an API account and how to query information using the API. Adding the API account from GUI 1. Login ...