Tivan is dead, long live Telegraf. Fixes #3
This commit is contained in:
parent
08ce092713
commit
1653330421
10
PLUGINS.md
10
PLUGINS.md
|
@ -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
|
pick and chose what is gathered as well as makes it easy for developers
|
||||||
to create new ways of generating metrics.
|
to create new ways of generating metrics.
|
||||||
|
|
||||||
|
@ -8,14 +8,14 @@ and submit new plugins.
|
||||||
## Guidelines
|
## Guidelines
|
||||||
|
|
||||||
* A plugin must conform to the `plugins.Plugin` interface.
|
* 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.
|
developers don't have to worry about thread safety within these functions.
|
||||||
* Each generated metric automatically has the name of the plugin that generated
|
* Each generated metric automatically has the name of the plugin that generated
|
||||||
it prepended. This is to keep plugins honest.
|
it prepended. This is to keep plugins honest.
|
||||||
* Plugins should call `plugins.Add` in their `init` function to register themselves.
|
* Plugins should call `plugins.Add` in their `init` function to register themselves.
|
||||||
See below for a quick example.
|
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.
|
* 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 `tivan -sample-config`.
|
* 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.
|
* The `Description` function should say in one line what this plugin does.
|
||||||
|
|
||||||
### Plugin interface
|
### Plugin interface
|
||||||
|
@ -75,7 +75,7 @@ func Gather(acc plugins.Accumulator) error {
|
||||||
|
|
||||||
// simple.go
|
// simple.go
|
||||||
|
|
||||||
import "github.com/influxdb/tivan/plugins"
|
import "github.com/influxdb/telegraf/plugins"
|
||||||
|
|
||||||
type Simple struct {
|
type Simple struct {
|
||||||
Ok bool
|
Ok bool
|
||||||
|
|
18
README.md
18
README.md
|
@ -1,20 +1,20 @@
|
||||||
# Tivan - A native agent for InfluxDB
|
# Telegraf - A native agent for InfluxDB
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
* Build from source or download tivan (binaries forthcoming)
|
* Build from source or download telegraf (binaries forthcoming)
|
||||||
* Run `tivan -sample-config > tivan.toml` to create an initial configuration
|
* Run `telegraf -sample-config > telegraf.toml` to create an initial configuration
|
||||||
* Edit the configuration to match your needs
|
* Edit the configuration to match your needs
|
||||||
* Run `tivan -config tivan.toml -test` to output one full measurement sample to STDOUT
|
* Run `telegraf -config telegraf.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` 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.
|
* **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
|
## Plugin Options
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package tivan
|
package telegraf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
4
agent.go
4
agent.go
|
@ -1,4 +1,4 @@
|
||||||
package tivan
|
package telegraf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -10,7 +10,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/influxdb/influxdb/client"
|
"github.com/influxdb/influxdb/client"
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
type runningPlugin struct {
|
type runningPlugin struct {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package tivan
|
package telegraf
|
||||||
|
|
||||||
/*
|
/*
|
||||||
func TestAgent_DrivesMetrics(t *testing.T) {
|
func TestAgent_DrivesMetrics(t *testing.T) {
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/influxdb/tivan"
|
"github.com/influxdb/telegraf"
|
||||||
_ "github.com/influxdb/tivan/plugins/all"
|
_ "github.com/influxdb/telegraf/plugins/all"
|
||||||
)
|
)
|
||||||
|
|
||||||
var fDebug = flag.Bool("debug", false, "show metrics as they're generated to stdout")
|
var fDebug = flag.Bool("debug", false, "show metrics as they're generated to stdout")
|
||||||
|
@ -24,30 +24,30 @@ func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *fVersion {
|
if *fVersion {
|
||||||
fmt.Printf("InfluxDB Tivan agent - Version %s\n", Version)
|
fmt.Printf("InfluxDB Telegraf agent - Version %s\n", Version)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if *fSampleConfig {
|
if *fSampleConfig {
|
||||||
tivan.PrintSampleConfig()
|
telegraf.PrintSampleConfig()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
config *tivan.Config
|
config *telegraf.Config
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
if *fConfig != "" {
|
if *fConfig != "" {
|
||||||
config, err = tivan.LoadConfig(*fConfig)
|
config, err = telegraf.LoadConfig(*fConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
config = tivan.DefaultConfig()
|
config = telegraf.DefaultConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
ag, err := tivan.NewAgent(config)
|
ag, err := telegraf.NewAgent(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
20
config.go
20
config.go
|
@ -1,4 +1,4 @@
|
||||||
package tivan
|
package telegraf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -8,7 +8,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
"github.com/naoina/toml"
|
"github.com/naoina/toml"
|
||||||
"github.com/naoina/toml/ast"
|
"github.com/naoina/toml/ast"
|
||||||
)
|
)
|
||||||
|
@ -211,12 +211,12 @@ type hasDescr interface {
|
||||||
Description() string
|
Description() string
|
||||||
}
|
}
|
||||||
|
|
||||||
var header = `# Tivan configuration
|
var header = `# Telegraf configuration
|
||||||
|
|
||||||
# If this file is missing an [agent] section, you must first generate a
|
# 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.
|
# declared plugins.
|
||||||
|
|
||||||
# Even if a plugin has no configuration, it must be declared in here
|
# Even if a plugin has no configuration, it must be declared in here
|
||||||
|
@ -224,7 +224,7 @@ var header = `# Tivan configuration
|
||||||
# as a section with no variables. To deactivate a plugin, comment
|
# as a section with no variables. To deactivate a plugin, comment
|
||||||
# out the name and any variables.
|
# 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.
|
# file would generate.
|
||||||
|
|
||||||
# One rule that plugins conform to is wherever a connection string
|
# One rule that plugins conform to is wherever a connection string
|
||||||
|
@ -241,13 +241,13 @@ var header = `# Tivan configuration
|
||||||
url = "http://10.20.2.4:8086" # required.
|
url = "http://10.20.2.4:8086" # required.
|
||||||
|
|
||||||
# The target database for metrics. This database must already exist
|
# The target database for metrics. This database must already exist
|
||||||
database = "tivan" # required.
|
database = "telegraf" # required.
|
||||||
|
|
||||||
# username = "tivan"
|
# username = "telegraf"
|
||||||
# password = "metricsmetricsmetricsmetrics"
|
# password = "metricsmetricsmetricsmetrics"
|
||||||
|
|
||||||
# Set the user agent for the POSTs (can be useful for log differentiation)
|
# 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 = { "dc": "us-east-1" }
|
||||||
|
|
||||||
# Tags can also be specified via a normal map, but only one form at a time:
|
# Tags can also be specified via a normal map, but only one form at a time:
|
||||||
|
@ -255,7 +255,7 @@ database = "tivan" # required.
|
||||||
# [influxdb.tags]
|
# [influxdb.tags]
|
||||||
# dc = "us-east-1"
|
# dc = "us-east-1"
|
||||||
|
|
||||||
# Configuration for tivan itself
|
# Configuration for telegraf itself
|
||||||
# [agent]
|
# [agent]
|
||||||
# interval = "10s"
|
# interval = "10s"
|
||||||
# debug = false
|
# debug = false
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package all
|
package all
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "github.com/influxdb/tivan/plugins/mysql"
|
_ "github.com/influxdb/telegraf/plugins/mysql"
|
||||||
_ "github.com/influxdb/tivan/plugins/postgresql"
|
_ "github.com/influxdb/telegraf/plugins/postgresql"
|
||||||
_ "github.com/influxdb/tivan/plugins/redis"
|
_ "github.com/influxdb/telegraf/plugins/redis"
|
||||||
_ "github.com/influxdb/tivan/plugins/system"
|
_ "github.com/influxdb/telegraf/plugins/system"
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Mysql struct {
|
type Mysql struct {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/testutil"
|
"github.com/influxdb/telegraf/testutil"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package postgresql
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
|
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/lib/pq"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package postgresql
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/testutil"
|
"github.com/influxdb/telegraf/testutil"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Redis struct {
|
type Redis struct {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/testutil"
|
"github.com/influxdb/telegraf/testutil"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,7 +3,7 @@ package system
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CPUStats struct {
|
type CPUStats struct {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package system
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DiskStats struct {
|
type DiskStats struct {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package system
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DockerStats struct {
|
type DockerStats struct {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package system
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MemStats struct {
|
type MemStats struct {
|
||||||
|
|
|
@ -2,12 +2,12 @@ package system
|
||||||
|
|
||||||
import "github.com/stretchr/testify/mock"
|
import "github.com/stretchr/testify/mock"
|
||||||
|
|
||||||
import "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
import "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||||
import "github.com/influxdb/tivan/plugins/system/ps/disk"
|
import "github.com/influxdb/telegraf/plugins/system/ps/disk"
|
||||||
|
|
||||||
import "github.com/influxdb/tivan/plugins/system/ps/load"
|
import "github.com/influxdb/telegraf/plugins/system/ps/load"
|
||||||
import "github.com/influxdb/tivan/plugins/system/ps/mem"
|
import "github.com/influxdb/telegraf/plugins/system/ps/mem"
|
||||||
import "github.com/influxdb/tivan/plugins/system/ps/net"
|
import "github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||||
|
|
||||||
type MockPS struct {
|
type MockPS struct {
|
||||||
mock.Mock
|
mock.Mock
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NetIOStats struct {
|
type NetIOStats struct {
|
||||||
|
@ -18,7 +18,7 @@ func (_ *NetIOStats) Description() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
var netSampleConfig = `
|
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,
|
# Setting interfaces will tell it to gather these explicit interfaces,
|
||||||
# regardless of status.
|
# regardless of status.
|
||||||
#
|
#
|
||||||
|
|
|
@ -5,14 +5,14 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
dc "github.com/fsouza/go-dockerclient"
|
dc "github.com/fsouza/go-dockerclient"
|
||||||
"github.com/influxdb/tivan/plugins"
|
"github.com/influxdb/telegraf/plugins"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/cpu"
|
"github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/disk"
|
"github.com/influxdb/telegraf/plugins/system/ps/disk"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/docker"
|
"github.com/influxdb/telegraf/plugins/system/ps/docker"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/load"
|
"github.com/influxdb/telegraf/plugins/system/ps/load"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/mem"
|
"github.com/influxdb/telegraf/plugins/system/ps/mem"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/net"
|
"github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DockerContainerStat struct {
|
type DockerContainerStat struct {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sys/resource.h
|
// sys/resource.h
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// sys/resource.h
|
// sys/resource.h
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"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) {
|
func CPUTimes(percpu bool) ([]CPUTimesStat, error) {
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: Get percpu
|
// TODO: Get percpu
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func DiskPartitions(all bool) ([]DiskPartitionStat, error) {
|
func DiskPartitions(all bool) ([]DiskPartitionStat, error) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestDisk_usage(t *testing.T) {
|
func TestDisk_usage(t *testing.T) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -9,8 +9,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/cpu"
|
"github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetDockerIDList returnes a list of DockerID.
|
// GetDockerIDList returnes a list of DockerID.
|
||||||
|
|
|
@ -5,8 +5,8 @@ package docker
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/cpu"
|
"github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetDockerIDList returnes a list of DockerID.
|
// GetDockerIDList returnes a list of DockerID.
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func HostInfo() (*HostInfoStat, error) {
|
func HostInfo() (*HostInfoStat, error) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LSB struct {
|
type LSB struct {
|
||||||
|
|
|
@ -8,8 +8,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
process "github.com/influxdb/tivan/plugins/system/ps/process"
|
process "github.com/influxdb/telegraf/plugins/system/ps/process"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -5,7 +5,7 @@ package load
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func LoadAvg() (*LoadAvgStat, error) {
|
func LoadAvg() (*LoadAvgStat, error) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ package load
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func LoadAvg() (*LoadAvgStat, error) {
|
func LoadAvg() (*LoadAvgStat, error) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
package load
|
package load
|
||||||
|
|
||||||
import (
|
import (
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func LoadAvg() (*LoadAvgStat, error) {
|
func LoadAvg() (*LoadAvgStat, error) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func getPageSize() (uint64, error) {
|
func getPageSize() (uint64, error) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func VirtualMemory() (*VirtualMemoryStat, error) {
|
func VirtualMemory() (*VirtualMemoryStat, error) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func VirtualMemory() (*VirtualMemoryStat, error) {
|
func VirtualMemory() (*VirtualMemoryStat, error) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
|
func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
|
func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NetIOCounters returnes network I/O statistics for every network
|
// NetIOCounters returnes network I/O statistics for every network
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
cpu "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
cpu "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Process struct {
|
type Process struct {
|
||||||
|
|
|
@ -10,9 +10,9 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
cpu "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
cpu "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||||
net "github.com/influxdb/tivan/plugins/system/ps/net"
|
net "github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// copied from sys/sysctl.h
|
// copied from sys/sysctl.h
|
||||||
|
|
|
@ -7,9 +7,9 @@ import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
cpu "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
cpu "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||||
net "github.com/influxdb/tivan/plugins/system/ps/net"
|
net "github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MemoryInfoExStat is different between OSes
|
// MemoryInfoExStat is different between OSes
|
||||||
|
|
|
@ -11,10 +11,10 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
cpu "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
cpu "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||||
host "github.com/influxdb/tivan/plugins/system/ps/host"
|
host "github.com/influxdb/telegraf/plugins/system/ps/host"
|
||||||
net "github.com/influxdb/tivan/plugins/system/ps/net"
|
net "github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
func testGetProcess() Process {
|
func testGetProcess() Process {
|
||||||
|
|
|
@ -11,9 +11,9 @@ import (
|
||||||
|
|
||||||
"github.com/shirou/w32"
|
"github.com/shirou/w32"
|
||||||
|
|
||||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||||
cpu "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
cpu "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||||
net "github.com/influxdb/tivan/plugins/system/ps/net"
|
net "github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package system
|
package system
|
||||||
|
|
||||||
import "github.com/influxdb/tivan/plugins"
|
import "github.com/influxdb/telegraf/plugins"
|
||||||
|
|
||||||
type SystemStats struct {
|
type SystemStats struct {
|
||||||
ps PS
|
ps PS
|
||||||
|
|
|
@ -3,13 +3,13 @@ package system
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/cpu"
|
"github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/disk"
|
"github.com/influxdb/telegraf/plugins/system/ps/disk"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/docker"
|
"github.com/influxdb/telegraf/plugins/system/ps/docker"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/load"
|
"github.com/influxdb/telegraf/plugins/system/ps/load"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/mem"
|
"github.com/influxdb/telegraf/plugins/system/ps/mem"
|
||||||
"github.com/influxdb/tivan/plugins/system/ps/net"
|
"github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||||
"github.com/influxdb/tivan/testutil"
|
"github.com/influxdb/telegraf/testutil"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
VERSION="0.9.b1"
|
VERSION="0.9.b1"
|
||||||
|
|
||||||
echo "Building Tivan version $VERSION"
|
echo "Building Telegraf version $VERSION"
|
||||||
|
|
||||||
mkdir -p pkg
|
mkdir -p pkg
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
echo -n "=> $1-$2: "
|
echo -n "=> $1-$2: "
|
||||||
GOOS=$1 GOARCH=$2 go build -o pkg/tivan-$1-$2 -ldflags "-X main.Version $VERSION" ./cmd/tivan/tivan.go
|
GOOS=$1 GOARCH=$2 go build -o pkg/telegraf-$1-$2 -ldflags "-X main.Version $VERSION" ./cmd/telegraf/telegraf.go
|
||||||
du -h pkg/tivan-$1-$2
|
du -h pkg/telegraf-$1-$2
|
||||||
}
|
}
|
||||||
|
|
||||||
build "darwin" "amd64"
|
build "darwin" "amd64"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Tivan configuration
|
# Telegraf configuration
|
||||||
|
|
||||||
# If this file is missing an [agent] section, you must first generate a
|
# 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.
|
# declared plugins.
|
||||||
|
|
||||||
# Even if a plugin has no configuration, it must be declared in here
|
# Even if a plugin has no configuration, it must be declared in here
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
# as a section with no variables. To deactivate a plugin, comment
|
# as a section with no variables. To deactivate a plugin, comment
|
||||||
# out the name and any variables.
|
# 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.
|
# file would generate.
|
||||||
|
|
||||||
# One rule that plugins conform to is wherever a connection string
|
# One rule that plugins conform to is wherever a connection string
|
||||||
|
@ -28,13 +28,13 @@
|
||||||
url = "http://10.20.2.4:8086" # required.
|
url = "http://10.20.2.4:8086" # required.
|
||||||
|
|
||||||
# The target database for metrics. This database must already exist
|
# The target database for metrics. This database must already exist
|
||||||
database = "tivan" # required.
|
database = "telegraf" # required.
|
||||||
|
|
||||||
# username = "tivan"
|
# username = "telegraf"
|
||||||
# password = "metricsmetricsmetricsmetrics"
|
# password = "metricsmetricsmetricsmetrics"
|
||||||
|
|
||||||
# Set the user agent for the POSTs (can be useful for log differentiation)
|
# 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 = { "dc": "us-east-1" }
|
||||||
|
|
||||||
# Tags can also be specified via a normal map, but only one form at a time:
|
# Tags can also be specified via a normal map, but only one form at a time:
|
||||||
|
@ -42,7 +42,7 @@ database = "tivan" # required.
|
||||||
# [influxdb.tags]
|
# [influxdb.tags]
|
||||||
# dc = "us-east-1"
|
# dc = "us-east-1"
|
||||||
|
|
||||||
# Configuration for tivan itself
|
# Configuration for telegraf itself
|
||||||
# [agent]
|
# [agent]
|
||||||
# interval = "10s"
|
# interval = "10s"
|
||||||
# debug = false
|
# debug = false
|
||||||
|
@ -83,7 +83,7 @@ servers = ["localhost"]
|
||||||
# Read metrics about network interface usage
|
# Read metrics about network interface usage
|
||||||
[net]
|
[net]
|
||||||
|
|
||||||
# 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,
|
# Setting interfaces will tell it to gather these explicit interfaces,
|
||||||
# regardless of status.
|
# regardless of status.
|
||||||
#
|
#
|
|
@ -7,7 +7,7 @@ debug = true
|
||||||
url = "http://localhost:8086"
|
url = "http://localhost:8086"
|
||||||
username = "root"
|
username = "root"
|
||||||
password = "root"
|
password = "root"
|
||||||
database = "tivan"
|
database = "telegraf"
|
||||||
tags = { dc = "us-phx-1" }
|
tags = { dc = "us-phx-1" }
|
||||||
|
|
||||||
[redis]
|
[redis]
|
||||||
|
|
Loading…
Reference in New Issue