g

package
v4.0.6+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2017 License: Apache-2.0 Imports: 12 Imported by: 16

Documentation

Index

Constants

View Source
const (
	VERSION          = "4.0.6"
	COLLECT_INTERVAL = time.Second
)

changelog: 3.1.3: code refactor 3.1.4: bugfix ignore configuration 3.1.5: more sw support, DisplayByBit cfg 3.1.6 3.2.0: more sw support, fix ping bug, add ifOperStatus,ifBroadcastPkt,ifMulticastPkt 3.2.1 add Discards,Error,UnknownProtos,QLen,fix some bugs 3.2.1.1 debugmetric support multi endpoints and metrics 3.2.1.2 gosnmp use getnext to walk snmp 4.0.0 caculate counter type on swcollect local,add speedpercent 4.0.1 fix sometimes ifstat pannic 4.0.2 fix speedpercent bug 4.0.4 add lock on map;add limconn for switch snmp request 4.0.5 add custom metric,custom host

Variables

View Source
var (
	ConfigFile string
)
View Source
var (
	CustConfigFile string
)
View Source
var (
	HostConfigFile string
)
View Source
var LocalIps []string
View Source
var Root string

Functions

func InitLocalIps

func InitLocalIps()

func InitRootDir

func InitRootDir()

func InitRpcClients

func InitRpcClients()

func ParseConfig

func ParseConfig(cfg string)

func ParseCustConfig

func ParseCustConfig(cfg string)

func ParseHostConfig

func ParseHostConfig(cfg string)

func SendToTransfer

func SendToTransfer(metrics []*model.MetricValue)

Types

type CustomConfig

type CustomConfig struct {
	Metrics []*MetricConfig `json:"metrics`
}

func CustConfig

func CustConfig() *CustomConfig

type CustomMetricsConfig

type CustomMetricsConfig struct {
	Enabled  bool   `json:enbaled`
	Template string `json:template`
}

type DebugmetricConfig

type DebugmetricConfig struct {
	Endpoints []string `json:"endpoints`
	Metrics   []string `json:"metrics`
	Tags      string   `json:"tags"`
}

type GlobalConfig

type GlobalConfig struct {
	Debug         bool                 `json:"debug"`
	Debugmetric   *DebugmetricConfig   `json:"debugmetric`
	Switch        *SwitchConfig        `json:"switch"`
	Heartbeat     *HeartbeatConfig     `json:"heartbeat"`
	Transfer      *TransferConfig      `json:"transfer"`
	SwitchHosts   *SwitchHostsConfig   `json:switchhosts`
	CustomMetrics *CustomMetricsConfig `json:customMetrics`
	Http          *HttpConfig          `json:"http"`
}

func Config

func Config() *GlobalConfig

type HeartbeatConfig

type HeartbeatConfig struct {
	Enabled  bool   `json:"enabled"`
	Addr     string `json:"addr"`
	Interval int    `json:"interval"`
	Timeout  int    `json:"timeout"`
}

type HostsConfig

type HostsConfig struct {
	Hosts map[string]string `json:"hosts"`
}

func HostConfig

func HostConfig() *HostsConfig

type HttpConfig

type HttpConfig struct {
	Enabled bool   `json:"enabled"`
	Listen  string `json:"listen"`
}

type MetricConfig

type MetricConfig struct {
	IpRange []string `json:"ipRange"`
	Metric  string   `json:metric`
	Tag     string   `json:tag`
	Type    string   `json:type`
	Oid     string   `json:oid`
}

type SingleConnRpcClient

type SingleConnRpcClient struct {
	sync.Mutex

	RpcServer string
	Timeout   time.Duration
	// contains filtered or unexported fields
}
var (
	TransferClient *SingleConnRpcClient
)

func (*SingleConnRpcClient) Call

func (this *SingleConnRpcClient) Call(method string, args interface{}, reply interface{}) error

type SwitchConfig

type SwitchConfig struct {
	Enabled bool     `json:"enabled"`
	IpRange []string `json:"ipRange"`
	Gosnmp  bool     `json:"gosnmp"`

	PingTimeout int `json:"pingTimeout"`
	PingRetry   int `json:"pingRetry"`

	Community   string `json:"community"`
	SnmpTimeout int    `json:"snmpTimeout"`
	SnmpRetry   int    `json:"snmpRetry"`

	IgnoreIface           []string `json:"ignoreIface"`
	IgnoreOperStatus      bool     `json:"ignoreOperStatus"`
	Speedlimit            float64  `json:"speedlimit"`
	IgnorePkt             bool     `json:"ignorePkt"`
	Pktlimit              float64  `json:"pktlimit"`
	IgnoreBroadcastPkt    bool     `json:"ignoreBroadcastPkt"`
	BroadcastPktlimit     float64  `josn:"broadcastPktlimit"`
	IgnoreMulticastPkt    bool     `json:"ignoreMulticastPkt"`
	MulticastPktlimit     float64  `json:"multicastPktlimit"`
	IgnoreDiscards        bool     `json:"ignoreDiscards"`
	DiscardsPktlimit      float64  `json:"discardsPktlimit"`
	IgnoreErrors          bool     `json:"ignoreErrors"`
	ErrorsPktlimit        float64  `json:"errorsPktlimit"`
	IgnoreUnknownProtos   bool     `json:"ignoreUnknownProtos`
	UnknownProtosPktlimit float64  `json:"unknownProtosPktlimit"`
	IgnoreOutQLen         bool     `json:"ignoreOutQLen`
	OutQLenPktlimit       float64  `json:"outQLenPktlimit"`
	LimitCon              int      `json:limitCon`
	LimitConcur           int      `json:"limitConcur"`
	FastPingMode          bool     `json:"fastPingMode"`
}

type SwitchHostsConfig

type SwitchHostsConfig struct {
	Enabled bool   `json:enabled`
	Hosts   string `json:hosts`
}

type TransferConfig

type TransferConfig struct {
	Enabled  bool   `json:"enabled"`
	Addr     string `json:"addr"`
	Interval int    `json:"interval"`
	Timeout  int    `json:"timeout"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL