2017 © Pedro Peláez
 

library fping

Simple microservice / function to check target health

image

rakshazi/fping

Simple microservice / function to check target health

  • Wednesday, April 11, 2018
  • by rakshazi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 55 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 4 % Grown

The README.md

fping

Simple microservice / function to check target server, site, etc status., (*1)

Table of Contents

Usage

Docker

docker run -d -p 8080:8080 rakshazi/fping

curl -X POST -d "type=HTTP&address=https://google.com" localhost:8080

#response
{"status_code":200,"time":0.448615,"should_contain":true,"should_not_contain":true,"status":true}

OpenFaaS

Coming soon..., (*2)

Composer (optional)

If you want to use fping "as-is", without docker, you can install it with composer:, (*3)

composer require rakshazi/fping

API

Request

fping built on top of OpenFaaS Watchdog to provide simple API and integration with OpenFaaS., (*4)

To call fping, you should send POST request to fping address (in example above - localhost:8080) with following body structure:, (*5)

json:, (*6)

{
    "type": "Check type",
    "address": "Target server/site address",
    "timeout": 5, //integer timeout in seconds
    "optional": {} //optional params, specific for each check type
}

raw form:, (*7)

type=Check type&address=Target address&timeout=5&optional[param1]=val1&optional[param2]=val2

Response

json:, (*8)

{
    "status_code":200, //HTTP response status code
    "time":448, //response time in ms
    "should_contain":true, //optional for HTTP
    "should_not_contain":true, //optional for HTTP
    "status":true //check status - is target up or down
}

Check types

HTTP

Check HTTP(-s) targets., (*9)

optional params: * should_contain - Check response body for that string, check passed if string was found * should_not_contain - Check response body for that string, check failed if string was found, (*10)

Example:, (*11)

curl -X POST -d "type=HTTP&address=https://example.com&timeout=5&optional[should_contain]=healthy&optional[should_not_contain]=error" localhost:8080

The Versions

11/04 2018

dev-master

9999999-dev

Simple microservice / function to check target health

  Sources   Download

The Requires

  • php ^7.1
  • ext-curl *
  • ext-json *

 

11/04 2018

1.1.1

1.1.1.0

Simple microservice / function to check target health

  Sources   Download

The Requires

  • php ^7.1
  • ext-curl *
  • ext-json *

 

28/12 2017

1.1.0

1.1.0.0

Simple microservice / function to check target health

  Sources   Download

The Requires

  • php ^7.1
  • ext-curl *
  • ext-json *

 

28/12 2017

1.0.0

1.0.0.0

Simple microservice / function to check target health

  Sources   Download

The Requires

  • php ^7.1
  • ext-curl *
  • ext-json *