Merge pull request 'Three more report fields added - <service>, <uri> and <process>' (#15) from v1 into master
Reviewed-on: https://www.cainet.info/git/cai/CAI-Watchdog/pulls/15
This commit is contained in:
commit
7e91e04afb
@ -38,12 +38,14 @@ email = E-mail address for notifications
|
|||||||
command = Command to send notification
|
command = Command to send notification
|
||||||
```
|
```
|
||||||
|
|
||||||
In commands You can use fields ```<email>```, ```<subject>``` and ```<message>```
|
In commands You can use fields ```<email>```, ```<subject>```, ```<message>```, ```<service>```, ```<uri>``` and ```<process>```
|
||||||
|
|
||||||
- ```<email>``` - E-mail address for notifications
|
- ```<email>``` - E-mail address for notifications
|
||||||
- ```<subject>``` - E-mail subject
|
- ```<subject>``` - E-mail subject
|
||||||
- ```<message>``` - Message text
|
- ```<message>``` - Message text
|
||||||
|
- ```<service>``` - Service name
|
||||||
|
- ```<uri>``` - Service URI (for web services)
|
||||||
|
- ```<process>``` - Process name (for OS tasks)
|
||||||
### Scripts configurations
|
### Scripts configurations
|
||||||
|
|
||||||
#### *nix
|
#### *nix
|
||||||
|
|||||||
@ -353,11 +353,15 @@ fn main() {
|
|||||||
.replace("<email>", &tasks[i].email)
|
.replace("<email>", &tasks[i].email)
|
||||||
.replace("<subject>", &format!("\"\u{274c} Service {} ({}) is offline\"", tasks[i].service, tasks[i].uri))
|
.replace("<subject>", &format!("\"\u{274c} Service {} ({}) is offline\"", tasks[i].service, tasks[i].uri))
|
||||||
.replace("<message>", &format!("\"\u{274c} Service {} ({}) is offline now\"", tasks[i].service, tasks[i].uri))
|
.replace("<message>", &format!("\"\u{274c} Service {} ({}) is offline now\"", tasks[i].service, tasks[i].uri))
|
||||||
|
.replace("<service>", &tasks[i].service)
|
||||||
|
.replace("<uri>", &tasks[i].uri)
|
||||||
} else {
|
} else {
|
||||||
tasks[i].command.to_string()
|
tasks[i].command.to_string()
|
||||||
.replace("<email>", &tasks[i].email)
|
.replace("<email>", &tasks[i].email)
|
||||||
.replace("<subject>", &format!("\"\u{274c} Process {} ({}) is not running\"", tasks[i].service, tasks[i].process))
|
.replace("<subject>", &format!("\"\u{274c} Process {} ({}) is not running\"", tasks[i].service, tasks[i].process))
|
||||||
.replace("<message>", &format!("\"\u{274c} Process {} ({}) is not running now\"", tasks[i].service, tasks[i].process))
|
.replace("<message>", &format!("\"\u{274c} Process {} ({}) is not running now\"", tasks[i].service, tasks[i].process))
|
||||||
|
.replace("<service>", &tasks[i].service)
|
||||||
|
.replace("<process>", &tasks[i].process)
|
||||||
};
|
};
|
||||||
|
|
||||||
debug_log(format!("execute {}", shell_cmd));
|
debug_log(format!("execute {}", shell_cmd));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user