goProbe is a probe service written in Go programming language. It has three parts to it, a core, probe modules and a metric exposition component.
It currently supports probe metric exposition in json (default) as well as prometheus compatible format.
Probes are modules and goProbe can potentially be confgured with arbitrary number of modules. Currently it has a built in http probe module and a ping_port module. The latter helps probe a host:port using tcp/udp.
goProbe takes a json file as a config input which typically supplies the probe name (each should be unique), run intervals, timeouts etc. Each module can have its own json config fields. Below is an example config snippet of the built-in http, ping_port probe modules. It configures two http probes and 1 ping_port probe.
[
{
"probe_type": "http",
"probe_config": {
"probe_name": "example_explicit_settings",
"probe_url": "http://example.com",
"probe_timeout": 20,
"probe_interval": 30
}
},
{
"probe_type": "http",
"probe_config": {
"probe_name": "example_default_settings",
"probe_url": "http://example.com"
}
},
{
"probe_type": "ping_port",
"probe_config": {
"probe_name": "example_ping_port_80",
"probe_host_name": "example.com",
"probe_host_port": 80
}
}
]
Precompiled binaries are available from the releases link.
To build from source follow the steps below:
Install mercuruial. On ubuntu,
$ sudo apt-get install mercurial
$ go get -u github.com/samitpal/goProbe
$ cd $GOPATH/src/github.com/samitpal/goProbe
$ go install
First set the environmental variable which points to the html templates, e.g
$ export GOPROBE_TMPL="templates/*"
$ $GOPATH/bin/goProbe -config <path to config file>
By default goProbe displays the probe metrics via the /metrics http handler in json format. It also displays the current configs via its /config http handler. The /status handler is yet to be implemented.
To expose the metrics in prometheus format, run it as follows,
$ $GOPATH/bin/goProbe -config <path to config file> -exposition_type prometheus
- probe_name: The name of the probe. This should be unique globally.
- probe_url: The complete url.
-
probe_http_method : The http method. Default value is http GET.
-
probe_action : This configures the mechanism used to determine the success/failure of a probe. Currently it can be one of the following strings
- check_ret_200 : It checks if the response status code is 200. This is the default.
- check_match_string : If this is set then probe_match_string needs to be set as well. Essentially the module will match the http body with the probe_match_string string.
- check_sslcert_expiry : It checks if the ssl cert is expiring within probe_sslcert_expire_in_days days.
-
probe_match_string : This needs to be set to a regexp if probe_action is set to "check_match_string".
-
probe_sslcert_expire_in_days: Goes with "check_sslcert_expiry" action. Default value is 30 days.
-
probe_interval : The frequency (in seconds) with which to run the probe. Default value is 60.
-
probe_timeout : Time out in seconds for a given probe. Default value is 40. This value needs to be less than the probe_interval.
-
probe_http_headers: This config object is used to set http request headers. Following is an example usage.
"probe_http_headers": { "host": "test", "user_agent": "test-agent" }
- probe_name: The name of the probe. This should be unique globally.
- probe_host_name: The target host.
- probe_host_port: The port of the target host.
- probe_network: The network protocol to use. It can be either tcp (default) or udp.
There is a sample module called sample_probe.go which can give you a start. Essentially all you need to do is implement the Prober interface defined in prober.go. In addition to the module source it also needs a minor change in config.go to register the new module type.