-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
564 additions
and
212 deletions.
There are no files selected for viewing
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,43 +1,48 @@ | ||
alerters: | ||
- name: telegram_default | ||
medium: telegram | ||
chat_env: TELEGRAM_CHAT | ||
token_env: TELEGRAM_TOKEN | ||
- name: sms | ||
medium: spryng | ||
recipients_env: SPRYNG_RECIPIENTS | ||
token_env: SPRYNG_TOKEN | ||
|
||
regions: | ||
- name: region-north | ||
interval: 5s | ||
threshold: 3 | ||
send_interval: 5s | ||
miss_threshold: 3 | ||
groups: | ||
- name: default | ||
threshold: 4 | ||
mediums: telegram | ||
fail_threshold: 4 | ||
tests: | ||
- ping 1.1.1.1 | ||
- name: region-west | ||
interval: 5s | ||
threshold: 3 | ||
send_interval: 5s | ||
miss_threshold: 3 | ||
groups: | ||
- name: default | ||
threshold: 4 | ||
mediums: telegram | ||
fail_threshold: 4 | ||
tests: | ||
- http example.org | ||
- http kongbytes.io | ||
- name: region-south | ||
interval: 5s | ||
threshold: 2 | ||
send_interval: 5s | ||
miss_threshold: 2 | ||
groups: | ||
- name: egress | ||
threshold: 2 | ||
mediums: telegram | ||
fail_threshold: 2 | ||
tests: | ||
- ping 1.1.1.1 | ||
- dns example.org | ||
- http example.org | ||
- dns kongbytes.io | ||
- http kongbytes.io | ||
- name: bars | ||
mediums: telegram | ||
threshold: 3 | ||
fail_threshold: 3 | ||
tests: | ||
- ping 192.168.1.1 | ||
- ping 192.168.2.20 | ||
- ping 1.1.1.1 | ||
- name: other | ||
mediums: telegram | ||
threshold: 5 | ||
fail_threshold: 5 | ||
tests: | ||
- ping 192.168.1.50 | ||
- ping 1.1.1.1 |
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,25 @@ | ||
use serde::Deserialize; | ||
|
||
use crate::common::error::Error; | ||
use super::utils::api_post; | ||
|
||
#[derive(Deserialize)] | ||
struct AlertTestResponse { | ||
alerts_sent: bool, | ||
error: Option<String> | ||
} | ||
|
||
pub async fn test_alerting(base_url: &str, token: &str) -> Result<(), Error> { | ||
|
||
let test_response: AlertTestResponse = api_post(base_url, token, "api/v1/alerting/test").await?; | ||
|
||
if test_response.alerts_sent { | ||
println!("Test alerts sent to all mediums"); | ||
} | ||
else { | ||
let error_message = test_response.error.unwrap_or("no details".into()); | ||
println!("Error while sending test alerts to all mediums ({})", error_message); | ||
} | ||
|
||
Ok(()) | ||
} |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ pub mod incident; | |
pub mod status; | ||
pub mod utils; | ||
pub mod init; | ||
pub mod alerting; |
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
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
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
Oops, something went wrong.