/truenas-graphite-to-prometheus

A graphite exporter mapping file for truenas scale >23.10.1 metrics and some example grafana dashboards

Primary LanguageDockerfileGNU General Public License v3.0GPL-3.0

Table of Contents
  1. About The Project
  2. Roadmap
  3. Supported versions
  4. Getting Started
  5. Usage
  6. Exposed metrics
  7. Dashboards
  8. Contributing

About The Project

The goal was to get the metrics from the TrueNAS reporting tap inside my normal monitoring stack which consists of prometheus and grafana. In earlier versions of TrueNAS this was possible by utilising the collectd graphite push service to push the metrics to a graphite_exporter instance which then converts the metrics to prometheus metrics based on the provided mapping file. In TrueNAS scale 23.10 the reporting system was changed to netdata and was missing the export feature all along. In 23.10.1 the export mechanism was added back in still lacking the ability to directly export the metrics to promeheus but still in the graphite form. But the metrics format changed due to the tool change.

The goal of this small repository is to provide you with a new graphite_mapping.conf which is suitable to be used with the new metrics exposed by TrueNAS. This mapping file is in active development and may change regularly in the near future. Besides the raw mapping file a based grafana dashboard nad a quick summary of the required settings in TrueNAS are also included.

Built With

Roadmap

  • Prepare environment
  • Getting basic metrics extraction working
  • Documentation
    • Start of git project
    • Fully detailed list of all metrics
    • Multiple dashboards with pictures
  • Convert all metrics to prometheus metrics without catch all rules
  • Unify all metrics to a similar schema
  • Add UPS metrics (Help wanted!)

See the open issues for a full list of proposed features (and known issues).

Supported Versions

Those are the supported and tested versions of TrueNAS in combination with this exporter. Feel free to create a PR with a tested flag if you use a version not mentioned here.

TrueNAS Version Supported Tested
23.10.x ✅ by @Supporterino
24.04.x ✅ by @Supporterino
24.10.x ✅ by @Supporterino

Getting Started

TrueNAS Scale

TrueNAS SCALE has its own ability to export reporting data to other apps or charts in the Graphite protocol (e.g. Netdata, Prometheus/Grafana).

To create or edit the reporter for use with Prometheus:

  1. Go to the Reporting tab and click the Exporters button on the top right.
  2. Click Add to create a new reporter or click the Edit pencil icon next to the reporter you wish to use.

Screenshot 2023-12-20 at 22 38 49

Ensure the following fields are adjusted depending on your target app or chart, as outlined in the TrueNAS instructions.

  • The prefix for the graphite metrics need to be set to truenas for the mapping file to work
  • The hostname field should be choosen according to your needs it will later populate the instance label of your metrics
  • The update every field should match your scrape time
  • For Send Names Instead Of Ids, leave it blank and it will default to true (otherwise it may error out when trying to create the exporter).

Screenshot 2023-12-20 at 22 40 14

The destination ip and port need to be set to target your graphite_exporter I won't cover the setup process of this tool since it was already present for me. Feel free to open a PR with an recommended install method.

graphite_exporter

You obviously need a running graphite_exporter which is scrabed by your prometheus instance and is reachable by your TrueNAS instance to push metrics to.

Running exporter inside truenas

Check TRUENAS.md to see options to use this exporter directly inside of TrueNAS.

Usage

To utilise the provided graphite_mapping.conf replace your existing conf of your graphite_exporter and restart it. For the grafana dashboards you can simply import the provided json file.

Exposed metrics

See METRICS.md for the exposed metrics by this config.

Dashboards

The dasboards are located inside the dashboards folder and are simple json files which can be imported into grafana und used with the metrics.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request