{"id":22799995,"url":"https://github.com/dadi/status","last_synced_at":"2025-04-30T19:34:04.684Z","repository":{"id":57105385,"uuid":"53654124","full_name":"dadi/status","owner":"dadi","description":"Return information about an application's platform, process and health state.","archived":false,"fork":false,"pushed_at":"2018-11-21T21:56:59.000Z","size":33,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-04-26T02:22:05.932Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dadi.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}},"created_at":"2016-03-11T09:05:49.000Z","updated_at":"2018-11-21T21:55:18.000Z","dependencies_parsed_at":"2022-08-20T20:10:39.801Z","dependency_job_id":null,"html_url":"https://github.com/dadi/status","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fstatus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fstatus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fstatus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dadi%2Fstatus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dadi","download_url":"https://codeload.github.com/dadi/status/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246365644,"owners_count":20765549,"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-12T07:10:44.242Z","updated_at":"2025-03-30T19:17:39.065Z","avatar_url":"https://github.com/dadi.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DADI Status\n\n[![npm (scoped)](https://img.shields.io/npm/v/@dadi/status.svg?maxAge=10800\u0026style=flat-square)](https://www.npmjs.com/package/@dadi/status)\n[![Coverage Status](https://coveralls.io/repos/github/dadi/status/badge.svg?branch=master)](https://coveralls.io/github/dadi/status?branch=master)\n[![Build Status](https://travis-ci.org/dadi/status.svg?branch=master)](https://travis-ci.org/dadi/status)\n[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com/)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release)\n\n## Overview\n\nDADI Status returns a JSON object containing information about an application's platform, process and health state.\n\n### Data returned\n\n* Latest version of the specified NPM module (e.g. @dadi/web)\n* Node version\n* Process ID\n* Process uptime\n* Process memory usage\n* Hostname\n* System platform and version\n* System Uptime\n* Memory, free and total\n* Current load averages\n\n### Health Check Routes\n\nIn addition to system information, if a collection of routes are specified DADI Status will send a request to each\none and return data about the response:\n\n```\n  \"routes\": [\n    {\n      \"route\": \"/movies/latest\",\n      \"status\": 200,\n      \"responseTime\": 0.039,\n      \"healthStatus\": \"Green\"\n    }\n  ]\n```\n\n### User-Agent identifier\n\nDADI Status passes a User-Agent header to idenitify itself when making health check requests. The following header is used:\n\n```\n'User-Agent': '@dadi/status'\n```\n\n## Usage\n\n### Install\n\n```\nnpm install @dadi/status --save\n```\n\n### Add a route\n\n```js\nvar dadiStatus = require('@dadi/status')\n\napp.use('/api/status', function(req, res, next) {\n  var params = {\n    site: \"WC?\",\n    package: '@dadi/web',\n    version: version,\n    healthCheck: {\n      baseUrl: 'http://127.0.0.1:3001',\n      authorization: 'Bearer 123abcdef',\n      routes: [{\n        route: '/movies/latest',\n        expectedResponseTime: 10\n      }]\n    }\n  }\n\n  dadiStatus(params, function(err, data) {\n    if (err) return next(err)\n    var resBody = JSON.stringify(data, null, 2)\n\n    res.statusCode = 200\n    res.setHeader('Content-Type', 'application/json')\n    res.setHeader('content-length', Buffer.byteLength(resBody))\n    res.end(resBody)\n  })\n})\n```\n\n### Sample response\n\n```\n{\n  \"service\": {\n    \"site\": \"WC?\",\n    \"package\": \"@dadi/web\",\n    \"versions\": {\n      \"current\": \"1.1.2\",\n      \"latest\": \"1.1.2\"\n    }\n  },\n  \"process\": {\n    \"pid\": 19463,\n    \"uptime\": 3.523,\n    \"uptimeFormatted\": \"0 days 0 hours 0 minutes 3 seconds\",\n    \"versions\": {\n      \"http_parser\": \"2.3\",\n      \"node\": \"0.12.0\",\n      \"v8\": \"3.28.73\",\n      \"uv\": \"1.0.2\",\n      \"zlib\": \"1.2.8\",\n      \"modules\": \"14\",\n      \"openssl\": \"1.0.1l\"\n    }\n  },\n  \"memory\": {\n    \"rss\": \"86.508 MB\",\n    \"heapTotal\": \"65.771 MB\",\n    \"heapUsed\": \"32.938 MB\"\n  },\n  \"system\": {\n    \"platform\": \"darwin\",\n    \"release\": \"14.5.0\",\n    \"hostname\": \"hudson\",\n    \"memory\": {\n      \"free\": \"37.781 MB\",\n      \"total\": \"8.000 GB\"\n    },\n    \"load\": [\n      2.2958984375,\n      2.27197265625,\n      2.25927734375\n    ],\n    \"uptime\": 155084,\n    \"uptimeFormatted\": \"1 days 19 hours 4 minutes 44 seconds\"\n  },\n  \"routes\": [\n    {\n      \"route\": \"/movies/latest\",\n      \"responseTime\": 0.039,\n      \"healthStatus\": \"Green\"\n    }\n  ]\n}\n```\n\n## Licence\n\nCopyright notice\u003cbr /\u003e\n(C) 2018 DADI+ Limited \u003csupport@dadi.co\u003e\u003cbr /\u003e\nAll rights reserved\n\nThis product is part of DADI.\u003cbr /\u003e\nDADI is free software; you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as\npublished by the Free Software Foundation; either version 2 of\nthe License, or (at your option) any later version (\"the AGPL\").\n**If you wish to use DADI outside the scope of the AGPL, please\ncontact us at info@dadi.co for details of alternative licence\narrangements.**\n\n**This product may be distributed alongside other components\navailable under different licences (which may not be AGPL). See\nthose components themselves, or the documentation accompanying\nthem, to determine what licences are applicable.**\n\nDADI is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU Affero General Public License for more details.\n\nThe GNU Affero General Public License (AGPL) is available at\nhttp://www.gnu.org/licenses/agpl-3.0.en.html.\u003cbr /\u003e\n\nThis copyright notice MUST APPEAR in all copies of the product!\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fstatus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdadi%2Fstatus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdadi%2Fstatus/lists"}