Skip to content

smdn/PseudoMuninNode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub license

PseudoMuninNode

PseudoMuninNode is a simple library for running munin-node compatible server on the devices that supports Wi-Fi like ESP32 and similar ones.

By behaviouring your device as a munin-node, various telemetries such as sensor values can be aggregated directly by Munin.

architecture

PseudoMuninNode makes it unnecessary to prepare a separate server to run munin-node, such as a PC or Raspberry Pi.

Devices and modules

The list of devices or modules that confirmed PseudoMuninNode works.

  • ESP32 / ESP-WROOM-32
  • ESP8266 (@kuwatay, #4)

Example code

The code below is a snippet that makes the PseudoMuninNode work.

// pseudo munin-node instance
PseudoMuninNode node = {
  .plugins = plugins,
  .numberOfPlugins = 1
};

constexpr char WIFI_SSID[] = "your_wifi_ssid";
constexpr char WIFI_PASSPHRASE[] = "your_wifi_passphrase";

void setup()
{
  Serial.begin(115200);
  while (!Serial);

  // setup WiFi
  WiFi.begin(WIFI_SSID, WIFI_PASSPHRASE);

  while (WiFi.status() != WL_CONNECTED)
    delay(100);

  // begin pseudo munin-node
  node.begin();
}

void loop()
{
  // update the value of 'uptime' field
  fields_uptime[0].value = millis();

  // wait a request from munin-update; respond commands and return values of field
  node.acceptClient();

  // write your own code here
  delay(100);
}

Full code and more usage sketches are available in examples directory.

Example of output

The following graph shows the results of three different temperature and humidity sensors (DHT11, AM2320, and BME280) connected to ESP32 and aggregating their measurement data with PseudoMuninNode.

temperature graph humidity graph

Installation

Arduino IDE

Download the ZIP archive, and include library from the Arduino IDE menu.

PlatformIO

Run platformio lib install https://github.com/smdn/PseudoMuninNode.git from terminal. See this document for detail.

platformio lib install https://github.com/smdn/PseudoMuninNode.git

Or edit lib_deps in platformio.ini.

[env:esp32dev]
lib_deps = https://github.com/smdn/PseudoMuninNode.git

.NET implementation

Smdn.Net.MuninNode, the .NET implementation of Munin-Node and Munin-Plugin is also available.