Using HTTP API to build Grafana dashboard

409 views Asked by At

I have been using influxDB as a datasource to build Grafana dashboard and now am trying to use an http api link that contain the below json file. The link is for example https://example:8080/cluster. Or if possible to use telegraf to get the extracted data and send the metrics to the influxDB.

I would want to display the http display for example show the TEJD as Status UP and TECJ status as DOWN based on the json shown.

{ "status": "UP",  "TEJD": {"status":"UP", "count":"0", "minDateTime":"", "description":"Workbasket Jdmin"},  "TECJ":
     {"status":"DOWN", "count":"0", "minDateTime":"",
     "description":"Workbasket CreateJppWait"},  "TEDE": {"status":"UP",
     "count":"0", "minDateTime":"", "description":"Workbasket default"}, 
     "TEEW": {"status":"UP", "count":"0", "minDateTime":"",
     "description":"Workbasket eFormWriteFailure"},  "TEFB":
     {"status":"UP", "count":"0", "minDateTime":"",
     "description":"Workbasket BackgroundProcessing"},  "TEIC":
     {"status":"UP", "count":"0", "minDateTime":"",
     "description":"Workbasket IncompleteConnections"},  "TELB":
     {"status":"UP", "count":"18", "minDateTime":"20/12/2022 10:37",
     "description":"Workbasket LRBackgroundProcess"},   "JETE":
     {"status":"UP", "count":"0", "minDateTime":"",
     "description":"Jssignment errors for Jssign-WorkBasket"},  "JEWL":
     {"status":"DOWN", "count":"0", "minDateTime":"",
     "description":"Jssignment errors for Jssign-Worklist"},   "FETE":
     {"status":"UP", "count":"0", "minDateTime":"", "description":"Flow
     errors for Jssign-WorkBasket"},  "FEWL": {"status":"UP", "count":"0",
     "minDateTime":"", "description":"Flow errors for Jssign-Worklist"},  
     "BQBP": {"status":"UP", "count":"0", "minDateTime":"",
     "description":"Broken queue System-Queue-BackgroundProcess"},  "BQDE":
     {"status":"UP", "count":"0", "minDateTime":"", "description":"Broken
     queue System-Queue-DefaultEntry"},   "CQCJ": {"status":"UP",
     "count":"0", "minDateTime":"", "description":"Custom query Create Jpp
     Requests"},   "JS02": {"status":"UP", "description":"Job Scheduler
     CaseDocumentDeletion (Jny one associated node:BackgroundProcessing)"},
     "JS21": {"status":"UP", "description":"Job Scheduler
     PurgeOldSIDExchangeRecords (Jll associated
     nodes:BackgroundProcessing)"},  "JS01": {"status":"UP",
     "description":"Job Scheduler UpdateReferenceData (Jny one associated
     node:BackgroundProcessing)"},   "package": { "name": "Pega Cluster",
     "elapsedTime": "819.0", "lastUpdated": "20/12/2022 10:52" } }

UPDATE : I found out that I can use telegraf http plugin however am still not able to pass the data. I have used this plugin in telegraf

[[inputs.http]]
    urls = ["http://example:8080//Cluster"]
    tagexclude = ["url", "host"]
    #Overwrite measurement name from default `http` to `cluster`
    ### name_override = "httppegacluster"
    data_format = "json_v2"
    [[inputs.http.json_v2]]
        [[inputs.http.json_v2.object]]
             path = "test1"
          

        [[inputs.http.json_v2.object]]
             path = "test2"
        
        [[inputs.http.json_v2.object]]
            path = "test3"
           
        [[inputs.http.json_v2.object]]
            path = "test4"
          
        [[inputs.http.json_v2.object]]
            path = "test5"
    

It is throwing this output but I would want the output to show test 1 test 2 and test 3 as I need to display the keys in the dashboard.

telegraf -config http.conf -test

> http count="0",description="Workbasket Admin",minDateTime="",status="UP" 1671286903000000000
> http count="0",description="Workbasket eFormWriteFailure",minDateTime="",status="UP" 1671286903000000000
> http count="0",description="Workbasket CreateAppWait",minDateTime="",status="UP" 1671286903000000000
> http count="0",description="Workbasket default@RoS",minDateTime="",status="UP" 1671286903000000000
> http count="0",description="Workbasket BackgroundProcessing",minDateTime="",status="UP" 1671286903000000000

I am following this example from this page link https://www.influxdata.com/blog/how-parse-json-telegraf-influxdb-cloud/ but seems the json format is different to mine

0

There are 0 answers