probes

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package probes provides an interface to initialize probes using prober config.

Index

Constants

This section is empty.

Variables

View Source
var StatusTmpl = template.Must(template.New("statusTmpl").Parse(`
<table class="status-list">
  <tr>
    <th>Name</th>
    <th>Type</th>
    <th>Interval</th>
    <th>Timeout</th>
    <th width="20%%">Targets</th>
    <th width="30%%">Probe Conf</th>
    <th>Latency Unit</th>
    <th>Latency Distribution Lower Bounds (if configured) </th>
  </tr>
  {{ range . }}
  <tr>
    <td>{{.Name}}</td>
    <td>{{.Type}}</td>
    <td>{{.Interval}}</td>
    <td>{{.Timeout}}</td>
    <td><pre>{{.TargetsDesc}}</pre></td>

    <td>
    {{if .ProbeConf}}
      <pre>{{.ProbeConf}}</pre>
    {{else}}
      default
    {{end}}
    </td>

    <td>{{.LatencyUnit}}</td>
    <td><pre>{{.LatencyDistLB}}</pre></td>
  </tr>
  {{ end }}
</table>
`))

StatusTmpl variable stores the HTML template suitable to generate the probes' status for cloudprober's /status page. It expects an array of ProbeInfo objects as input.

Functions

func Init

func Init(probeProtobufs []*configpb.ProbeDef, globalTargetsOpts *targetspb.GlobalTargetsOptions, l *logger.Logger, sysVars map[string]string) (map[string]*ProbeInfo, error)

Init initializes the probes defined in the config.

func RegisterProbeType

func RegisterProbeType(extensionFieldNo int, newProbeFunc func() Probe)

RegisterProbeType registers a new probe-type. New probe types are integrated with the config subsystem using the protobuf extensions.

TODO(manugarg): Add a full example of using extensions.

func RegisterUserDefined

func RegisterUserDefined(name string, probe Probe)

RegisterUserDefined allows you to register a user defined probe with cloudprober. Example usage:

import (
	"github.com/google/cloudprober"
	"github.com/google/cloudprober/probes"
)

p := &FancyProbe{}
probes.RegisterUserDefined("fancy_probe", p)
pr, err := cloudprober.InitFromConfig(*configFile)
if err != nil {
	log.Exitf("Error initializing cloudprober. Err: %v", err)
}

Types

type Probe

type Probe interface {
	Init(name string, opts *options.Options) error
	Start(ctx context.Context, dataChan chan *metrics.EventMetrics)
}

Probe interface represents a probe.

A probe is initilized using the Init() method. Init takes the name of the probe and probe options.

Start() method starts the probe. Start is not expected to return for the lifetime of the prober. It takes a data channel that it writes the probe results on. Actual publishing of these results is handled by cloudprober itself.

type ProbeInfo

type ProbeInfo struct {
	Probe
	Name          string
	Type          string
	Interval      string
	Timeout       string
	TargetsDesc   string
	LatencyDistLB string
	LatencyUnit   string
	ProbeConf     string
}

ProbeInfo encapsulates the probe and associated information.

Directories

Path Synopsis
dns
Package dns implements a DNS prober.
Package dns implements a DNS prober.
cmd
Dns_bin implements a stand-alone dns prober binary using the cloudprober/probes/dns package.
Dns_bin implements a stand-alone dns prober binary using the cloudprober/probes/dns package.
Package external implements an external probe type for cloudprober.
Package external implements an external probe type for cloudprober.
cmd
This program implements a stand-alone external prober binary using the cloudprober/probes/external package.
This program implements a stand-alone external prober binary using the cloudprober/probes/external package.
serverutils
Package serverutils provides utilities to work with the cloudprober's external probe.
Package serverutils provides utilities to work with the cloudprober's external probe.
Package http implements HTTP probe type.
Package http implements HTTP probe type.
cmd
This program implements a stand-alone http prober binary using the cloudprober/http package.
This program implements a stand-alone http prober binary using the cloudprober/http package.
Package options provides a shared interface to common probe options.
Package options provides a shared interface to common probe options.
Package ping implements a fast ping prober.
Package ping implements a fast ping prober.
cmd
This program implements a stand-alone ping prober binary using the cloudprober/ping package.
This program implements a stand-alone ping prober binary using the cloudprober/ping package.
udp
Package udp implements a UDP prober.
Package udp implements a UDP prober.
cmd
Udp_bin implements a stand-alone udp prober binary using the cloudprober/probes/udp package.
Udp_bin implements a stand-alone udp prober binary using the cloudprober/probes/udp package.
Package udplistener implements a UDP listener.
Package udplistener implements a UDP listener.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL