Disable rule

Hello, I have been trying to figure out if there is a way to disable a rule programmatically via the API. I see that we can delete, create, and modify rules via the API, but I don’t see an option to disable and enable.

Any help appreciated.

Thank you
Ashoke.

Edit the rule via the API, and change the disabled field from false to true.

Thank you, do you have to provide all of the values or can you just provide rule_id and disabled ?

Input (JSON):

  • rule_id: You must specify the rule_id to edit an existing rule, if this is absent then a new rule will be created.
  • devices: This is either an array of device ids or -1 for a global rule
  • builder: The rule which should be in the format entity.condition value (i.e devices.status != 0 for devices marked as down). It must be json encoded in the format rules are currently stored.
  • severity: The severity level the alert will be raised against, Ok, Warning, Critical.
  • disabled: Whether the rule will be disabled or not, 0 = enabled, 1 = disabled
  • count: This is how many polling runs before an alert will trigger and the frequency.
  • delay: Delay is when to start alerting and how frequently. The value is stored in seconds but you can specify minutes, hours or days by doing 5 m, 5 h, 5 d for each one.
  • interval: How often to re-issue notifications while this alert is active,0 means notify once.The value is stored in seconds but you can specify minutes, hours or days by doing 5 m, 5 h, 5 d for each one.
  • mute: If mute is enabled then an alert will never be sent but will show up in the Web UI (true or false).
  • invert: This would invert the rules check.
  • name: This is the name of the rule and is mandatory.
  • notes: Some informal notes for this rule