8 Commits
0.2.3 ... 0.2.5

Author SHA1 Message Date
Patrick Stadler
636feccd7c update readme 2017-01-04 09:17:38 +01:00
Patrick Stadler
697b978d95 rename logentries.com reporter 2017-01-04 09:14:37 +01:00
Patrick Stadler
d8cd496543 Merge pull request #4 from seamusc/master
Logentries.com reporter
2017-01-04 09:14:08 +01:00
Seamus Cawley
215e50ecea Logentries.com reporter 2016-08-09 09:39:01 +01:00
Patrick Stadler
5c0962e12b remove unneeded variable 2016-02-23 09:39:15 +01:00
Patrick Stadler
85ee93aec3 fix update check 2015-12-02 10:20:16 +01:00
Patrick Stadler
3a9c155b7e fix potential word splitting problem 2015-12-02 10:16:06 +01:00
Patrick Stadler
81ca6e0e57 fix missing git error message 2015-12-02 10:11:10 +01:00
4 changed files with 36 additions and 17 deletions

View File

@@ -16,7 +16,7 @@ metrics.sh is a lightweight metrics collection and forwarding daemon implemented
```
$ ./metrics.sh --help
Usage: ./metrics.sh [-d] [-h] [-v] [-c] [-m] [-r] [-i] [-C] [-u]
Options:
@@ -59,16 +59,17 @@ Metric | Description
## Reporters
Reporter | Description
--------------- | -------------
`stdout` | Write to standard out (default)
`file` | Write to a file or named pipe
`udp` | Send data to any service via UDP
`statsd` | Send data to [StatsD](https://github.com/etsy/statsd)
`influxdb` | Send data to [InfluxDB](http://influxdb.com/)
`prometheus` | Provide HTTP endpoint for [Prometheus](http://prometheus.io/)
`keen_io` | Send data to [Keen IO](https://keen.io)
`stathat` | Send data to [StatHat](https://www.stathat.com)
Reporter | Description
---------------- | -------------
`stdout` | Write to standard out (default)
`file` | Write to a file or named pipe
`udp` | Send data to any service via UDP
`statsd` | Send data to [StatsD](https://github.com/etsy/statsd)
`influxdb` | Send data to [InfluxDB](http://influxdb.com/)
`prometheus` | Provide HTTP endpoint for [Prometheus](http://prometheus.io/)
`keen_io` | Send data to [Keen IO](https://keen.io)
`stathat` | Send data to [StatHat](https://www.stathat.com)
`logentries_com` | Send data to [Logentries](https://logentries.com/)
## Configuration
@@ -189,7 +190,7 @@ collect () {
report $(du $DU_ARGS | awk '{ print $1 }')
# If report is called with two arguments, the first one will be appended
# to the metric name, for example `report "foo" $val` would be reported as
# "dir_size.foo: $val". This is helpful when a metric is collecting multiple
# "dir_size.foo: $val". This is helpful when a metric is collecting multiple
# values like `network_io`, which reports "network_io.in" / "network_io.out".
}
@@ -240,7 +241,7 @@ start () {
# Report metric. This function is called whenever there's a new value
# to report. It's important to know that metrics don't call this function
# directly, as there's some more work to be done before. You can safely assume
# directly, as there's some more work to be done before. You can safely assume
# that arguments passed to this function are sanitized and valid.
report () {
local metric=$1 # the name of the metric, e.g. "cpu", "cpu_alias", "cpu.foo"

View File

@@ -94,7 +94,7 @@ done
if [ $opt_do_update = true ]; then
if ! command_exists git; then
echo "Error: --update requires `git` to be in the PATH"
echo "Error: --update requires 'git' to be in the PATH"
exit 1
fi
echo "Fetching latest version..."
@@ -125,7 +125,7 @@ fi
if [ -n "$opt_config_file" ]; then
verbose "Loading configuration file: $opt_config_file"
parse_config $opt_config_file
parse_config "$opt_config_file"
if [ $? -ne 0 ]; then
exit 1
fi
@@ -162,4 +162,4 @@ verbose "Using reporter: $__REPORTER"
echo "metrics.sh started with PID: $$"
verbose "Collecting metrics every $INTERVAL second(s)"
main_collect
main_collect

View File

@@ -20,7 +20,6 @@ start () {
report () {
local metric=$1
local value=$2
local points
local data="$metric,$__influxdb_hostname value=$value"
curl -s -X POST $INFLUXDB_API_ENDPOINT --data-binary "$data"
}

View File

@@ -0,0 +1,19 @@
#!/bin/sh
start () {
if [ -z $LOGENTRIES_TOKEN ]; then
echo "Error: logentries.com requires \$LOGENTRIES_TOKEN to be specified"
return 1
fi
}
report () {
local metric=$1 # the name of the metric, e.g. "cpu", "cpu_alias", "cpu.foo"
local value=$2 # int or float
echo "$LOGENTRIES_TOKEN $metric=$value" | nc data.logentries.com 10000
}
docs () {
echo "Send data to Logentries.com using token TCP (https://docs.logentries.com/docs/input-token)"
echo "LOGENTRIES_TOKEN=$LOGENTRIES_TOKEN"
}