site-status

Ping web sites and get status

site-status

Ping web sites and get status

Like pingdom or keynote, site-status access some endpoints of web sites and gets the "Site Status".

Example:

$ cat ./example/github.json
{ "site": "github", "url": "https://status.github.com/", "stats": { "GitHub": { "selector": "div.service:nth-of-type(1) span.status", "type": "string" } , "App Server %": { "selector": "div.graph div.data:nth-of-type(1) span.number", "type": "numeric" } } }

$ cat ./example/github.json | site-status
{"site":"github","url":"https://status.github.com/","time":1100,"code":"200","stats":{"GitHub":"Normal","App Server %":100}}

HTTP status code.

Response time of the HTTP request.

Some sites have "status" value in their contents of the sites. site-status can scrape the value.

Currently only HTML and CSS selector. JSONPath will be supported soon.

npm install -g site-status

site-status reads STDIN line by line as a site configuration JSON object, get the sites and writes STDOUT line by line as a site status.

Name of the site

URL of the site endpoint

  • key: name of the stat
  • value:
    • selector: CSS selector
    • type: numeric or string

You have to use a single line JSON.

{ "site": "github", "url": "https://status.github.com/", "stats": { "GitHub": { "selector": "div.service:nth-of-type(1) span.status", "type": "string" } , "App Server %": { "selector": "div.graph div.data:nth-of-type(1) span.number", "type": "numeric" } } }

pretty print:

{
    "site": "github",
    "url": "https://status.github.com/",
    "stats": {
        "App Server %": {
            "selector": "div.graph div.data:nth-of-type(1) span.number",
            "type": "numeric"
        },
        "GitHub": {
            "selector": "div.service:nth-of-type(1) span.status",
            "type": "string"
        }
    }
}

Same as the site configuration

Same as the site configuration

HTTP status code (200, 400, 500 or ***)

Response time (ms)

Scraped status

{"site":"github","url":"https://status.github.com/","time":912,"code":"200","stats":{"GitHub":"Normal","App Server %":100}}

pretty print:

{
    "site": "github",
    "url": "https://status.github.com/",
    "code": "200",
    "time": 912,
    "stats": {
        "App Server %": 100,
        "GitHub": "Normal"
    }
}
  Usage: site-status [options]

  Options:

    -h, --help         output usage information
    -V, --version      output the version number
    -t, --timeout <n>  Timeout (ms) default: 10000

MIT

Ryosuke IWANAGA a.k.a. riywo