This fixes the following error found by go vet:
config/notifiers.go:546:2: struct field tag
`yaml:"url_title,omitempty" json:"url_title,omitempty` not compatible with
reflect.StructTag.Get: bad syntax for struct tag value (govet)
URLTitle string `yaml:"url_title,omitempty" json:"url_title,omitempty`
^
Signed-off-by: Karsten Weiss <knweiss@gmail.com>
Instead of handling all config specific logic inside
Alertmangaer.main(), this patch introduces the config coordinator
component.
Tasks of the config coordinator:
- Load and parse configuration
- Notify subscribers on configuration changes
- Register and manage configuration specific metrics
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
In similar vein to prometheus/prometheus/pkg/relabel/relabel.go, extend
Regexp to include the original regular expression string to faithfully
output what was read.
Update TestEmptyFieldsAndRegex.
Fixes: #1753
Signed-off-by: Miek Gieben <miek@miek.nl>
The variable DefaultGlobalConfig was being used to initialize values, but it stored previous information due to which some things were persisting in the newer initialization.
In this PR, DefaultGlobalConfig is changed to a function so that it returns a fresh GlobalConfig for initialization.
Signed-off-by: Hrishikesh Barman <hrishikeshbman@gmail.com>
* Support adding custom fields to VictorOps notifications
* Response to feedback
* Added logic to validate victorops custom fields to config load time
* Cleanup victorops notifier of logic duplicated in config check
* rebase and further cleanup from feedback
* another grammer fix
Signed-off-by: Jason Roberts <jroberts@drud.com>
GroupByAll and a duplicate GroupBy were showing up
in the marshaled config, which we don't want.
Signed-off-by: stuart nelson <stuartnelson3@gmail.com>
To aggregate by all possible labels use '...' as the sole label name.
This effectively disables aggregation entirely, passing through all
alerts as-is. This is unlikely to be what you want, unless you have
a very low alert volume or your upstream notification system performs
its own grouping. Example: group_by: [...]
Signed-off-by: Kyryl Sablin <kyryl.sablin@schibsted.com>
* Add support for images and links in the PagerDuty notification config
This only works when using the v2 API. It supports template values for all fields.
Signed-off-by: Sean Houghton <sean.houghton@activision.com>
`honnef.co/go/tools/cmd/staticcheck` complains with
`config/config_test.go:260:32: regular expression does not contain any
meta characters (SA6004)`. Instead of using a RegEx this patch simply
switches to using Golangs `strings.Count` function.
Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
* config: validate URLs at config load time
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Address Brian and Lucas comments
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Shallow copy of URL instead of reparsing it
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Unshadow net/url package
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* Make a deep-copy of URL struct
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
The YAML strict mode doesn't allow mapping keys that are duplicates. If
someone wants to override one of the default keys in the Details hash,
the unmarshal function returns an error because the key is already
defined by DefaultPagerdutyConfig.
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
* WECHAT support by ybyang2/berlinsaint
* correct the whitespace
* add some TestFile and modify some naming errors by ybyang2/berlinsaint
* modify wechat retry test expect
* template error
* add newline
Signed-off-by: yb_home <berlinsaint@126.com>
* fmt some pr code
* use the @stuartnelson3 the test-ci-wechat bingdata.go
* notify go add wechat
* Adding check for webhook's URL formatting
Since alertmanager will fail silently when trying to send to a schemaless URL, provide a way to check that a URL is properly formatted in alertmanager
* updating error message as requested
* added email notification text content support (configuration text)
added default email notification text content default value empty
converted email notification from html to multipart/alternatives with support to both html (first) and text (last)
ignore intellij IDE .idea working folder
* removed specific editor .gitignore entries
* renamed TEXT to Text as it's not an acronym
added TODO note to refactor multipart code to use standard go library
* refactored to use standard go mime/multipart library for text and html parts and bounderies
* use multipart createPart returned writer
added error handling while creating parts
removed unnecessary quotes from boundry string
* removed unnecessary comments
* Support for custom SMTP hello string
Some MTAs insist that they be greeted with a fully qualified domain
name. The default provided by the net/smtp library, "HELLO localhost",
is not sufficient and will result in rejected messages.
This changeset adds a new configuration option that allows the
alertmanager to do its job in such an environment.
* Test SMTPHello parsing