https://github.com/mrspartak/js-internet-status-api
Check's internet connectivity. Return JSON with current status and disconnects history
https://github.com/mrspartak/js-internet-status-api
api charts disconnects-history docker ethernet ethernet-connectivity graph internet internet-connection js json nodejs tester wifi wifi-connection wifi-network
Last synced: about 1 year ago
JSON representation
Check's internet connectivity. Return JSON with current status and disconnects history
- Host: GitHub
- URL: https://github.com/mrspartak/js-internet-status-api
- Owner: mrspartak
- License: mit
- Created: 2020-02-10T11:00:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-12T07:55:14.000Z (over 6 years ago)
- Last Synced: 2025-02-24T03:03:56.278Z (over 1 year ago)
- Topics: api, charts, disconnects-history, docker, ethernet, ethernet-connectivity, graph, internet, internet-connection, js, json, nodejs, tester, wifi, wifi-connection, wifi-network
- Language: HTML
- Homepage:
- Size: 170 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# js-internet-status-api
Return JSON with current status and disconnects history
[](https://hub.docker.com/r/assorium/js-internet-status-api "Docker Cloud Automated build")
[](https://hub.docker.com/r/assorium/js-internet-status-api "Docker Cloud Build Status")
[](https://hub.docker.com/r/assorium/js-internet-status-api "Docker Pulls")
[](https://github.com/mrspartak/js-internet-status-api/releases "Latest Github tag")
## Docker run
Run with defaults
```
docker run -p 3010:3010 --name internet-check \
-v internet-check:/home/node/app/data \
assorium/js-internet-status-api:latest
```
Or use environment variables
```
docker run -p 3010:3010 --name internet-check \
-v internet-check:/home/node/app/data \
-e CHECK_WEBSITE=https://example.com -e RELEVANCE_TIMEOUT=1 \
assorium/js-internet-status-api:latest
```
## Environment variables
#port app will be launched at
const PORT = process.env.PORT || 3010
#interval to check connection in seconds
const INTERVAL = +process.env.INTERVAL * 1000 || 10000;
#website to check connection
const CHECK_WEBSITE = process.env.CHECK_WEBSITE || 'https://google.com';
#timeout in seconds
const CHECK_TIMEOUT = +process.env.CHECK_TIMEOUT * 1000 || 5000;
#retries
const CHECK_RETRIES = +process.env.CHECK_RETRIES || 2;
#this time in hours data will be stored
const RELEVANCE_TIMEOUT = +process.env.RELEVANCE_TIMEOUT * 60 * 60 || 24 * 60 * 60;
## API
JSON API | GET /
```
{
success: true,
serverTS: 1581347597,
currentStatus: true, //current connections status: true|false
lastTs: 4861, //last disconnect seconds ago
archive: [ //history of disconnects
{
start: 1581342736,
finish: 1581342756,
duration: 20
}
]
}
```
Graphs | GET /graph.html
