Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itchyny/mackerel-plugin-rs
Mackerel plugin helper library for Rust
https://github.com/itchyny/mackerel-plugin-rs
mackerel mackerel-plugin rust rust-library
Last synced: about 2 months ago
JSON representation
Mackerel plugin helper library for Rust
- Host: GitHub
- URL: https://github.com/itchyny/mackerel-plugin-rs
- Owner: itchyny
- License: mit
- Created: 2017-09-30T17:24:24.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2023-11-23T13:37:32.000Z (about 1 year ago)
- Last Synced: 2024-05-02T00:57:25.942Z (8 months ago)
- Topics: mackerel, mackerel-plugin, rust, rust-library
- Language: Rust
- Homepage: https://crates.io/crates/mackerel_plugin
- Size: 74.2 KB
- Stars: 12
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mackerel-plugin-rs
[![CI Status](https://github.com/itchyny/mackerel-plugin-rs/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/itchyny/mackerel-plugin-rs/actions?query=branch:main)
[![crates.io](https://img.shields.io/crates/v/mackerel_plugin.svg)](https://crates.io/crates/mackerel_plugin)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/itchyny/mackerel-plugin-rs/blob/main/LICENSE)ー Mackerel plugin helper library for Rust ー
## Plugin samples
Plugins using this library.- [mackerel-plugin-loadavg](https://github.com/itchyny/mackerel-plugin-loadavg)
- [mackerel-plugin-uptime](https://github.com/itchyny/mackerel-plugin-uptime)
- [mackerel-plugin-ntp](https://github.com/itchyny/mackerel-plugin-ntp)
- [mackerel-plugin-dice](https://github.com/itchyny/mackerel-plugin-dice)## Example
```rust
use mackerel_plugin::*;
use std::collections::HashMap;struct DicePlugin {}
impl Plugin for DicePlugin {
fn fetch_metrics(&self) -> Result, String> {
Ok(HashMap::from([
("dice.d6".to_owned(), (rand::random::() % 6 + 1) as f64),
("dice.d20".to_owned(), (rand::random::() % 20 + 1) as f64),
]))
}fn graph_definition(&self) -> Vec {
vec![
graph! {
name: "dice",
label: "My Dice",
unit: "integer",
metrics: [
{ name: "d6", label: "Die 6" },
{ name: "d20", label: "Die 20" },
],
},
]
}
}fn main() {
if let Err(err) = (DicePlugin {}).run() {
eprintln!("mackerel-plugin-dice: {}", err);
std::process::exit(1);
}
}
```## Author
itchyny (https://github.com/itchyny)## License
This software is released under the MIT License, see LICENSE.