Creates and removes silences in AlertManager.
create
- create silencedelete
- remove silence
urls
- list of urls to send a requestduration
- duration of added silence (only for create action)template
- one of the available request body templatesstrict_match
- checking for an exact match of all alert conditions (false by default)valid_response_codes
- list of expected HTTP response codesheaders
- additional request headerscustom_template
- arbitrary request body (Jinja syntax with access to environment variables is supported)username/password
- credentials for HTTP authorizationskip_verify
- disable SSL certificate verification (for self-signed ones)follow_redirects
- follow a 301/302 redirecttimeout
- maximum time to wait for a response (in seconds)
An example of use in a build step for our "typical" container deployment:
- name: add silence
image: osshelp/drone-alertmanager
settings:
urls:
- https://clientname.ossmon.ru/alertmanager
action: create
template: default
duration: 600
job: '^clientname$'
instance: '^server-\w+.+'
<# Deploy steps #>
- name: remove silence
image: osshelp/drone-alertmanager
settings:
urls:
- https://clientname.ossmon.ru/alertmanager
action: delete
when:
status:
- success
- failure
So far, the main and only template.
{
"id": null,
"createdBy": "drone/alertmanager",
"startsAt": "2019-11-14T02:27:07.429780Z",
"endsAt": "2019-11-14T02:29:07.429780Z",
"comment": "Created for build#42 of orgname/reponame, see http://clientname.ossbuild.ru/link/to/build",
"matchers": [
{
"isRegex": true,
"name": "job",
"value": "^clientname$"
},
{
"isRegex": true,
"name": "instance",
"value": "^server-\\w+.+"
}
]
}
For internal purposes and OSSHelp customers we have an alternative image url:
image: oss.help/drone/alertmanager
There is no difference between the DockerHub image and the oss.help/drone image.
- skip adding silence if exactly the "same" already exists (i.e. same labels)
- what else do we need to "escape" for regexp in JSON?
- prepare typical regexp as examples and recommendations for commonly used labels