Skip to content

Commit

Permalink
Tivan is dead, long live Telegraf. Fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
evanphx committed May 22, 2015
1 parent 08ce092 commit 1653330
Show file tree
Hide file tree
Showing 58 changed files with 130 additions and 130 deletions.
10 changes: 5 additions & 5 deletions PLUGINS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Tivan is entirely plugin driven. This interface allows for operators to
Telegraf is entirely plugin driven. This interface allows for operators to
pick and chose what is gathered as well as makes it easy for developers
to create new ways of generating metrics.

Expand All @@ -8,14 +8,14 @@ and submit new plugins.
## Guidelines

* A plugin must conform to the `plugins.Plugin` interface.
* Tivan promises to run each plugin's Gather function serially. This means
* Telegraf promises to run each plugin's Gather function serially. This means
developers don't have to worry about thread safety within these functions.
* Each generated metric automatically has the name of the plugin that generated
it prepended. This is to keep plugins honest.
* Plugins should call `plugins.Add` in their `init` function to register themselves.
See below for a quick example.
* To be available within Tivan itself, plugins must add themselves to the `github.com/influxdb/tivan/plugins/all/all.go` file.
* The `SampleConfig` function should return valid toml that describes how the plugin can be configured. This is include in `tivan -sample-config`.
* To be available within Telegraf itself, plugins must add themselves to the `github.com/influxdb/telegraf/plugins/all/all.go` file.
* The `SampleConfig` function should return valid toml that describes how the plugin can be configured. This is include in `telegraf -sample-config`.
* The `Description` function should say in one line what this plugin does.

