-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rs
28 lines (25 loc) · 1.06 KB
/
main.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use std::thread;
use std::time::Duration;
use reqwest;
fn main() {
let target_url = "https://www.example.com"; // URL do aplicativo ou sistema a ser verificado
let sleep_duration = Duration::from_secs(60); // Intervalo de verificação em segundos
loop {
// Realizar uma verificação de ping no URL
match reqwest::blocking::get(target_url) {
Ok(response) => {
if response.status().is_success() {
println!("O aplicativo ou sistema está online.");
} else {
println!("ATENÇÃO: O aplicativo ou sistema está offline!");
// Aqui você pode adicionar lógica para enviar uma notificação, por exemplo, via e-mail, SMS, etc.
}
}
Err(_) => {
println!("ATENÇÃO: O aplicativo ou sistema está offline!");
// Aqui você pode adicionar lógica para enviar uma notificação, por exemplo, via e-mail, SMS, etc.
}
}
thread::sleep(sleep_duration);
}
}