-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Plugin status monitoring (#25)
* Working status parsing for bash plugins * Fix docs and add debug prints * Add monitoring crate * Send metrics to the monitoring gateway * Add extra tags field * Revert "Send metrics to the monitoring gateway" This reverts commit 7f29c2b. * Decouple telegraf monitoring from main loop --------- Co-authored-by: Artem Starikov <contact@snejugal.ru>
- Loading branch information
Showing
13 changed files
with
472 additions
and
45 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
deathloop: | ||
target: ev_sensor | ||
deathloop: | ||
frequency: random | ||
interval: PT1M | ||
options: | ||
target: ev_sensor | ||
dropper: | ||
target: ev_sensor | ||
ip: 192.168.85.139 | ||
options: | ||
target: ev_sensor | ||
ip: 192.168.85.139 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
dropper: | ||
target: ev_sensor | ||
ip: 192.168.85.139 | ||
options: | ||
target: ev_sensor | ||
ip: 192.168.85.139 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
deathloop: | ||
target: ev_sensor | ||
deathloop: | ||
options: | ||
target: ev_sensor | ||
frequency: random | ||
interval: PT1M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "paws_monitoring" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
telegraf = "0.6.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
pub mod telegraf; | ||
use std::collections::HashMap; | ||
|
||
use telegraf::TelegrafClient; | ||
|
||
#[derive(Debug)] | ||
pub enum StatusValue { | ||
Int(i64), | ||
Float(f64), | ||
String(String), | ||
} | ||
|
||
pub enum MonitoringBackend { | ||
Telegraf, | ||
} | ||
|
||
pub trait MetricSender: Send { | ||
fn send_metric( | ||
&mut self, | ||
tags: HashMap<String, String>, | ||
fields: HashMap<String, StatusValue>, | ||
) -> Result<(), String>; | ||
} | ||
|
||
pub fn init_monitoring_backend(option: MonitoringBackend, dsn: &str) -> Box<dyn MetricSender> { | ||
Box::new(match option { | ||
MonitoringBackend::Telegraf => TelegrafClient::new(dsn).unwrap(), | ||
}) | ||
} |
Oops, something went wrong.