### Plugin interface
Expand Down Expand Up @@ -75,7 +75,7 @@ func Gather(acc plugins.Accumulator) error {

// simple.go

import "github.com/influxdb/tivan/plugins"
import "github.com/influxdb/telegraf/plugins"

type Simple struct {
Ok bool
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Tivan - A native agent for InfluxDB
# Telegraf - A native agent for InfluxDB

## Quickstart

* Build from source or download tivan (binaries forthcoming)
* Run `tivan -sample-config > tivan.toml` to create an initial configuration
* Build from source or download telegraf (binaries forthcoming)
* Run `telegraf -sample-config > telegraf.toml` to create an initial configuration
* Edit the configuration to match your needs
* Run `tivan -config tivan.toml -test` to output one full measurement sample to STDOUT
* Run `tivan -config tivan.toml` to gather and send metrics to InfluxDB
* Run `telegraf -config telegraf.toml -test` to output one full measurement sample to STDOUT
* Run `telegraf -config telegraf.toml` to gather and send metrics to InfluxDB

## Tivan Options
## Telegraf Options

Tivan has a few options you can configure under the `agent` section of the config. If you don't see an `agent` section run `tivan -sample-config > tivan.toml` to create a valid initial configuration:
Telegraf has a few options you can configure under the `agent` section of the config. If you don't see an `agent` section run `telegraf -sample-config > telegraf.toml` to create a valid initial configuration:

* **hostname**: The hostname is passed as a tag. By default this should be set to the name of the machine running Tivan. You can override that behavior here.
* **hostname**: The hostname is passed as a tag. By default this should be set to the name of the machine running Telegraf. You can override that behavior here.
* **interval**: How ofter to gather metrics. Uses a simple number + unit parser, ie "10s" for 10 seconds or "5m" for 5 minutes.
* **debug**: currently non-functional. Run `tivan -config tivan.toml -debug` to gather and send metrics to InfluxDB and to STDOUT for debugging purposes
* **debug**: currently non-functional. Run `telegraf -config telegraf.toml -debug` to gather and send metrics to InfluxDB and to STDOUT for debugging purposes

## Plugin Options

Expand Down
2 changes: 1 addition & 1 deletion accumulator.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tivan
package telegraf

import (
"fmt"
Expand Down
4 changes: 2 additions & 2 deletions agent.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tivan
package telegraf

import (
"fmt"
Expand All @@ -10,7 +10,7 @@ import (
"time"

"github.com/influxdb/influxdb/client"
"github.com/influxdb/tivan/plugins"
"github.com/influxdb/telegraf/plugins"
)

type runningPlugin struct {
Expand Down
2 changes: 1 addition & 1 deletion agent_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tivan
package telegraf

/*
func TestAgent_DrivesMetrics(t *testing.T) {
Expand Down
16 changes: 8 additions & 8 deletions cmd/tivan/tivan.go → cmd/telegraf/telegraf.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"os/signal"
"strings"

"github.com/influxdb/tivan"
_ "github.com/influxdb/tivan/plugins/all"
"github.com/influxdb/telegraf"
_ "github.com/influxdb/telegraf/plugins/all"
)

var fDebug = flag.Bool("debug", false, "show metrics as they're generated to stdout")
Expand All @@ -24,30 +24,30 @@ func main() {
flag.Parse()

if *fVersion {
fmt.Printf("InfluxDB Tivan agent - Version %s\n", Version)
fmt.Printf("InfluxDB Telegraf agent - Version %s\n", Version)
return
}

if *fSampleConfig {
tivan.PrintSampleConfig()
telegraf.PrintSampleConfig()
return
}

var (
config *tivan.Config
config *telegraf.Config
err error
)

if *fConfig != "" {
config, err = tivan.LoadConfig(*fConfig)
config, err = telegraf.LoadConfig(*fConfig)
if err != nil {
log.Fatal(err)
}
} else {
config = tivan.DefaultConfig()
config = telegraf.DefaultConfig()
}

ag, err := tivan.NewAgent(config)
ag, err := telegraf.NewAgent(config)
if err != nil {
log.Fatal(err)
}
Expand Down
20 changes: 10 additions & 10 deletions config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package tivan
package telegraf

import (
"errors"
Expand All @@ -8,7 +8,7 @@ import (
"strings"
"time"

"github.com/influxdb/tivan/plugins"
"github.com/influxdb/telegraf/plugins"
"github.com/naoina/toml"
"github.com/naoina/toml/ast"
)
Expand Down Expand Up @@ -211,20 +211,20 @@ type hasDescr interface {
Description() string
}

var header = `# Tivan configuration
var header = `# Telegraf configuration
# If this file is missing an [agent] section, you must first generate a
# valid config with 'tivan -sample-config > tivan.toml'
# valid config with 'telegraf -sample-config > telegraf.toml'
# Tivan is entirely plugin driven. All metrics are gathered from the
# Telegraf is entirely plugin driven. All metrics are gathered from the
# declared plugins.
# Even if a plugin has no configuration, it must be declared in here
# to be active. Declaring a plugin means just specifying the name
# as a section with no variables. To deactivate a plugin, comment
# out the name and any variables.
# Use 'tivan -config tivan.toml -test' to see what metrics a config
# Use 'telegraf -config telegraf.toml -test' to see what metrics a config
# file would generate.
# One rule that plugins conform to is wherever a connection string
Expand All @@ -241,21 +241,21 @@ var header = `# Tivan configuration
url = "http://10.20.2.4:8086" # required.
# The target database for metrics. This database must already exist
database = "tivan" # required.
database = "telegraf" # required.
# username = "tivan"
# username = "telegraf"
# password = "metricsmetricsmetricsmetrics"
# Set the user agent for the POSTs (can be useful for log differentiation)
# user_agent = "tivan"
# user_agent = "telegraf"
# tags = { "dc": "us-east-1" }
# Tags can also be specified via a normal map, but only one form at a time:
# [influxdb.tags]
# dc = "us-east-1"
# Configuration for tivan itself
# Configuration for telegraf itself
# [agent]
# interval = "10s"
# debug = false
Expand Down
8 changes: 4 additions & 4 deletions plugins/all/all.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package all

import (
_ "github.com/influxdb/tivan/plugins/mysql"
_ "github.com/influxdb/tivan/plugins/postgresql"
_ "github.com/influxdb/tivan/plugins/redis"
_ "github.com/influxdb/tivan/plugins/system"
_ "github.com/influxdb/telegraf/plugins/mysql"
_ "github.com/influxdb/telegraf/plugins/postgresql"
_ "github.com/influxdb/telegraf/plugins/redis"
_ "github.com/influxdb/telegraf/plugins/system"
)
2 changes: 1 addition & 1 deletion plugins/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"

_ "github.com/go-sql-driver/mysql"
"github.com/influxdb/tivan/plugins"
"github.com/influxdb/telegraf/plugins"
)

type Mysql struct {
Expand Down
2 changes: 1 addition & 1 deletion plugins/mysql/mysql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
"testing"

"github.com/influxdb/tivan/testutil"
"github.com/influxdb/telegraf/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package postgresql
import (
"database/sql"

"github.com/influxdb/tivan/plugins"
"github.com/influxdb/telegraf/plugins"

_ "github.com/lib/pq"
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/postgresql/postgresql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package postgresql
import (
"testing"

"github.com/influxdb/tivan/testutil"
"github.com/influxdb/telegraf/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/redis/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"sync"

"github.com/influxdb/tivan/plugins"
"github.com/influxdb/telegraf/plugins"
)

type Redis struct {
Expand Down
2 changes: 1 addition & 1 deletion plugins/redis/redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net"
"testing"

"github.com/influxdb/tivan/testutil"
"github.com/influxdb/telegraf/testutil"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package system
import (
"fmt"

"github.com/influxdb/tivan/plugins"
"github.com/influxdb/telegraf/plugins"
)

type CPUStats struct {
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package system
import (
"fmt"

"github.com/influxdb/tivan/plugins"
"github.com/influxdb/telegraf/plugins"
)

type DiskStats struct {
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package system
import (
"fmt"

"github.com/influxdb/tivan/plugins"
"github.com/influxdb/telegraf/plugins"
)

type DockerStats struct {
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package system
import (
"fmt"

"github.com/influxdb/tivan/plugins"
"github.com/influxdb/telegraf/plugins"
)

type MemStats struct {
Expand Down
10 changes: 5 additions & 5 deletions plugins/system/mock_PS.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package system

import "github.com/stretchr/testify/mock"

import "github.com/influxdb/tivan/plugins/system/ps/cpu"
import "github.com/influxdb/tivan/plugins/system/ps/disk"
import "github.com/influxdb/telegraf/plugins/system/ps/cpu"
import "github.com/influxdb/telegraf/plugins/system/ps/disk"

import "github.com/influxdb/tivan/plugins/system/ps/load"
import "github.com/influxdb/tivan/plugins/system/ps/mem"
import "github.com/influxdb/tivan/plugins/system/ps/net"
import "github.com/influxdb/telegraf/plugins/system/ps/load"
import "github.com/influxdb/telegraf/plugins/system/ps/mem"
import "github.com/influxdb/telegraf/plugins/system/ps/net"

type MockPS struct {
mock.Mock
Expand Down
4 changes: 2 additions & 2 deletions plugins/system/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"net"

"github.com/influxdb/tivan/plugins"
"github.com/influxdb/telegraf/plugins"
)

type NetIOStats struct {
Expand All @@ -18,7 +18,7 @@ func (_ *NetIOStats) Description() string {
}

var netSampleConfig = `
# By default, tivan gathers stats from any up interface (excluding loopback)
# By default, telegraf gathers stats from any up interface (excluding loopback)
# Setting interfaces will tell it to gather these explicit interfaces,
# regardless of status.
#
Expand Down
16 changes: 8 additions & 8 deletions plugins/system/ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"strings"

dc "github.com/fsouza/go-dockerclient"
"github.com/influxdb/tivan/plugins"
"github.com/influxdb/tivan/plugins/system/ps/common"
"github.com/influxdb/tivan/plugins/system/ps/cpu"
"github.com/influxdb/tivan/plugins/system/ps/disk"
"github.com/influxdb/tivan/plugins/system/ps/docker"
"github.com/influxdb/tivan/plugins/system/ps/load"
"github.com/influxdb/tivan/plugins/system/ps/mem"
"github.com/influxdb/tivan/plugins/system/ps/net"
"github.com/influxdb/telegraf/plugins"
"github.com/influxdb/telegraf/plugins/system/ps/common"
"github.com/influxdb/telegraf/plugins/system/ps/cpu"
"github.com/influxdb/telegraf/plugins/system/ps/disk"
"github.com/influxdb/telegraf/plugins/system/ps/docker"
"github.com/influxdb/telegraf/plugins/system/ps/load"
"github.com/influxdb/telegraf/plugins/system/ps/mem"
"github.com/influxdb/telegraf/plugins/system/ps/net"
)

type DockerContainerStat struct {
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/ps/cpu/cpu_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"strings"
"unsafe"

common "github.com/influxdb/tivan/plugins/system/ps/common"
common "github.com/influxdb/telegraf/plugins/system/ps/common"
)

// sys/resource.h
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/ps/cpu/cpu_freebsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"
"strings"

common "github.com/influxdb/tivan/plugins/system/ps/common"
common "github.com/influxdb/telegraf/plugins/system/ps/common"
)

// sys/resource.h
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/ps/cpu/cpu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strconv"
"strings"

common "github.com/influxdb/tivan/plugins/system/ps/common"
common "github.com/influxdb/telegraf/plugins/system/ps/common"
)

func CPUTimes(percpu bool) ([]CPUTimesStat, error) {
Expand Down
Loading

0 comments on commit 1653330

Please sign in to comment.