-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Subject: While using pagerduty 2.6.0(https://github.com/sensu/sensu-pagerduty-handler/releases/tag/2.6.0), facing error: invalid character.
Context: While using event with the PagerDuty handler version 2.6.0 & annotations using the '--details-format json' parameter, an error involving 'invalid character' is consistently encountered. However, the event proceeds successfully when '--details-format string' is used instead.
- Example Command and Output with '--details-format string':
cat event.json | ./pagerduty-handler -t *redacted* --details-format string --dedup-key-template "{{.Entity.Namespace}}-{{.Entity.Name}}-{{.Check.Name}}" --status-map "{\"info\":[0],\"warning\": [1],\"critical\": [2],\"error\": [3,127]}" --summary-template "[{{.Entity.Namespace}}] {{.Entity.Name}}/{{.Check.Name}}: {{.Check.State}}" --details-template "{{.Check.Output}}\n\n{{.Check}}"
Output:
2024/02/29 15:05:17 Incident severity: error
2024/02/29 15:05:17 Incident Summary: [default] ip-172-31-27-229/helloworld: failing
2024/02/29 15:05:18 Event (trigger) submitted to PagerDuty, Status: success, Dedup Key: default-ip-172-31-27-229-helloworld, Message: Event processed
This signifies that the event is successfully processed without encountering the error.
- Example Command and Output with '--details-format json':
cat event.json | ./pagerduty-handler -t *redacted* --details-format json --dedup-key-template "{{.Entity.Namespace}}-{{.Entity.Name}}-{{.Check.Name}}" --status-map "{\"info\":[0],\"warning\": [1],\"critical\": [2],\"error\": [3,127]}" --summary-template "[{{.Entity.Namespace}}] {{.Entity.Name}}/{{.Check.Name}}: {{.Check.State}}" --details-template "{{.Check.Output}}\n\n{{.Check}}"
Output:
2024/02/29 15:04:53 Incident severity: error
2024/02/29 15:04:53 Incident Summary: [default] ip-172-31-27-229/helloworld: failing
Error executing sensu-pagerduty-handler: error executing handler: failed to unmarshal json details: invalid character 'e' looking for beginning of value
NOTE: The invalid character keeps on changing with 'e', '{', 'H' whenever we use different event.json. But the originally we faced the below error which was constant for a couple for time:
Error executing sensu-pagerduty-handler: error executing handler: failed to unmarshal json details: invalid character '\n' in string literal.
This signifies that the event is not passed.