diff --git a/README.md b/README.md index 04686c26..049615e4 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ filefd | Exposes file descriptor statistics from `/proc/sys/fs/file-nr`. | Linux filesystem | Exposes filesystem statistics, such as disk space used. | Darwin, Dragonfly, FreeBSD, Linux, OpenBSD hwmon | Expose hardware monitoring and sensor data from `/sys/class/hwmon/`. | Linux infiniband | Exposes network statistics specific to InfiniBand configurations. | Linux +ipvs | Exposes IPVS status from `/proc/net/ip_vs` and stats from `/proc/net/ip_vs_stats`. | Linux loadavg | Exposes load average. | Darwin, Dragonfly, FreeBSD, Linux, NetBSD, OpenBSD, Solaris mdadm | Exposes statistics about devices in `/proc/mdstat` (does nothing if no `/proc/mdstat` present). | Linux meminfo | Exposes memory statistics. | Darwin, Dragonfly, FreeBSD, Linux @@ -57,7 +58,6 @@ buddyinfo | Exposes statistics of memory fragments as reported by /proc/buddyinf devstat | Exposes device statistics | Dragonfly, FreeBSD drbd | Exposes Distributed Replicated Block Device statistics | Linux interrupts | Exposes detailed interrupts statistics. | Linux, OpenBSD -ipvs | Exposes IPVS status from `/proc/net/ip_vs` and stats from `/proc/net/ip_vs_stats`. | Linux ksmd | Exposes kernel and system statistics from `/sys/kernel/mm/ksm`. | Linux logind | Exposes session counts from [logind](http://www.freedesktop.org/wiki/Software/systemd/logind/). | Linux meminfo\_numa | Exposes memory statistics from `/proc/meminfo_numa`. | Linux diff --git a/collector/fixtures/e2e-output.txt b/collector/fixtures/e2e-output.txt index 1b805452..bd1b2b24 100644 --- a/collector/fixtures/e2e-output.txt +++ b/collector/fixtures/e2e-output.txt @@ -862,6 +862,51 @@ node_infiniband_unicast_packets_transmitted_total{device="mlx4_0",port="2"} 0 # HELP node_intr Total number of interrupts serviced. # TYPE node_intr counter node_intr 8.885917e+06 +# HELP node_ipvs_backend_connections_active The current active connections by local and remote address. +# TYPE node_ipvs_backend_connections_active gauge +node_ipvs_backend_connections_active{local_address="192.168.0.22",local_port="3306",proto="TCP",remote_address="192.168.82.22",remote_port="3306"} 248 +node_ipvs_backend_connections_active{local_address="192.168.0.22",local_port="3306",proto="TCP",remote_address="192.168.83.21",remote_port="3306"} 248 +node_ipvs_backend_connections_active{local_address="192.168.0.22",local_port="3306",proto="TCP",remote_address="192.168.83.24",remote_port="3306"} 248 +node_ipvs_backend_connections_active{local_address="192.168.0.55",local_port="3306",proto="TCP",remote_address="192.168.49.32",remote_port="3306"} 0 +node_ipvs_backend_connections_active{local_address="192.168.0.55",local_port="3306",proto="TCP",remote_address="192.168.50.26",remote_port="3306"} 0 +node_ipvs_backend_connections_active{local_address="192.168.0.57",local_port="3306",proto="TCP",remote_address="192.168.50.21",remote_port="3306"} 1498 +node_ipvs_backend_connections_active{local_address="192.168.0.57",local_port="3306",proto="TCP",remote_address="192.168.82.21",remote_port="3306"} 1499 +node_ipvs_backend_connections_active{local_address="192.168.0.57",local_port="3306",proto="TCP",remote_address="192.168.84.22",remote_port="3306"} 0 +# HELP node_ipvs_backend_connections_inactive The current inactive connections by local and remote address. +# TYPE node_ipvs_backend_connections_inactive gauge +node_ipvs_backend_connections_inactive{local_address="192.168.0.22",local_port="3306",proto="TCP",remote_address="192.168.82.22",remote_port="3306"} 2 +node_ipvs_backend_connections_inactive{local_address="192.168.0.22",local_port="3306",proto="TCP",remote_address="192.168.83.21",remote_port="3306"} 1 +node_ipvs_backend_connections_inactive{local_address="192.168.0.22",local_port="3306",proto="TCP",remote_address="192.168.83.24",remote_port="3306"} 2 +node_ipvs_backend_connections_inactive{local_address="192.168.0.55",local_port="3306",proto="TCP",remote_address="192.168.49.32",remote_port="3306"} 0 +node_ipvs_backend_connections_inactive{local_address="192.168.0.55",local_port="3306",proto="TCP",remote_address="192.168.50.26",remote_port="3306"} 0 +node_ipvs_backend_connections_inactive{local_address="192.168.0.57",local_port="3306",proto="TCP",remote_address="192.168.50.21",remote_port="3306"} 0 +node_ipvs_backend_connections_inactive{local_address="192.168.0.57",local_port="3306",proto="TCP",remote_address="192.168.82.21",remote_port="3306"} 0 +node_ipvs_backend_connections_inactive{local_address="192.168.0.57",local_port="3306",proto="TCP",remote_address="192.168.84.22",remote_port="3306"} 0 +# HELP node_ipvs_backend_weight The current backend weight by local and remote address. +# TYPE node_ipvs_backend_weight gauge +node_ipvs_backend_weight{local_address="192.168.0.22",local_port="3306",proto="TCP",remote_address="192.168.82.22",remote_port="3306"} 100 +node_ipvs_backend_weight{local_address="192.168.0.22",local_port="3306",proto="TCP",remote_address="192.168.83.21",remote_port="3306"} 100 +node_ipvs_backend_weight{local_address="192.168.0.22",local_port="3306",proto="TCP",remote_address="192.168.83.24",remote_port="3306"} 100 +node_ipvs_backend_weight{local_address="192.168.0.55",local_port="3306",proto="TCP",remote_address="192.168.49.32",remote_port="3306"} 100 +node_ipvs_backend_weight{local_address="192.168.0.55",local_port="3306",proto="TCP",remote_address="192.168.50.26",remote_port="3306"} 0 +node_ipvs_backend_weight{local_address="192.168.0.57",local_port="3306",proto="TCP",remote_address="192.168.50.21",remote_port="3306"} 100 +node_ipvs_backend_weight{local_address="192.168.0.57",local_port="3306",proto="TCP",remote_address="192.168.82.21",remote_port="3306"} 100 +node_ipvs_backend_weight{local_address="192.168.0.57",local_port="3306",proto="TCP",remote_address="192.168.84.22",remote_port="3306"} 0 +# HELP node_ipvs_connections_total The total number of connections made. +# TYPE node_ipvs_connections_total counter +node_ipvs_connections_total 2.3765872e+07 +# HELP node_ipvs_incoming_bytes_total The total amount of incoming data. +# TYPE node_ipvs_incoming_bytes_total counter +node_ipvs_incoming_bytes_total 8.9991519156915e+13 +# HELP node_ipvs_incoming_packets_total The total number of incoming packets. +# TYPE node_ipvs_incoming_packets_total counter +node_ipvs_incoming_packets_total 3.811989221e+09 +# HELP node_ipvs_outgoing_bytes_total The total amount of outgoing data. +# TYPE node_ipvs_outgoing_bytes_total counter +node_ipvs_outgoing_bytes_total 0 +# HELP node_ipvs_outgoing_packets_total The total number of outgoing packets. +# TYPE node_ipvs_outgoing_packets_total counter +node_ipvs_outgoing_packets_total 0 # HELP node_ksmd_full_scans_total ksmd 'full_scans' file. # TYPE node_ksmd_full_scans_total counter node_ksmd_full_scans_total 323 @@ -2505,6 +2550,7 @@ node_scrape_collector_success{collector="entropy"} 1 node_scrape_collector_success{collector="filefd"} 1 node_scrape_collector_success{collector="hwmon"} 1 node_scrape_collector_success{collector="infiniband"} 1 +node_scrape_collector_success{collector="ipvs"} 1 node_scrape_collector_success{collector="ksmd"} 1 node_scrape_collector_success{collector="loadavg"} 1 node_scrape_collector_success{collector="mdadm"} 1 diff --git a/collector/ipvs_linux.go b/collector/ipvs_linux.go index b8112d10..d7205080 100644 --- a/collector/ipvs_linux.go +++ b/collector/ipvs_linux.go @@ -17,9 +17,11 @@ package collector import ( "fmt" + "os" "strconv" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/common/log" "github.com/prometheus/procfs" ) @@ -106,6 +108,11 @@ func newIPVSCollector() (*ipvsCollector, error) { func (c *ipvsCollector) Update(ch chan<- prometheus.Metric) error { ipvsStats, err := c.fs.NewIPVSStats() if err != nil { + // Cannot access ipvs metrics, report no error. + if os.IsNotExist(err) { + log.Debug("ipvs collector metrics are not available for this system") + return nil + } return fmt.Errorf("could not get IPVS stats: %s", err) } ch <- c.connections.mustNewConstMetric(float64(ipvsStats.Connections)) diff --git a/end-to-end-test.sh b/end-to-end-test.sh index a9d6949b..920ffb77 100755 --- a/end-to-end-test.sh +++ b/end-to-end-test.sh @@ -15,6 +15,7 @@ collectors=$(cat << COLLECTORS filefd hwmon infiniband + ipvs ksmd loadavg mdadm diff --git a/node_exporter.go b/node_exporter.go index e8b53765..b24d1cb3 100644 --- a/node_exporter.go +++ b/node_exporter.go @@ -32,7 +32,7 @@ import ( ) const ( - defaultCollectors = "arp,bcache,conntrack,cpu,diskstats,entropy,edac,exec,filefd,filesystem,hwmon,infiniband,loadavg,mdadm,meminfo,netdev,netstat,sockstat,stat,textfile,time,uname,vmstat,wifi,xfs,zfs" + defaultCollectors = "arp,bcache,conntrack,cpu,diskstats,entropy,edac,exec,filefd,filesystem,hwmon,infiniband,ipvs,loadavg,mdadm,meminfo,netdev,netstat,sockstat,stat,textfile,time,uname,vmstat,wifi,xfs,zfs" ) var (