Contact Routing

Hi Folks, first time poster looking for some help!

I’m attempting to configure contact routing in our Sensu Go 6 installation as per https://docs.sensu.io/sensu-go/latest/observability-pipeline/observe-filter/route-alerts/

I’m deploying into a protected environment, so I have no internet access, and am storing assets in an artifactory repo.

As far as I can tell I’ve done everything needed but I’m getting this error in the log every time the filter is called -

sensu-backend: 
{
"component":"pipelined",
"error":"ReferenceError: 'has_contact' is not defined",
"level":"error",
"msg":"error evaluating javascript event filter",
"time":"2020-09-25T10:07:47+01:00"
}

I’m now getting three alerts per event, as it doesn’t seem to be able to identify the has_contact value in the filter, and is routing through all three email-handlers that I have set in my handler set.

Any guidance would be much appreciated.

Thanks.

@giinge121 can you provide your check, filter, and handler definitions?

Hey @aaronsachs - thanks for the reply. Here’s the info, all homed in a namespace called “Tooling”

Check definition as exported by sensuctl check info check-itisgitlab-http-response --namespace Tooling --format yaml

type: CheckConfig
api_version: core/v2
metadata:
  created_by: cdosadmin
  labels:
    contacts: dev
    sensu.io/managed_by: sensuctl
  name: check-itisgitlab-http-response
  namespace: Tooling
spec:
  check_hooks: null
  command: check-http.rb http://itis-gitlab.domain.here/users/sign_in
  env_vars: null
  handlers:
  - email
  high_flap_threshold: 0
  interval: 300
  low_flap_threshold: 0
  output_metric_format: ""
  output_metric_handlers: null
  proxy_entity_name: ""
  publish: true
  round_robin: false
  runtime_assets:
  - sensu-ruby-runtime
  - sensu-plugins-http-checks
  secrets: null
  stdin: false
  subdue: null
  subscriptions:
  - tooling
  timeout: 0
  ttl: 0

Filter, as exported by sensuctl filter info contact_dev --namespace Tooling

=== contact_dev
Name:          contact_dev
Namespace:     Tooling
Action:        allow
Expressions:   has_contact(event, "dev")
RuntimeAssets: contact-filter

Handler info, as exported by sensuctl handler info handler-email-dev --namespace Tooling

    === handler-email-dev
    Name:                  handler-email-dev
    Type:                  pipe
    Timeout:               10
    Filters:               is_incident, not_silenced, contact_dev
    Mutator:               
    Execute:               RUN:  sensu-email-handler -f Noreply.CDSSensu@domain.here -t my.name@domain.here -s 10.ip.redacted.here -P 25 -i -k -T /etc/sensu/dev_email_template
    Environment Variables: 
    Runtime Assets:        sensu-email-handler_linux_amd64

Finally, runtime asset detail sensuctl asset info contact-filter --namespace Tooling

=== contact-filter
Name:             contact-filter
Namespace:        Tooling
URL:              http://domain.here/sensugo-assets/sensu-go-has-contact-filter-0.2.0.tar.gz
SHA-512 Checksum: 7793d60fbe8a2bd1998c2e68f1e96e1593e3df2ee630a8d5da11affc5ee68b3878be8d12d57360c556a40ddf2b01117cf0641e8bd53980a2df7039928ec505b3
Filters:          

Thanks.

I think I’ve resolved this issue now. I was loading the “build” assets into my local repo, not the “release” asset and so the content of the asset was completely wrong. Having realised my mistake and updated my repo everything just clicked into place.

Thanks,
Mark.