Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit ebf3438

Browse files
committed
Update README with InfluxDB instructions
1 parent f2a9a44 commit ebf3438

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,46 @@ You can then view the metrics by visting `http://localhost:3000` in your browser
2121
- username: `admin`
2222
- password: `admin`.
2323

24-
### Export data to pre-existing Graphite
24+
### Export data to pre-existing Graphite or InfluxDB
2525

26-
The `json2graphite.rb` script can be used to transform data in the JSON files into a format that can be fed into any Graphite instance.
26+
The `json2graphite.rb` script can be used to transform data in the JSON files into a format that can be fed into any Graphite or InfluxDB instance.
2727

2828
Usage:
2929

3030
```
3131
./json2graphite.rb [--pattern PATTERN] [filename_1 ... filename_n]
3232
```
3333

34-
Output will be lines in Graphite's plain text input format. This output can be fed through a tool like `nc` to inject it into Graphite.
34+
Output will be lines in Graphite's plain text input format. The output can be sent to a host running graphite by passing a hostname to the `--netcat` flag.
3535

3636
Examples:
3737

3838
```
39-
./json2graphite.rb ~/Downloads/logdump/puppetserver/*.json | nc localhost 2003
39+
./json2graphite.rb ~/Downloads/logdump/puppetserver/*.json --netcat localhost
40+
```
41+
42+
The `--netcat` flag will send output to port 2003. A custom port can be used by piping stdout to `nc` instead:
43+
44+
```
45+
./json2graphite.rb ~/Downloads/logdump/puppetserver/*.json | nc localhost 4242
4046
```
4147

4248
The simple example can be used for small numbers of files. When more files exist than can be referenced as arguments, use `--pattern`.
4349

4450
```
45-
./json2graphite.rb --pattern '~/Downloads/logdump/puppetserver/*.json' | nc localhost 2003
51+
./json2graphite.rb --pattern '~/Downloads/logdump/puppetserver/*.json' --netcat localhost
4652
```
4753

4854
The `--pattern` flag accepts a Ruby glob argument, which Ruby will then expand into a list of files to process.
55+
56+
InfluxDB output can be produced using the `--convert-to` flag:
57+
58+
```
59+
./json2graphite.rb ~/Downloads/logdump/puppetserver/*.json --convert-to influxdb
60+
```
61+
62+
When `--netcat` is used with InfluxDB output, data will be sent to port 8086. The `--influx-db` flag must also be used to specify a database to write to:
63+
64+
```
65+
./json2graphite.rb ~/Downloads/logdump/puppetserver/*.json --convert-to influxdb --netcat localhost --influx-db pe-metrics
66+
```

0 commit comments

Comments
 (0)