Fix formatting.

This commit is contained in:
Rasmus Larsen 2016-08-30 12:55:02 +02:00
parent 4fc43dd55e
commit a9f039e6a4
3 changed files with 389 additions and 388 deletions

View File

@ -40,8 +40,8 @@ import (
_ "github.com/influxdata/telegraf/plugins/inputs/mysql" _ "github.com/influxdata/telegraf/plugins/inputs/mysql"
_ "github.com/influxdata/telegraf/plugins/inputs/nats_consumer" _ "github.com/influxdata/telegraf/plugins/inputs/nats_consumer"
_ "github.com/influxdata/telegraf/plugins/inputs/net_response" _ "github.com/influxdata/telegraf/plugins/inputs/net_response"
_ "github.com/influxdata/telegraf/plugins/inputs/nginx"
_ "github.com/influxdata/telegraf/plugins/inputs/nfsclient" _ "github.com/influxdata/telegraf/plugins/inputs/nfsclient"
_ "github.com/influxdata/telegraf/plugins/inputs/nginx"
_ "github.com/influxdata/telegraf/plugins/inputs/nsq" _ "github.com/influxdata/telegraf/plugins/inputs/nsq"
_ "github.com/influxdata/telegraf/plugins/inputs/nsq_consumer" _ "github.com/influxdata/telegraf/plugins/inputs/nsq_consumer"
_ "github.com/influxdata/telegraf/plugins/inputs/nstat" _ "github.com/influxdata/telegraf/plugins/inputs/nstat"

View File

@ -2,11 +2,11 @@ package nfsclient
import ( import (
"bufio" "bufio"
"fmt"
"log" "log"
"os" "os"
"strconv" "strconv"
"strings" "strings"
"fmt"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs" "github.com/influxdata/telegraf/plugins/inputs"
@ -258,13 +258,15 @@ func (n *NFSCLIENT) parseData(mountpoint string, export string, version string,
acc.AddFields("nfs_bytes", fields, tags) acc.AddFields("nfs_bytes", fields, tags)
} else if first == "xprt" { } else if first == "xprt" {
switch line[1] { switch line[1] {
case "tcp": { case "tcp":
{
for i, t := range xprttcpFields { for i, t := range xprttcpFields {
fields[t] = nline[i+2] fields[t] = nline[i+2]
} }
acc.AddFields("nfs_xprttcp", fields, tags) acc.AddFields("nfs_xprttcp", fields, tags)
} }
case "udp": { case "udp":
{
for i, t := range xprtudpFields { for i, t := range xprtudpFields {
fields[t] = nline[i+2] fields[t] = nline[i+2]
} }
@ -303,7 +305,7 @@ func (n *NFSCLIENT) processText(scanner *bufio.Scanner, acc telegraf.Accumulator
} else if In(line, "(nfs)") || In(line, "(nfs4)") { } else if In(line, "(nfs)") || In(line, "(nfs4)") {
version = strings.Split(line[5], "/")[1] version = strings.Split(line[5], "/")[1]
} }
if (len(line) > 0) { if len(line) > 0 {
n.parseStat(device, export, version, line, acc) n.parseStat(device, export, version, line, acc)
if n.Fullstat == true { if n.Fullstat == true {
n.parseData(device, export, version, line, acc) n.parseData(device, export, version, line, acc)

View File

@ -1,11 +1,10 @@
package nfsclient package nfsclient
import ( import (
"testing"
"bufio" "bufio"
"strings"
"github.com/influxdata/telegraf/testutil" "github.com/influxdata/telegraf/testutil"
"strings"
"testing"
) )
const mountstatstext = `device rootfs mounted on / with fstype rootfs const mountstatstext = `device rootfs mounted on / with fstype rootfs