{"id":22104985,"url":"https://github.com/rahul-0000-code/server-grafana-integration","last_synced_at":"2026-06-21T01:02:52.530Z","repository":{"id":254481122,"uuid":"845691286","full_name":"rahul-0000-code/server-grafana-integration","owner":"rahul-0000-code","description":"Integrating grafan for my server for various debugging ","archived":false,"fork":false,"pushed_at":"2024-08-23T19:36:09.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T08:44:31.284Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rahul-0000-code.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-21T18:32:11.000Z","updated_at":"2024-08-23T19:36:13.000Z","dependencies_parsed_at":"2024-12-01T06:52:48.418Z","dependency_job_id":null,"html_url":"https://github.com/rahul-0000-code/server-grafana-integration","commit_stats":null,"previous_names":["rahul-0000-code/server-grafana-integration"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahul-0000-code%2Fserver-grafana-integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahul-0000-code%2Fserver-grafana-integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahul-0000-code%2Fserver-grafana-integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahul-0000-code%2Fserver-grafana-integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rahul-0000-code","download_url":"https://codeload.github.com/rahul-0000-code/server-grafana-integration/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245200675,"owners_count":20576673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-01T06:37:16.139Z","updated_at":"2026-06-21T01:02:52.503Z","avatar_url":"https://github.com/rahul-0000-code.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# server-monitoring in nodejs-grafana\n\n## Goal\n\nSetup monitoring with Prometheus and Grafana on localhost.\n\n## Requirements\n\nNodejs, Docker. Grafana and some libraries\n\n## Demo architecture\n\n![Architecture  Demo](https://user-images.githubusercontent.com/62415557/165236947-11de6649-30d1-4324-b219-996ac800130c.png)\n\n## Steps\n\n1. Run Nodejs server: `npm install` and `node index.js`. Open http://localhost:9090. Show metrics with http://localhost:3000\n2. Update file config prometheus-config.yml and **CHANGE TO YOUR IP**\n3. Visit your running Prometheus and run [queries](https://prometheus.io/docs/prometheus/latest/querying/basics/).\n\n   ![Untitled2](https://user-images.githubusercontent.com/62415557/165243406-7a91ceb6-646f-4a7c-87ba-2e9cd1523d0d.PNG)\n\n   **Request Per Minute**\n\n   `sum(rate(http_request_duration_ms_count[1m])) by (service, route, method, code)  * 60`\n\n   **Error rate**\n\n   `sum(increase(http_request_duration_ms_count{code=~\"^5..$\"}[1m])) /  sum(increase(http_request_duration_ms_count[1m]))`\n\n   **Median Response Time**\n\n   `histogram_quantile(0.5, sum(rate(http_request_duration_ms_bucket[1m])) by (le, service, route, method))`\n\n   **Average Memory Usage**\n\n   `avg(nodejs_external_memory_bytes / 1024 / 1024) by (service)`\n\n   ![Untitled3](https://user-images.githubusercontent.com/62415557/165243532-093e9d13-a696-4979-bb03-7e9d9d253741.PNG)\n\n\n4. Run Grafana by Docker\n\n   `docker run -i -p 3000:3000 grafana/grafana`. Open http://localhost:3000.\n\n   ```\n   Username: admin\n   Password: admin\n   ```\n\n   **Setting datasource**\n\n   Create a Grafana datasource with this settings:\n\n   - name: DS_PROMETHEUS\n   - type: prometheus\n   - url: http://localhost:9090\n   - access: browser\n\n   **Create dashboard**\n\n   - [Import](https://grafana.com/docs/grafana/latest/dashboards/export-import/#import-dashboard) from grafana-dashboard.json.\n\n     ![Untitled](https://user-images.githubusercontent.com/62415557/165243673-7085e397-41da-4cb3-b3e4-730036f17df1.png)\n\n## Reference\n\n[1] Prometheus Docs - https://prometheus.io/docs\n\n[2] Grafana Docs - https://grafana.com/docs/\n\n[3] Prom-client - https://www.npmjs.com/package/prom-client\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahul-0000-code%2Fserver-grafana-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahul-0000-code%2Fserver-grafana-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahul-0000-code%2Fserver-grafana-integration/lists"}