Documentation
¶
Overview ¶
Example alerter command to echo message to console.
An alerter command is some command or script to be called by alerter on anomalies found.
Command Line Call ¶
This command will be called by alerter with a JSON-formatted argument:
$ ./echo <JSON-string>
JSON Argument ¶
JSON argument example
{
"project": {"name": "foo"},
"user": {
"name": "jack",
"email": "jack@gmail.com",
"enableEmail": true,
"enablePhone": true,
"phone": "18735121212"
},
"metric": {
"name": "timer.count_ps.api",
"score": 1.02,
"stamp": 1452494901,
"value": 139.1
},
"rule": {
"pattern": "timer.mean_90.note.*",
"comment": "service note get api"
}
}
Alerter Command ¶
An alerter command/script should be like this (pseudo code):
// Parse command line arguments#1 json string s = argv[1] data = loadJSON(s) if data['user']['enableEmail'] then // Send email. sendEmail(data['user']['email'], data['metric']) endif if data['user']['enablePhone'] then // Send sms. sendPhone(data['user']['phone'], data['metric']) endif
Click to show internal directories.
Click to hide internal directories.