Ad Widget

Collapse

Zabbix Preprocessing

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BalaC
    Junior Member
    • Sep 2021
    • 22

    #1

    Zabbix Preprocessing

    Hi,

    I'm using my prometheus integration with zabbix. Here I'm trying to monitor the pod status.
    My pod `test-postgres-k8sdev-cluster-pooler-repl-6f797d558-n86gs` in `crashloopback`, I fixed it and then it started as different name.
    But in check still for pod `test-postgres-k8sdev-cluster-pooler-repl-6f797d558-n86gs` its `0` and I could still see in the `latest data` with greyed out with below error:
    ```
    Preprocessing failed for: {"data":[{"pod":"haproxy-564cf4b9c9-dxmjr","state":"1"},{"pod":"loop-review-postgres-k8sdev-clust...
    1. Failed: cannot extract value from json by path "$.data[?(@.pod=='test-postgres-k8sdev-cluster-pooler-repl-6f797d558-n86gs')].state.first()": no data matches the specified path
    ```

    How can I pass preprocessing JSONPath to set to value `1` if the podname itself not found in the current fetched data.

    I used this doc for this integration. https://cloud.redhat.com/blog/monito...prometheus-api

    thanks​
  • Answer selected by BalaC at 07-12-2023, 16:09.
    Brambo
    Senior Member
    • Jul 2023
    • 245

    Does the Keep lost resources period not fix that for you (default 30days) Click image for larger version

Name:	image.png
Views:	197
Size:	9.8 KB
ID:	475508

    Comment

    • Brambo
      Senior Member
      • Jul 2023
      • 245

      #2
      try this: $.data.[?(@.pod=='test-postgres-k8sdev-cluster-pooler-repl-6f797d558-n86gs')].state
      Look at the extra . before the [ bracket.

      Comment

      • BalaC
        Junior Member
        • Sep 2021
        • 22

        #3
        Thanks for the reply. My concern is the pod which restarted will have different name, so offcourse this pod will not be there in the actual output after restart. So how can I handle this or how to ignore this deleted pod? But in latest data still I see all the deleted pod as well which is currently not there.

        Comment

        • Brambo
          Senior Member
          • Jul 2023
          • 245

          #4
          Then you must work with LLD discovery to detect and auto create the new pod item(s).
          And with the macros you have you can also create triggers which uses the correct key values. I'm not known with the prometheus intergration, only tried to help with the jsonpath

          Comment

          • BalaC
            Junior Member
            • Sep 2021
            • 22

            #5
            LLD discovery detects the new pod items correctly. But how to delete the old pod(item) that is not exist anymore. Becuase it just stay there in the Latest data. Then either we need to manually delete it and close the alert manually as well.

            Click image for larger version

Name:	image.png
Views:	271
Size:	9.5 KB
ID:	475504

            Comment

            • Brambo
              Senior Member
              • Jul 2023
              • 245

              #6
              Does the Keep lost resources period not fix that for you (default 30days) Click image for larger version

Name:	image.png
Views:	197
Size:	9.8 KB
ID:	475508

              Comment

              • BalaC
                Junior Member
                • Sep 2021
                • 22

                #7
                ok thanks, Yes that cleared the old items.. thanks

                Comment

                Working...