Skip to content

Commit

Permalink
Scaffold elastic exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
papey committed Nov 5, 2022
1 parent d5fff07 commit 08091c4
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/exporters/elastic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//! # ElasticExporter
//!
//! `ElasticExporter` implementation, exposes metrics to
//! an [ElasticSearch](https://www.elastic.co/fr/elasticsearch/) server.
use crate::exporters::Exporter;
use crate::sensors::Sensor;
use clap::ArgMatches;

/// Exporter that pushes metrics to an ElasticSearch endpoint
pub struct ElasticExporter {
/// Sensor instance that is used to generate the Topology and
/// thus get power consumption metrics.
_sensor: Box<dyn Sensor>,
}

impl Exporter for ElasticExporter {
fn run(&mut self, _parameters: ArgMatches) {
// TODO
}

fn get_options() -> Vec<clap::Arg<'static, 'static>> {
Vec::new()
}
}
1 change: 1 addition & 0 deletions src/exporters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//!
//! `Exporter` is the root for all exporters. It defines the [Exporter] trait
//! needed to implement an exporter.
pub mod elastic;
pub mod json;
pub mod prometheus;
pub mod qemu;
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ pub fn get_exporters_options() -> HashMap<String, Vec<clap::Arg<'static, 'static
String::from("warp10"),
exporters::warpten::Warp10Exporter::get_options(),
);
options.insert(
String::from("elastic"),
exporters::elastic::ElasticExporter::get_options(),
);
options
}

Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ fn main() {
"riemann" => "Riemann exporter sends power consumption metrics to a Riemann server",
"qemu" => "Qemu exporter watches all Qemu/KVM virtual machines running on the host and exposes metrics of each of them in a dedicated folder",
"warp10" => "Warp10 exporter sends data to a Warp10 host, through HTTP",
"elastic" => "Elastic exporter sends data to an ElasticSeach host",
_ => "Unknown exporter",
}
);
Expand Down

0 comments on commit 08091c4

Please sign in to comment.