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
|
||||
to create new ways of generating metrics.
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
18
README.md
18
README.md
|
@ -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
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package tivan
|
||||
package telegraf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
|
4
agent.go
4
agent.go
|
@ -1,4 +1,4 @@
|
|||
package tivan
|
||||
package telegraf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -10,7 +10,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/influxdb/influxdb/client"
|
||||
"github.com/influxdb/tivan/plugins"
|
||||
"github.com/influxdb/telegraf/plugins"
|
||||
)
|
||||
|
||||
type runningPlugin struct {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package tivan
|
||||
package telegraf
|
||||
|
||||
/*
|
||||
func TestAgent_DrivesMetrics(t *testing.T) {
|
||||
|
|
|
@ -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")
|
||||
|
@ -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)
|
||||
}
|
20
config.go
20
config.go
|
@ -1,4 +1,4 @@
|
|||
package tivan
|
||||
package telegraf
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
@ -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"
|
||||
)
|
||||
|
@ -211,12 +211,12 @@ 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
|
||||
|
@ -224,7 +224,7 @@ var header = `# Tivan configuration
|
|||
# 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
|
||||
|
@ -241,13 +241,13 @@ 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:
|
||||
|
@ -255,7 +255,7 @@ database = "tivan" # required.
|
|||
# [influxdb.tags]
|
||||
# dc = "us-east-1"
|
||||
|
||||
# Configuration for tivan itself
|
||||
# Configuration for telegraf itself
|
||||
# [agent]
|
||||
# interval = "10s"
|
||||
# debug = false
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package postgresql
|
|||
import (
|
||||
"database/sql"
|
||||
|
||||
"github.com/influxdb/tivan/plugins"
|
||||
"github.com/influxdb/telegraf/plugins"
|
||||
|
||||
_ "github.com/lib/pq"
|
||||
)
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/influxdb/tivan/plugins"
|
||||
"github.com/influxdb/telegraf/plugins"
|
||||
)
|
||||
|
||||
type Redis struct {
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
|
|
@ -3,7 +3,7 @@ package system
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdb/tivan/plugins"
|
||||
"github.com/influxdb/telegraf/plugins"
|
||||
)
|
||||
|
||||
type CPUStats struct {
|
||||
|
|
|
@ -3,7 +3,7 @@ package system
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdb/tivan/plugins"
|
||||
"github.com/influxdb/telegraf/plugins"
|
||||
)
|
||||
|
||||
type DiskStats struct {
|
||||
|
|
|
@ -3,7 +3,7 @@ package system
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdb/tivan/plugins"
|
||||
"github.com/influxdb/telegraf/plugins"
|
||||
)
|
||||
|
||||
type DockerStats struct {
|
||||
|
|
|
@ -3,7 +3,7 @@ package system
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/influxdb/tivan/plugins"
|
||||
"github.com/influxdb/telegraf/plugins"
|
||||
)
|
||||
|
||||
type MemStats struct {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
"net"
|
||||
|
||||
"github.com/influxdb/tivan/plugins"
|
||||
"github.com/influxdb/telegraf/plugins"
|
||||
)
|
||||
|
||||
type NetIOStats struct {
|
||||
|
@ -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.
|
||||
#
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"time"
|
||||
"unsafe"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
// TODO: Get percpu
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func DiskPartitions(all bool) ([]DiskPartitionStat, error) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func TestDisk_usage(t *testing.T) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"time"
|
||||
"unsafe"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -9,8 +9,8 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
"github.com/influxdb/tivan/plugins/system/ps/cpu"
|
||||
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
"github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||
)
|
||||
|
||||
// GetDockerIDList returnes a list of DockerID.
|
||||
|
|
|
@ -5,8 +5,8 @@ package docker
|
|||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
"github.com/influxdb/tivan/plugins/system/ps/cpu"
|
||||
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
"github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||
)
|
||||
|
||||
// GetDockerIDList returnes a list of DockerID.
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"strings"
|
||||
"unsafe"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func HostInfo() (*HostInfoStat, error) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
"strings"
|
||||
"unsafe"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
type LSB struct {
|
||||
|
|
|
@ -8,8 +8,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
process "github.com/influxdb/tivan/plugins/system/ps/process"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
process "github.com/influxdb/telegraf/plugins/system/ps/process"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -5,7 +5,7 @@ package load
|
|||
import (
|
||||
"strconv"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func LoadAvg() (*LoadAvgStat, error) {
|
||||
|
|
|
@ -5,7 +5,7 @@ package load
|
|||
import (
|
||||
"strconv"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func LoadAvg() (*LoadAvgStat, error) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
package load
|
||||
|
||||
import (
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func LoadAvg() (*LoadAvgStat, error) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func getPageSize() (uint64, error) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func VirtualMemory() (*VirtualMemoryStat, error) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strings"
|
||||
"syscall"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func VirtualMemory() (*VirtualMemoryStat, error) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"strconv"
|
||||
"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
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"runtime"
|
||||
"time"
|
||||
|
||||
cpu "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
||||
cpu "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||
)
|
||||
|
||||
type Process struct {
|
||||
|
|
|
@ -10,9 +10,9 @@ import (
|
|||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
cpu "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
||||
net "github.com/influxdb/tivan/plugins/system/ps/net"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
cpu "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||
net "github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||
)
|
||||
|
||||
// copied from sys/sysctl.h
|
||||
|
|
|
@ -7,9 +7,9 @@ import (
|
|||
"encoding/binary"
|
||||
"unsafe"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
cpu "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
||||
net "github.com/influxdb/tivan/plugins/system/ps/net"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
cpu "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||
net "github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||
)
|
||||
|
||||
// MemoryInfoExStat is different between OSes
|
||||
|
|
|
@ -11,10 +11,10 @@ import (
|
|||
"strings"
|
||||
"syscall"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
cpu "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
||||
host "github.com/influxdb/tivan/plugins/system/ps/host"
|
||||
net "github.com/influxdb/tivan/plugins/system/ps/net"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
cpu "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||
host "github.com/influxdb/telegraf/plugins/system/ps/host"
|
||||
net "github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
"github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
)
|
||||
|
||||
func testGetProcess() Process {
|
||||
|
|
|
@ -11,9 +11,9 @@ import (
|
|||
|
||||
"github.com/shirou/w32"
|
||||
|
||||
common "github.com/influxdb/tivan/plugins/system/ps/common"
|
||||
cpu "github.com/influxdb/tivan/plugins/system/ps/cpu"
|
||||
net "github.com/influxdb/tivan/plugins/system/ps/net"
|
||||
common "github.com/influxdb/telegraf/plugins/system/ps/common"
|
||||
cpu "github.com/influxdb/telegraf/plugins/system/ps/cpu"
|
||||
net "github.com/influxdb/telegraf/plugins/system/ps/net"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package system
|
||||
|
||||
import "github.com/influxdb/tivan/plugins"
|
||||
import "github.com/influxdb/telegraf/plugins"
|
||||
|
||||
type SystemStats struct {
|
||||
ps PS
|
||||
|
|
|
@ -3,13 +3,13 @@ package system
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"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/tivan/testutil"
|
||||
"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"
|
||||
"github.com/influxdb/telegraf/testutil"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
VERSION="0.9.b1"
|
||||
|
||||
echo "Building Tivan version $VERSION"
|
||||
echo "Building Telegraf version $VERSION"
|
||||
|
||||
mkdir -p pkg
|
||||
|
||||
build() {
|
||||
echo -n "=> $1-$2: "
|
||||
GOOS=$1 GOARCH=$2 go build -o pkg/tivan-$1-$2 -ldflags "-X main.Version $VERSION" ./cmd/tivan/tivan.go
|
||||
du -h pkg/tivan-$1-$2
|
||||
GOOS=$1 GOARCH=$2 go build -o pkg/telegraf-$1-$2 -ldflags "-X main.Version $VERSION" ./cmd/telegraf/telegraf.go
|
||||
du -h pkg/telegraf-$1-$2
|
||||
}
|
||||
|
||||
build "darwin" "amd64"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# Tivan configuration
|
||||
# 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
|
||||
|
@ -11,7 +11,7 @@
|
|||
# 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
|
||||
|
@ -28,13 +28,13 @@
|
|||
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:
|
||||
|
@ -42,7 +42,7 @@ database = "tivan" # required.
|
|||
# [influxdb.tags]
|
||||
# dc = "us-east-1"
|
||||
|
||||
# Configuration for tivan itself
|
||||
# Configuration for telegraf itself
|
||||
# [agent]
|
||||
# interval = "10s"
|
||||
# debug = false
|
||||
|
@ -83,7 +83,7 @@ servers = ["localhost"]
|
|||
# Read metrics about network interface usage
|
||||
[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,
|
||||
# regardless of status.
|
||||
#
|
|
@ -7,7 +7,7 @@ debug = true
|
|||
url = "http://localhost:8086"
|
||||
username = "root"
|
||||
password = "root"
|
||||
database = "tivan"
|
||||
database = "telegraf"
|
||||
tags = { dc = "us-phx-1" }
|
||||
|
||||
[redis]
|
||||
|
|
Loading…
Reference in New Issue