Ad Widget

Collapse

Trigger to recover when a new message has not been received

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • devkevm
    Junior Member
    • Jun 2024
    • 3

    #1

    Trigger to recover when a new message has not been received

    I am currently trying to build a trigger to respond to motion events coming from our NVR.
    I am ingesting the realtime stream of events over MQTT using an active Zabbix agent. I have a feed of events in zabbix that looks like:
    2024-06-03 10:21:56 {"before": {"id": "1717424344.78219-1wvhgx", "camera": "CAM01", "frame_time": 1717424442.383117, "snapshot_time": 1717424442.383117, "label": "person", "sub_label": null, "top_score": 0.7142853140830994, "false_positive": false, "start_time": 1717424344.78219, "end_time": null, "score": 0.711429238319397, "box": [955, 168, 1028, 255], "area": 6351, "ratio": 0.8390804597701149, "region": [786, 4, 1202, 420], "stationary": false, "motionless_count": 1, "position_changes": 1, "current_zones": [], "entered_zones": [], "has_clip": true, "has_snapshot": true}, "after": {"id": "1717424344.78219-1wvhgx", "camera": "CAM01", "frame_time": 1717424443.583545, "snapshot_time": 1717424442.383117, "label": "person", "sub_label": null, "top_score": 0.7142853140830994, "false_positive": false, "start_time": 1717424344.78219, "end_time": 1717424514.194529, "score": 0.7166204452514648, "box": [956, 174, 1031, 251], "area": 5775, "ratio": 0.974025974025974, "region": [787, 0, 1203, 416], "stationary": false, "motionless_count": 3, "position_changes": 1, "current_zones": [], "entered_zones": [], "has_clip": true, "has_snapshot": true}, "type": "end"}
    2024-06-03 10:20:44 {"before": {"id": "1717424344.78219-1wvhgx", "camera": "CAM01", "frame_time": 1717424416.982556, "snapshot_time": 1717424414.782923, "label": "person", "sub_label": null, "top_score": 0.7142853140830994, "false_positive": false, "start_time": 1717424344.78219, "end_time": null, "score": 0.7385914325714111, "box": [959, 167, 1028, 253], "area": 5934, "ratio": 0.8023255813953488, "region": [783, 6, 1199, 422], "stationary": false, "motionless_count": 6, "position_changes": 1, "current_zones": [], "entered_zones": [], "has_clip": true, "has_snapshot": true}, "after": {"id": "1717424344.78219-1wvhgx", "camera": "CAM01", "frame_time": 1717424442.383117, "snapshot_time": 1717424442.383117, "label": "person", "sub_label": null, "top_score": 0.7142853140830994, "false_positive": false, "start_time": 1717424344.78219, "end_time": null, "score": 0.711429238319397, "box": [955, 168, 1028, 255], "area": 6351, "ratio": 0.8390804597701149, "region": [786, 4, 1202, 420], "stationary": false, "motionless_count": 1, "position_changes": 1, "current_zones": [], "entered_zones": [], "has_clip": true, "has_snapshot": true}, "type": "update"}
    2024-06-03 10:20:20 {"before": {"id": "1717424344.78219-1wvhgx", "camera": "CAM01", "frame_time": 1717424413.60084, "snapshot_time": 1717424345.182311, "label": "person", "sub_label": null, "top_score": 0.7142853140830994, "false_positive": false, "start_time": 1717424344.78219, "end_time": null, "score": 0.7356936931610107, "box": [961, 167, 1028, 249], "area": 5494, "ratio": 0.8170731707317073, "region": [774, 21, 1190, 437], "stationary": false, "motionless_count": 0, "position_changes": 1, "current_zones": [], "entered_zones": [], "has_clip": true, "has_snapshot": true}, "after": {"id": "1717424344.78219-1wvhgx", "camera": "CAM01", "frame_time": 1717424416.982556, "snapshot_time": 1717424414.782923, "label": "person", "sub_label": null, "top_score": 0.7142853140830994, "false_positive": false, "start_time": 1717424344.78219, "end_time": null, "score": 0.7385914325714111, "box": [959, 167, 1028, 253], "area": 5934, "ratio": 0.8023255813953488, "region": [783, 6, 1199, 422], "stationary": false, "motionless_count": 6, "position_changes": 1, "current_zones": [], "entered_zones": [], "has_clip": true, "has_snapshot": true}, "type": "update"}
    2024-06-03 10:20:15 {"before": {"id": "1717424344.78219-1wvhgx", "camera": "CAM01", "frame_time": 1717424345.182311, "snapshot_time": 1717424345.182311, "label": "person", "sub_label": null, "top_score": 0.7062636613845825, "false_positive": false, "start_time": 1717424344.78219, "end_time": null, "score": 0.7062636613845825, "box": [955, 169, 1029, 250], "area": 5994, "ratio": 0.9135802469135802, "region": [785, 8, 1201, 424], "stationary": false, "motionless_count": 1, "position_changes": 1, "current_zones": [], "entered_zones": [], "has_clip": true, "has_snapshot": true}, "after": {"id": "1717424344.78219-1wvhgx", "camera": "CAM01", "frame_time": 1717424413.60084, "snapshot_time": 1717424345.182311, "label": "person", "sub_label": null, "top_score": 0.7142853140830994, "false_positive": false, "start_time": 1717424344.78219, "end_time": null, "score": 0.7356936931610107, "box": [961, 167, 1028, 249], "area": 5494, "ratio": 0.8170731707317073, "region": [774, 21, 1190, 437], "stationary": false, "motionless_count": 0, "position_changes": 1, "current_zones": [], "entered_zones": [], "has_clip": true, "has_snapshot": true}, "type": "update"}
    2024-06-03 10:19:07 {"before": {"id": "1717424344.78219-1wvhgx", "camera": "CAM01", "frame_time": 1717424344.78219, "snapshot_time": 0.0, "label": "person", "sub_label": null, "top_score": 0.0, "false_positive": true, "start_time": 1717424344.78219, "end_time": null, "score": 0.7223069667816162, "box": [964, 169, 1027, 252], "area": 5229, "ratio": 0.7590361445783133, "region": [768, 26, 1184, 442], "stationary": false, "motionless_count": 0, "position_changes": 0, "current_zones": [], "entered_zones": [], "has_clip": false, "has_snapshot": false}, "after": {"id": "1717424344.78219-1wvhgx", "camera": "CAM01", "frame_time": 1717424345.182311, "snapshot_time": 1717424345.182311, "label": "person", "sub_label": null, "top_score": 0.7062636613845825, "false_positive": false, "start_time": 1717424344.78219, "end_time": null, "score": 0.7062636613845825, "box": [955, 169, 1029, 250], "area": 5994, "ratio": 0.9135802469135802, "region": [785, 8, 1201, 424], "stationary": false, "motionless_count": 1, "position_changes": 1, "current_zones": [], "entered_zones": [], "has_clip": true, "has_snapshot": true}, "type": "new"}

    The trigger I have created so far:
    Click image for larger version

Name:	image.png
Views:	168
Size:	83.1 KB
ID:	484836​The Tags are:
    Click image for larger version

Name:	image.png
Views:	52
Size:	50.1 KB
ID:	484837

    The logic I am looking for is along the lines of "open a new problem every time an event of type new comes in. I want to then close it when either a corresponding event of type end comes in, or no update events have been received for two minutes.
    The event creation appears to be working just fine (every new event creates a problem) and the closing when an end event comes in appears to be working just fine. However, the logic for "close events if no update has been received for two minutes does not. I have that logic because if the server reboots, it stops and removes all events that are active (and does not send an end for them). Therefore I want zabbix to assume the event has ended if it stops receiving updates. This could also happen if I just happen to miss the end message and I don't want the problems to stay open indefinitely because the update messages will keep coming if the event is still open.

    To try and troubleshoot, I used a calculated item to test the recovery expression against my data and the responses from it seem to line up with this working. However, problems just will not close if they don't receive an end message.

    Any advice troubleshooting would be greatly appreciated!
Working...