
Grafana Has a Free HTTP API That Lets You Build Dashboards Programmatically
Grafana is the open-source observability platform. Its HTTP API lets you create dashboards, alerts, and data sources entirely through code. Dashboard API: Create Dashboards via Code const dashboard = { dashboard : { title : " Scraping Metrics " , tags : [ " scraping " , " monitoring " ], panels : [ { id : 1 , type : " timeseries " , title : " Scrapes per Hour " , gridPos : { h : 8 , w : 12 , x : 0 , y : 0 }, targets : [{ expr : ' rate(scrapes_total[1h]) ' , legendFormat : ' {{source}} ' , }], }, { id : 2 , type : " stat " , title : " Total Products Scraped " , gridPos : { h : 4 , w : 6 , x : 12 , y : 0 }, targets : [{ expr : ' scrapes_total ' }], options : { colorMode : " value " , graphMode : " area " }, }, { id : 3 , type : " table " , title : " Recent Errors " , gridPos : { h : 8 , w : 12 , x : 12 , y : 4 }, targets : [{ expr : ' scrape_errors_total ' , format : ' table ' , }], }, ], }, overwrite : true , }; const response = await fetch ( " http://localhost:3000/api/dashboards/db "
Continue reading on Dev.to DevOps
Opens in a new tab



