We've moved to a new support system!

The Nagios Answer Hub is a place where you can get help with technical questions from our experts. There, you can quickly open tickets and join discussion boards.

Request Nagios Answer Hub access here: https://info.nagios.com/answer-hub-access-new-users

After completing the access form, you will be given access to a portal where new tickets can be created. We will keep the old customer forum sections and ticket system available for current cases to be resolved.

Go to the Answer Hub

Grafana API and nagios_http_json plugin not working for me

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Grafana API and nagios_http_json plugin not working for me

Postby silex27 » Sun May 08, 2022 1:06 pm

Hello !
So basicly my problem is :
There is a JSON output : asd.local/api/alertmanager/grafana/api/v2/alerts site,

and I figured I can find the value:
curl http://secret:secret@asd.local/api/aler ... /v2/alerts | jq '.[2] | {summary: .annotations.Value}'

And Im really want to use this nagios plugin: https://github.com/drewkerrigan/nagios- ... n#examples

But every time I try to pass the thing I want , the key doesnt exist. I have 5 alerts , all similar to the one I want to check. What am I doing wrong ? I cant even find the value.

./check_http_json.py -H asd.local -p api/alertmanager/grafana/api/v2/alerts -B secret:secret '--key_exists' 'annotations.Value'
WARNING: Status WARNING. Key annotations.Value did not exist.
My 2nd alert JSON output (i have 5 alerts atm, and I want to do a check for all ):



{
"annotations": {
"Value": "79.15237728630086",
"__dashboardUid__": "oImjCZw7k",
"__panelId__": "13",
"__value_string__": "[ var='B' labels={app=rook-ceph-mgr, ceph_daemon_id=a, ceph_daemon_type=mgr, instance=a, job=kubernetes-pods, kubernetes_namespace=rook-ceph, kubernetes_pod_name=rook-ceph-mgr-a-756f8f9db7-2lwrh, mgr=a, pod_template_hash=756f8f9db7, rook_cluster=rook-ceph} value=79.15237728630086 ], [ var='C' labels={app=rook-ceph-mgr, ceph_daemon_id=a, ceph_daemon_type=mgr, instance=a, job=kubernetes-pods, kubernetes_namespace=rook-ceph, kubernetes_pod_name=rook-ceph-mgr-a-756f8f9db7-2lwrh, mgr=a, pod_template_hash=756f8f9db7, rook_cluster=rook-ceph} value=1 ]",
"summary": "rook-ceph disk usage reach 70% tmo-preprod"
},
"endsAt": "2022-05-08T17:39:26.509Z",
"fingerprint": "46e38998309bd18d",
"receivers": [
{
"name": "asd"
}
],
"startsAt": "2022-05-08T16:58:36.509Z",
"status": {
"inhibitedBy": [],
"silencedBy": [],
"state": "active"
},
"updatedAt": "2022-05-08T17:38:01.540Z",
"generatorURL": "http://localhost:3000/alerting/mjIAVt_nk/edit",
"labels": {
"__alert_rule_uid__": "mjIAVt_nk",
"alertname": "High Disk Usage > 70%",
"app": "rook-ceph-mgr",
"ceph_daemon_id": "a",
"ceph_daemon_type": "mgr",
"instance": "a",
"job": "kubernetes-pods",
"kubernetes_namespace": "rook-ceph",
"kubernetes_pod_name": "rook-ceph-mgr-a-756f8f9db7-2lwrh",
"mgr": "a",
"pod_template_hash": "756f8f9db7",
"rook_cluster": "rook-ceph"
}
}
The goal would be setting a warning and critical level:

-w 'annotation.Value,1:70'
Any help would be nice !
silex27
 
Posts: 1
Joined: Fri Apr 29, 2022 1:55 am

Return to Community Support

Who is online

Users browsing this forum: Fess [Nagios Bot] and 23 guests