systemd alert for nginx service

Hello Netdata Gurus,

I have a few questions that I am hoping someone can help with:

I am trying to create an email alert using systemd to check if the nginx service is running.
This is my alert configuration:

  ## Service units
  template: systemd_service_unit_failed_state_nginx
        on: systemd.service_unit_state
     class: Errors
      type: Linux
 component: Systemd units
    module: !* *
    lookup: sum -5s unaligned of nginx.service
     units: state
     every: 10s
      warn: $this != nan AND $this == 1
      info: systemd service unit in the failed state
        to: sysadmin

I see no errors in the error.log when I do a netdatacli reload-health. The log only shows COMMAND: Reloading HEALTH configuration

The alert does not show in http://localhost:19999/api/v1/alarms?all

Please can you help me debug this. Are there any tools that can help me check if my alert is working?

Is health-cmdapi-test.sh something that I can use. The documentation is very sparse and the script crashes out for me with the error:

netdata@debian:/etc/netdata$ /usr/libexec/netdata/plugins.d/health-cmdapi-test.sh
Cmd 'cmd=RESET'
  Expecting 'All health checks and notifications are enabled' : Success
  Check: 'Default State' in 1 sec
  ERROR: Unexpected response stored in /tmp/resp-21810.json
/usr/libexec/netdata/plugins.d/health-cmdapi-test.sh: line 60: RESET-list.json: Permission denied
ERROR: the files RESET-list.json and expected_list/RESET-list.json does not match.

The user netdata has access to my API key.

I figured this out by using an alarm not template.

    alarm: systemd_service_unit_failed_state_nginx_status
        on: systemdunits_service-units.unit_nginx_service_state
     class: Errors
      type: Linux
 component: Nginx unit
    lookup: sum -5s unaligned of inactive,failed
     units: state
     every: 10s
      crit: $this > 0
      info: systemd service unit in the failed state
        to: sysadmin