Commit graph

1042 commits

Author SHA1 Message Date
Hu Shuai 4109a5089f Fix ineffassign issue
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2021-02-08 10:53:12 +08:00
Ben Kochie a37d3f659c
Release 1.1.0
* Update Build
  - Update CircleCI orb.
  - Update CIrcleCI Machine image.
  - Use golang-builder 1.15.
* Update Go modules.
* Fixup fixtures for XFS bug.

NOTE: We have improved some of the flag naming conventions (PR #1743). The old names are
      deprecated and will be removed in 2.0. They will continue to work for backwards
      compatibility.

* [CHANGE] Improve filter flag names #1743
* [CHANGE] Add btrfs and powersupplyclass to list of exporters enabled by default #1897
* [FEATURE] Add fibre channel collector #1786
* [FEATURE] Expose cpu bugs and flags as info metrics. #1788
* [FEATURE] Add network_route collector #1811
* [FEATURE] Add zoneinfo collector #1922
* [ENHANCEMENT] Add more InfiniBand counters #1694
* [ENHANCEMENT] Add flag to aggr ipvs metrics to avoid high cardinality metrics #1709
* [ENHANCEMENT] Adding backlog/current queue length to qdisc collector #1732
* [ENHANCEMENT] Include TCP OutRsts in netstat metrics #1733
* [ENHANCEMENT] Add pool size to entropy collector #1753
* [ENHANCEMENT] Remove CGO dependencies for OpenBSD amd64 #1774
* [ENHANCEMENT] bcache: add writeback_rate_debug stats #1658
* [ENHANCEMENT] Add check state for mdadm arrays via node_md_state metric #1810
* [ENHANCEMENT] Expose XFS inode statistics #1870
* [ENHANCEMENT] Expose zfs zpool state #1878
* [ENHANCEMENT] Added an ability to pass collector.supervisord.url via SUPERVISORD_URL environment variable #1947
* [BUGFIX] filesystem_freebsd: Fix label values #1728
* [BUGFIX] Fix various procfs parsing errors #1735
* [BUGFIX] Handle no data from powersupplyclass #1747
* [BUGFIX] udp_queues_linux.go: change upd to udp in two error strings #1769
* [BUGFIX] Fix node_scrape_collector_success behaviour #1816
* [BUGFIX] Fix NodeRAIDDegraded to not use a string rule expressions #1827
* [BUGFIX] Fix node_md_disks state label from fail to failed #1862
* [BUGFIX] Handle EPERM for syscall in timex collector #1938
* [BUGFIX] bcache: fix typo in a metric name #1943
* [BUGFIX] Fix XFS read/write stats (https://github.com/prometheus/procfs/pull/343)

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-02-05 21:23:23 +01:00
Ben Kochie 43b91ac846
Merge pull request #1954 from prometheus/superq/noisy_rapl
Fix rapl collector log noise
2021-02-05 21:20:53 +01:00
Ben Kochie dc5a94c803
Fix rapl collector log noise
Catch permission denined errors in the rapl collector.

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-02-05 18:16:17 +01:00
Ben Kochie 0b0c5624e1
Fix network_route collector naming
* Use `device` label to match other `node_network_...` metics.
* Fix naming convention to match Promehteus best practices.

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-02-05 18:10:42 +01:00
Ben Kochie 1729558e11
Merge pull request #1922 from kwisniewski98/zone
Add zoneinfo collector
2021-02-05 13:57:54 +01:00
Ben Kochie 78682c80af
Merge pull request #1786 from deusnefum/master
Add fibre channel collector
2021-02-03 18:22:59 +01:00
mhiles 5a28930e2e change fc_host everywhere, update fixtures
Signed-off-by: mhiles <hiles@hpe.com>
2021-02-03 09:35:58 -05:00
Ben Kochie 22c5aeb0ef
Merge pull request #1943 from hs0210/work
bcache: fix typo
2021-02-03 09:57:23 +01:00
Ben Kochie 477a192803
Merge pull request #1947 from Oloremo/supervisord_env_vars
Added an ability to pass collector.supervisord.url via ENV vars
2021-02-03 08:35:43 +01:00
mhiles 56eba80306 add fibrechannel to default list in read me; host -> fc_host to avoid name collision
Signed-off-by: mhiles <hiles@hpe.com>
2021-02-02 18:05:24 -05:00
Matthew Hiles 3fcccd5b14 Update collector/fibrechannel_linux.go
Co-authored-by: Ben Kochie <superq@gmail.com>
Signed-off-by: mhiles <hiles@hpe.com>
2021-02-02 16:47:56 -05:00
mhiles 19790920b2 update fibrechannel fixture
Signed-off-by: mhiles <hiles@hpe.com>
2021-01-29 10:38:45 -05:00
mhiles 6e02d5bff1 invalid_tx_word_total -> invalid_tx_words_total
Signed-off-by: mhiles <hiles@hpe.com>
2021-01-29 10:28:22 -05:00
Dustin Hooten eecfbcd610 PR feedback
Signed-off-by: Dustin Hooten <dustinhooten@gmail.com>
2021-01-29 10:37:56 +01:00
Dustin Hooten b7626ecdbf ProcessStatCollector: continue if PID disappears between opening and reading file
Signed-off-by: Dustin Hooten <dustinhooten@gmail.com>
2021-01-29 10:37:56 +01:00
Proskurin Kirill 8d147327a6 feat: Added an ability to pass collector.supervisord.url via SUPERVISORD_URL environment variable
Signed-off-by: Proskurin Kirill <kirill.proskurin@behavox.com>
2021-01-27 18:09:52 +00:00
Wisniewski, Krzysztof2 997a8fbb7f Add zoneinfo collector
Signed-off-by: Wisniewski, Krzysztof2 <Krzysztof2.Wisniewski@intel.com>
2021-01-26 12:00:35 +01:00
Hu Shuai 0900cb5655 bcache: fix typo
Fix typos in collector/bcache_linux.go and collector/fixtures/e2e-output.txt

Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2021-01-25 13:50:16 +08:00
Ben Kochie 7904ea4af2
Update netdev OpenBSD amd64 filter
Use new filtering method from #1826

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-01-24 16:37:02 +01:00
Ben Kochie 40ce993d5b
Merge pull request #1816 from liiling/master
Fix node_scrape_collector_success behaviour
2021-01-24 15:28:41 +01:00
Ben Kochie 9fab63825b
Merge pull request #1753 from binjip978/entropy
add pool size to entropy collector
2021-01-24 14:57:33 +01:00
Ben Kochie cb6509f1ac
Merge pull request #1826 from digineo/device-filter
Move ignore/accept to new netDevFilter struct
2021-01-24 14:55:29 +01:00
Ben Kochie 8536df5bbb
Merge branch 'master' into network_route 2021-01-24 14:46:00 +01:00
Ben Kochie e785e06e85
Merge pull request #1884 from xinau/patch-1
collector/filesystem: fixing logging message
2021-01-24 14:40:36 +01:00
Ben Kochie 1d03daf616
Handle EPERM for syscall in timex collector
Handle case where Adjtimex syscall gets a permission denined error.

Fixes: https://github.com/prometheus/node_exporter/issues/1934

Signed-off-by: Ben Kochie <superq@gmail.com>
2021-01-23 14:22:46 +01:00
Ben Kochie 8a3cc9db05
Merge pull request #1694 from treydock/ib-counters
Add more IB counters
2020-12-14 01:07:58 +01:00
Ben Kochie 3b8a7f6ef3
Merge pull request #1774 from ston1th/openbsd_amd64
remove openbsd amd64 cgo dependecies
2020-12-14 01:06:03 +01:00
kamijin_fanta 67480c5e5b repalce to jsimonetti/rtnetlink
Signed-off-by: kamijin_fanta <kamijin@live.jp>
2020-12-04 11:37:02 +09:00
kamijin_fanta 1f5898999e add network_route collector
Signed-off-by: kamijin_fanta <kamijin@live.jp>
2020-12-04 10:32:34 +09:00
ston1th 91bec7c53c fixed build
new type: `netDevStats map[string]map[string]uint64`

Signed-off-by: ston1th <ston1th@giftfish.de>
2020-11-12 23:52:03 +01:00
ston1th 1450a92a68 move const values to iota plus code cleanup
Signed-off-by: ston1th <ston1th@giftfish.de>
2020-11-12 23:37:57 +01:00
ston1th bdba65df16 skip null bytes at the end of strings
Signed-off-by: ston1th <ston1th@giftfish.de>
2020-11-12 23:37:57 +01:00
ston1th 26bd6bf99d more build fixes
Signed-off-by: ston1th <ston1th@giftfish.de>
2020-11-12 23:37:56 +01:00
ston1th 386992e984 fixed build
Signed-off-by: ston1th <ston1th@giftfish.de>
2020-11-12 23:37:56 +01:00
ston1th f8609aeee2 remove openbsd amd64 cgo dependecies
I have rewritten all CGO dependencies for OpenBSD amd64
using pure go, be able to crosscompile node_exporter.

Signed-off-by: ston1th <ston1th@giftfish.de>
2020-11-12 23:37:48 +01:00
Trey Dockendorf 0692791457 Add more IB counters
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
2020-11-12 09:35:13 -05:00
xinau daa7303a82 collector/filesystem: fixing logging message
this change fixes the logging message for the filesystem ignored-fs-types flag to output the flag instead of the mountpoints flag.

Signed-off-by: xinau <felix.ehrenpfort@protonmail.com>
2020-11-12 15:27:33 +01:00
Artur Molchanov 519203e3d0 Expose zfs zpool state
Create a metric node_zfs_zpool_state.

Signed-off-by: Artur Molchanov <artur.molchanov@easybrain.com>
2020-10-27 17:39:13 +03:00
Ondrej Baudys ed10485073
Expose XFS inode statistics (#1869) (#1870)
* Expose XFS inode statistics (#1869)

Also fixes #1177

@SuperQ @discordianfish

Signed-off-by: Ondrej Baudys <obaudys@gmail.com>
Co-authored-by: obaudys@gmail.com <ondrej.baudys@nextgen.net>
2020-10-22 18:14:33 +02:00
Ben Kochie 306a365377 Downgrade CPU counter warnings
We've gathered enough evidence that the CPU counter bug workaround is
working as intended. Downgrade the message from Warning to Debug.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-10-01 12:41:15 +02:00
Christian Rohmann a3aaf63bb1
Add check state for mdadm arrays via node_md_state metric (#1810)
* Expose metric for state=check for node_md_state
* Added new e2e output fixture including md201 which is in checking state and a the new state=check labeled metric for all other md

Signed-off-by: Christian Rohmann <github@frittentheke.de>
2020-09-27 13:44:45 +02:00
Julius Volz d05aac43e4 Fix capitalization of CPU acronym throughout
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2020-09-03 23:34:33 +02:00
Li Ling bf154d485b Differentiate ErrNoData and other errors (#1323, #1723)
Signed-off-by: Li Ling <liiling@google.com>
2020-09-01 16:21:36 +02:00
Li Ling 875f437fcc Conntrack update: differentiate ErrNoData and other errors (#1323, #1723)
Signed-off-by: Li Ling <liiling@google.com>
2020-08-26 14:35:39 +02:00
Julian Kornberger 2d412c6ce6 Move ignore/accept to new netDevFilter struct
Signed-off-by: Julian Kornberger <jk+github@digineo.de>
2020-08-26 11:33:05 +02:00
Julian Kornberger 66fb6762bf
Netdev tweaks (#1558)
* Check interface name before loading interface data
* Reduce indentation
* Optimize nested netdev map

This change avoids conversion to strings and back.

Signed-off-by: Julian Kornberger <jk+github@digineo.de>
2020-08-24 17:43:27 +02:00
Aleksei Zakharov 0478ddef69
bcache: add writeback_rate_debug stats (#1658)
* bcache: add writeback_rate_debug export

Signed-off-by: Aleksei Zakharov <zaharov@selectel.ru>
2020-08-24 17:40:31 +02:00
Li Ling a26ffaf4f8 Failed conntrack update should return success=0 (#1323, #1723)
Signed-off-by: Li Ling <liiling@google.com>
2020-08-20 14:18:57 +02:00
Li Ling f0332993ef Empty collection should return success=0 (#1323, #1723)
Signed-off-by: Li Ling <liiling@google.com>
2020-08-20 14:09:55 +02:00
Aleksei Zakharov 3b035c8fa1
bcache: add priorityStats flag (#1621)
* bcache: add priorityStats flag

Fixes #1593

Signed-off-by: Aleksei Zakharov <zaharov@selectel.ru>
2020-08-10 16:50:58 +02:00
domchan 503e4fc848
Expose cpu bugs and flags as info metrics. (#1788)
* Expose cpu bugs and flags as info metrics with a regexp filter.
* Automatically enable CPU info metrics when using flags or bugs feature.

Signed-off-by: domgoer <domdoumc@gmail.com>
2020-07-17 18:32:23 +02:00
mhiles 10f6841caf counter compliance again
Signed-off-by: mhiles <hiles@hpe.com>
2020-07-13 12:00:43 -04:00
mhiles d80ae383b7 conform to metric naming conventions
Signed-off-by: mhiles <hiles@hpe.com>
2020-07-13 10:30:52 -04:00
mhiles 076c953488 update fixtures / e2e test for fibre channel
Signed-off-by: mhiles <hiles@hpe.com>
2020-07-13 09:30:19 -04:00
mhiles 62403d6748 add fibre channel collector
Signed-off-by: mhiles <hiles@hpe.com>
2020-07-13 08:41:04 -04:00
Karsten Weiss b9b1d4e369 udp_queues_linux.go: s/upd/udp/ in two error strings
Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2020-06-29 15:00:15 +02:00
Ben Kochie 5d42d4d99f
Merge pull request #1732 from fach/master
Adding backlog/current queue length to qdisc collector
2020-06-22 20:15:04 +02:00
binjip978 488d10ef48 Merge branch 'master' into entropy
Signed-off-by: binjip978 <binjip978@gmail.com>
2020-06-19 08:50:51 +03:00
Ben Kochie 08ce3c6dd4
Merge pull request #1733 from prometheus/superq/OutRsts
Include TCP OutRsts in netstat metrics
2020-06-18 17:12:45 +02:00
binjip978 3e1cb10f55 change metric description to correct units
Signed-off-by: binjip978 <binjip978@gmail.com>
2020-06-16 18:29:22 +03:00
Ben Kochie dfa53f835a
Use Go 1.13 error features
* Use `errors.Is()` for unwrapping errors.
* Use `%w` error verb in internal error formatting.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-06-16 14:47:03 +02:00
binjip978 6d1a4ddb24 add pool size to entropy collector
Signed-off-by: binjip978 <binjip978@gmail.com>
2020-06-16 08:06:40 +03:00
Ben Kochie 64ba27e7d6 Fix up powersupplyclass error
Switch to go `%w` error verb and errors.Is().

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-06-15 12:36:29 +02:00
Ben Kochie 35bfe455df
Merge pull request #1735 from prometheus/bjk/bump_procfs
Update prometheus/procfs
2020-06-15 07:44:34 +02:00
Ben Kochie c8c1618074
Merge pull request #1747 from prometheus/superq/fix_powersupplyclass
Handle no data from powersupplyclass
2020-06-14 15:45:12 +02:00
Ben Kochie baa7ab732f
Update prometheus/procfs
Fixes: https://github.com/prometheus/node_exporter/issues/1721

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-06-14 14:18:13 +02:00
Ben Kochie 7790f96881
Merge pull request #1743 from prometheus/superq/flags
Improve filter flag names.
2020-06-14 10:39:43 +02:00
Ben Kochie 5fed4f01e9
Handle no data from powersupplyclass
Handle the case when /sys/class/power_supply doesn't exist. Fixes
logging error spam.

Requires https://github.com/prometheus/procfs/pull/308

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-06-13 11:09:16 +02:00
Ben Kochie 7e49b68d3a
Improve filter flag names.
Update netdev and systemd collectors to deprecate poorly chosen flag names.

Old flag names to be removed in 2.0.0.

https://github.com/prometheus/node_exporter/issues/1742

Add log messages for parsed flag values to help discover quoting isuses in
supervisors.

https://github.com/prometheus/node_exporter/issues/1737

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-06-12 12:46:31 +02:00
Jeffrey Stoke cb7ab5119a
Fix collectors' build tags
Signed-off-by: Jeffrey Stoke <me@arhat.dev>
2020-06-12 10:26:30 +02:00
fach 79ef305a19 Updating e2e test output
Signed-off-by: fach <shaw38@gmail.com>
2020-06-04 13:01:34 -04:00
fach 0ea8978788 Adding backlog/current queue length to qdisc collector
Signed-off-by: fach <shaw38@gmail.com>
2020-06-04 12:13:07 -04:00
Ben Kochie 204164e4e4
Include TCP OutRsts in netstat metrics
TCP "OutRsts" is the number of TCP Resets sent by the node. This can be
useful for monitoring connection failures and flooding.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-06-04 08:51:39 +02:00
David O'Rourke 217bbdd6b9 helper_test: Fix copyright year
Signed-off-by: David O'Rourke <david.orourke@gmail.com>
2020-06-03 11:33:10 +02:00
David O'Rourke 03450a4d7d filesystem_freebsd: Use bytesToString to get label values
Signed-off-by: David O'Rourke <david.orourke@gmail.com>
2020-06-03 11:33:10 +02:00
David O'Rourke d6fbce1529 helper: Add new bytesToString function and tests
Signed-off-by: David O'Rourke <david.orourke@gmail.com>
2020-06-03 11:33:10 +02:00
David O'Rourke 4c06e33c23 filesystem_freebsd: Fix label values
We must know the length of the various filesystem C strings before
turning them from a byte array into a Go string, otherwise our Go
strings could contain null bytes, corrupting the label values.

Signed-off-by: David O'Rourke <david.orourke@gmail.com>
2020-06-03 11:33:10 +02:00
Wei He 0253277121
Add flag to aggr ipvs metrics to avoid high cardinality metrics (#1709)
Fixes #1708

Signed-off-by: Wing924 <weihe924stephen@gmail.com>
2020-06-02 10:52:00 +02:00
Ben Kochie 2aef188bc8
Merge pull request #1679 from alexnoz/ntp-usage-str-fix
Use clearer usage string for `collector.ntp.server-is-local` option
2020-05-25 13:58:01 +02:00
Ben Kochie f3073755a3
Merge pull request #1690 from shapor/patch-1
Move regexp to global in meminfo_linux.go
2020-05-25 13:57:24 +02:00
Ben Kochie 3565316d7e
Linux CPU: Cache CPU metrics
Cache CPU metrics to avoid counters (ie iowait) jumping backwards.

Fixes: https://github.com/prometheus/node_exporter/issues/1686

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-05-24 16:31:26 +02:00
Ben Kochie b532c81da7
Update filesystem freebsd
Upstream x/sys/unix changed types.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-05-14 21:02:21 +02:00
Sudhar287 6807e5319b
read contents of objset file (#1632)
* added objread functionality

Signed-off-by: Sudharshann D <sudhar287@gmail.com>
2020-05-13 21:06:00 +02:00
Shapor Naghibzadeh a1a3633d89 Move regexp to global in meminfo_linux.go
Compile regexp outside of parsing function in meminfo_linux.go

Signed-off-by: Shapor Naghibzadeh <shapor@google.com>
2020-04-26 01:13:25 -07:00
Alex Nozdriukhin 744e334ef9 Use clearer usage string for collector.ntp.server-is-local option
Signed-off-by: Alex Nozdriukhin <alex-nozzz@mail.ru>
fixes #1662
2020-04-18 00:53:57 +03:00
alpaca fa4edd700e
Fix accidently empty lines in meminfo_linux (#1671)
* Fix accidently empty lines in meminfo_linux

Signed-off-by: qwertysun <qwertysun@tencent.com>
2020-04-17 12:07:35 +02:00
Daniel Hodges b14168cf6a
Add perf tracepoint collection flag (#1664)
* Add tracepoint collector option for perf collector

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2020-04-17 12:02:08 +02:00
Daniel Hodges 44357ed677
Fix initialization in perf collector when using multiple CPUs (#1665)
* Fix initialization in perf collector when using multiple CPUs

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2020-04-17 11:59:07 +02:00
Peter Bueschel da5972b539
Add gauges for allocated memory for queued UDP and TCP packages (#1503)
* Two new states will be added to the tcpstat collector called rx_queued_bytes and tx_queued_bytes.

For UDP datagrams an additional collector 'udp_queues' can be used to expose the total lengths of the tx_queue and rx_queue.
@SuperQ and @discordianfish this changes gives us the option to check for overloaded UDP + TCP processing.
The names of the new TCP states and the UDP metric can be discussed.
The current reasons are just:

I don't want to add another collector for the same exposed file, so I just added the new states to the tcpstat collector.
I chose the name 'udp_queue' instead of 'udpstat' as UDP has no state.


Signed-off-by: Peter Bueschel <peter.bueschel@logmein.com>
2020-03-31 10:46:32 +02:00
Paweł Krupa 1771fc87d9
collector/systemd: use regexp to extract systemd version (#1647)
Signed-off-by: paulfantom <pawel@krupa.net.pl>
2020-03-27 21:35:56 +01:00
Tom Wilkie 6496c24d61
Metrics for IO errors on Mac. (#1636)
* Metrics for IO errors and retries on Mac.

Signed-off-by: Tom Wilkie <tom@grafana.com>
2020-03-21 21:05:38 +01:00
Benjamin Drung 34d50e15d5 Add model_name and stepping to node_cpu_info metric
The `node_cpu_info` metric contains some information like the `model`
(which is an integer), but not the human readable model name. Also the
stepping of the processor might be interesting, since different stepping
of a processor might behave differently.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
2020-03-20 17:27:11 +01:00
Ben Kochie e49a13d0cf
Catch missing schedstat file (#1641)
Suppres error log noise if schedstat file doesn't exist.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-03-19 19:50:36 +01:00
Ben Kochie c4183f9935
Minor cleanup in perf collector (#1616)
* Use `strconv.Itoa()` instead of `fmt.Sprintf()` for simple conversion.
* Eliminate copy-paste in collector setup.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-02-20 12:05:59 +01:00
Daniel Hodges ec62141388
Fix num cpu (#1561)
* add a map of profilers to CPUids

`runtime.NumCPU()` returns the number of CPUs that the process can run
on. This number does not necessarily correlate to CPU ids if the
affinity mask of the process is set.

This change maintains the current behavior as default, but also allows
the user to specify a range of CPUids to use instead.

The CPU id is stored as the value of a map keyed on the profiler
object's address.

Signed-off-by: Joe Damato <jdamato@fastly.com>
Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
Signed-off-by: Daniel Hodges <hodges@uber.com>

Co-authored-by: jdamato-fsly <55214354+jdamato-fsly@users.noreply.github.com>
2020-02-20 11:36:33 +01:00
Paul Gier b40954dce5
new flag to disable all default collectors (#1460)
* new flag to disable all default collectors

Signed-off-by: Paul Gier <pgier@redhat.com>

Co-authored-by: Ben Kochie <superq@gmail.com>
2020-02-20 11:03:33 +01:00
Ben Kochie 3e1b0f1bee
Don't count empty collection as success (#1613)
Many collectors depend on underlying features to be enabled. This causes
confusion about what "success" means. This changes the behavior of the
`node_scrape_collector_success` metric.

* When a collector is unable to find data don't return success.
* Catch the no data error and send to Debug log level to avoid log spam.
* Update collectors to support this new functionality.
* Fix copy-pasta mistake in infiband debug message.

Closes: https://github.com/prometheus/node_exporter/issues/1323

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-02-19 16:11:29 +01:00
Ben Kochie 1a75bc7b50
Fix up Darwin swap metrics
* Add a changelog entry.
* Remove redundant swap free metric.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-02-19 15:52:47 +01:00
jonas-lindmark 9828533697
Swap usage on darwin from sysctl vm.swapusage (#1608)
Signed-off-by: jonas <jonas.lindmark@denacode.se>
2020-02-19 15:51:29 +01:00
Silke Hofstra 8faa843fc4
Add Btrfs collector (#1512)
* Add procfs/btrfs to vendor folder
* Add Btrfs collector

Resolves #1100

Signed-off-by: Silke Hofstra <silke@slxh.eu>
2020-02-19 15:48:51 +01:00
Benjamin Drung ca1ac435ea
Collect non-numeric data from /sys/class/infiniband (#1563)
Let the node exporter collect the non-numeric data from
/sys/class/infiniband: board ID, firmware version, and HCA type.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>

Co-authored-by: Ben Kochie <superq@gmail.com>
2020-02-19 15:18:44 +01:00
Phil Porada 14eafab016
Adds metrics and tests for UDP receive and send buffer errors (#1534)
* Adds metrics for UDP receive and send buffer errors

Signed-off-by: Phil Porada <philporada@gmail.com>
2020-02-19 14:41:40 +01:00
Julian Kornberger cfcaeee145
Use strconv.Itoa() instead of fmt.Sprintf() (#1566)
Signed-off-by: Julian Kornberger <jk+github@digineo.de>
2020-02-19 14:34:05 +01:00
Tobias Klauser 6ad94ae4bc
Implement loadavg on all BSDs without cgo (#1584)
Reuse the Go-only implementation already in place for FreeBSD (#385) on
Darwin, DragonflyBSD, NetBSD and OpenBSD.

Tested on all affected platforms.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2020-02-18 14:14:35 +01:00
Ben Kochie 1567cefdae
Bump all vendoring (#1612)
Update all vendoring to current releases.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-02-18 13:27:11 +01:00
Ben Kochie 14df2a1a1a
Update to latest procfs library (#1611)
Bump to v0.0.10 procfs library.

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-02-18 11:33:46 +01:00
Johannes 'fish' Ziemke dcfd610433
systemd: Clarify private flag description (#1587)
This requires root, so it shouldn't be used.

This closes #1246

Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org>
2020-02-15 11:39:45 +01:00
Julien Pivotto 84c6446094 netdev: clean zero-value assignments
Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
2020-02-13 12:20:27 +01:00
Ben Kochie 92ea3c6a3f Fix inifiband collector log noise (#1599)
Handle non-existent infiniband results silent.

Fixes: https://github.com/prometheus/node_exporter/issues/1511

Signed-off-by: Ben Kochie <superq@gmail.com>
2020-02-08 17:18:17 +01:00
Ukri Niemimuukko eac3e30f7f rapl_linux collector
This exposes RAPL statistics from /sys/class/powercap.

Co-Authored-By: Ben Kochie <superq@gmail.com>
Signed-off-by: Ukri Niemimuukko <ukri.niemimuukko@intel.com>
2020-02-01 12:06:30 +01:00
Paul Cameron 9bb37873a8 Add unix socket support for supervisord collector (#1592)
* Add unix socket support for supervisord collector

For example:
  --collector.supervisord.url=unix:///var/run/supervisor.sock

Fixes prometheus/node_exporter#262

Signed-off-by: Paul Cameron <cameronpm@gmail.com>
2020-01-28 08:50:23 +01:00
Peter Tribble e7a27366a0 Fix Solaris build (typos in function names) (#1522)
Signed-off-by: Peter Tribble <peter.tribble@gmail.com>

Co-authored-by: Ben Kochie <superq@gmail.com>
2020-01-24 18:06:10 +01:00
Thomas Lin 3ddc82c2d8 Fixed inaccurate 'node_network_speed_bytes' when speeds are low (#1580)
Integer division and the order of operations when converting Mbps to Bps
results in a loss of accuracy if the interface speeds are set low.
e.g. 100 Mbps is reported as 12000000 Bps, should be 12500000
     10 Mbps is reported as 1000000 Bps, should be 1250000

Signed-off-by: Thomas Lin <t.lin@mail.utoronto.ca>
2020-01-01 13:10:53 +01:00
Ben Kochie f316099f87
Fix up softnet collector for go-kit change (#1581)
Add missing update for new go-kit logging change.

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-12-31 19:36:39 +01:00
Ben Ye 2477c5c67d switch to go-kit/log (#1575)
Signed-off-by: yeya24 <yb532204897@gmail.com>
2019-12-31 17:19:37 +01:00
Peter Nicholson a80b7d0bc5 Add softnet collector (#1576)
Signed-off-by: Peter Nicholson <petergoods@hotmail.com>
2019-12-30 01:36:10 +01:00
Julian Kornberger cafb12dc59 Add cause to error message
Signed-off-by: Julian Kornberger <jk+github@digineo.de>
2019-12-19 15:26:55 +01:00
Julian Kornberger 043fecbfd8 Wrap errors in the Go 1.13 way
Signed-off-by: Julian Kornberger <jk+github@digineo.de>
2019-12-19 15:26:55 +01:00
Matthieu Guegan 2cae917bb7 fix OpenBSD cache memory information (#1542)
This will now use `bcstats.numbufpages` instead of `uvmexp.vnodepages`.

Inspired by OpenBSD's `src/usr.bin/top`

Signed-off-by: Matthieu Guegan <matthieu.guegan@deindeal.ch>
2019-12-02 13:41:58 +01:00
Matt Layher da6b66371f collector: reimplement sockstat collector with procfs (#1552)
* collector: reimplement sockstat collector with procfs
* collector: handle sockstat IPv4 disabled, debug logging

Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-11-25 13:41:38 -06:00
Holger Hoffstätte 3c2c4e7b3c Add new counters for flush requests in Linux 5.5 (#1548)
* Add diskstat flush request counters for Linux 5.5+
* Update tests for diskstat flush request counters with Linux 5.5+

Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
2019-11-25 13:16:15 -06:00
Ben Kochie 67d3010a79
Add fixture update helper (#1551)
* Add makefile target to update sysfs fixtures.
* Use similar style for fixtures from procfs.
* Re-pack fixtures ttar file.

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-11-23 07:52:47 -06:00
Benjamin Drung 04fbcfffa1 Collect InfiniBand port state and physical state (#1357)
Collect the InfiniBand port state, the physical state, and the maximum
signal transfer rate.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
2019-11-22 13:52:17 -08:00
Matt Layher 177ac7f50f collector: refactor textfile collector to avoid looping defer
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-11-22 13:22:01 -05:00
Sven Haardiek d089776e8b
Squashed commit of the following:
commit 5ef96388a978c54173e1b1ec8e7bcb41fc7d130d
Author: Sven Haardiek <sven@haardiek.de>
Date:   Wed Sep 18 20:45:23 2019 +0200

    block variables

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit c1177382e241994618a8ab7dd9842027d597b0df
Author: Sven Haardiek <sven@haardiek.de>
Date:   Wed Sep 18 20:38:33 2019 +0200

    Use SI Units

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 04e4f99c423872d3094f21f89a8235b233a01941
Merge: 5417c98 f3538e1
Author: Sven Haardiek <sven@haardiek.de>
Date:   Wed Sep 18 19:20:17 2019 +0200

    Merge branch 'master' into power_supply_class

commit 5417c9820a40b37b490caedeaa3526883380b9bf
Author: Sven Haardiek <sven@haardiek.de>
Date:   Wed Sep 4 23:02:39 2019 +0200

    Drop averages

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 1f1447dbe7bbdcdabebf4c968beb14c67d89dd9f
Author: Sven Haardiek <sven@haardiek.de>
Date:   Wed Sep 4 22:56:00 2019 +0200

    Update Copyright

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 9677425059a3bf61cd7498cf7b5f05d5af7a626b
Merge: 0b51589 d3478a2
Author: Sven Haardiek <sven@haardiek.de>
Date:   Mon Sep 2 22:02:53 2019 +0200

    Merge branch 'master' into power_supply_class

commit 0b51589f390cc1b33ea4728d85fca3a3b231cf3f
Author: PrometheusBot <prometheus-team@googlegroups.com>
Date:   Fri Aug 30 13:32:17 2019 +0200

    makefile: update Makefile.common with newer version (#1466)

    Signed-off-by: prombot <prometheus-team@googlegroups.com>

commit af2b9e849c7b69237b7fa0e9a289c929ec7173a0
Author: Boris Momčilović <boris.momcilovic@gmail.com>
Date:   Tue Aug 27 14:24:11 2019 +0200

    Ipvs firewall mark (#1455)

    * IPVS: include firewall mark label

    Signed-off-by: Boris Momčilović <boris@firstbeatmedia.com>

commit 773f99de7f699900a00b4d35340e356fe7098ee7
Author: Paul Gier <pgier@redhat.com>
Date:   Tue Aug 27 02:26:19 2019 -0500

    update procfs to v0.0.4 (#1457)

    Signed-off-by: Paul Gier <pgier@redhat.com>

commit 6f8a4f4348f62700cbf7eeb2657851237e13c35d
Author: beorn7 <beorn@grafana.com>
Date:   Tue Aug 20 18:49:12 2019 +0200

    Update legendLink

    This still had the 'k8s' in as it was copied and pasted from the
    kubernetes-mixin.

    Signed-off-by: beorn7 <beorn@grafana.com>

commit d758cf394cfbed9e87e116a24d72050066cd039a
Author: beorn7 <beorn@grafana.com>
Date:   Wed Aug 14 22:24:24 2019 +0200

    Make the severity of "critical" alerts configurable

    This addresses the blissful scenario where single-node failures are
    unproblematic. No reason to wake somebody up if a node is about to
    screw itself up by filling the disk.

    Signed-off-by: beorn7 <beorn@grafana.com>

commit 041b9e1e785f5f43bbef97c0c76d205181d08890
Author: beorn7 <beorn@grafana.com>
Date:   Thu Aug 15 16:43:57 2019 +0200

    Add line for number of cores to load graph

    Backported from the node dashboard in the kubernetes-mixin.

    Signed-off-by: beorn7 <beorn@grafana.com>

commit 5552bb3a6b2be1e3dd1a93dbdb9650bd0363a922
Author: beorn7 <beorn@grafana.com>
Date:   Thu Aug 15 16:36:10 2019 +0200

    Fix title of CPU panel to usage

    We use the `mode="idle"` metric, but we are inverting it, so this is
    usage, and that's intended.

    Signed-off-by: beorn7 <beorn@grafana.com>

commit db0571b402233323ed7e222e53f7ef7738520f49
Author: beorn7 <beorn@grafana.com>
Date:   Thu Aug 15 16:32:54 2019 +0200

    node-mixin: Improve disk usage panel

    - Use a stacked graph instead of a gauge as development over time is
      especially useful for disk space usage.

    - By only taking one metric per device into account, we avoid
      double-counting for devices that are mounted multiple times.

    Signed-off-by: beorn7 <beorn@grafana.com>

commit 3822e096c5d27d06b9c9a68beff81ef23f12eb36
Author: Björn Rabenstein <beorn@grafana.com>
Date:   Thu Aug 15 00:40:51 2019 +0200

    node-mxin: Improve nodes dashboard (#1448)

    * node-mixin: Improve nodes dashboard

    - Use stacking where it makes sense.
    - Normalize idle CPU so that stacking is more meaningful.
    - Consistently fill where stacking is used but don't fill where not.
    - Fix y axis max value for Idle CPU panel.
    - Fix y axis min value for memory usage panel.
    - Use `$__interval` for range where applicable (and set min step
      to 1m).
    - Make the right Y axis for disk I/O actually work.

    This is just an incremental improvements. It doesn't touch the more
    involved TODOs.

    Signed-off-by: beorn7 <beorn@grafana.com>

commit fbced86b9835e1b196c15ddcac01ba3cfcf369cc
Author: beorn7 <beorn@grafana.com>
Date:   Tue Aug 13 21:54:28 2019 +0200

    node-mixin: Fix various straight-forward issues in the USE dashboards

    - Normalize cluster memory utilisation.

    - Fix missing `1m` in memory saturation.

    - Have both disk-related row next to each other instead with the
      network row in between.

    - Correctly render transmit network traffic as negative, using
      `seriesOverrides` and `min: null` for the y-axis.

    - Make panel and row naming consistent.

    - Remove legend where it would just display a single entry with
      exactly the title of the panel.

    - Fix metric name in individual node CPU Saturation panel.

    - Break up disk space utilisation by device in the panel for an
      individual node.

    NB: All of that doesn't touch any more subtle issues captured in the
    various TODOs.

    Signed-off-by: beorn7 <beorn@grafana.com>

commit 5bdf0625023cf7d05e0f65c6b6a1303637772ca6
Author: Sandro Jäckel <sandro.jaeckel@gmail.com>
Date:   Wed Aug 7 09:19:20 2019 +0200

    Update rootfs syntax in Docker example (#1443)

    Signed-off-by: Sandro Jäckel <sandro.jaeckel@gmail.com>

commit b59f081d45a3ca65957900ec33772dca25a3066f
Author: Phil Frost <phil@postmates.com>
Date:   Tue Aug 6 13:08:06 2019 -0400

    Fix seconds reported by schedstat (#1426)

    Upstream bugfix: https://github.com/prometheus/procfs/pull/191

    Signed-off-by: Phil Frost <phil@postmates.com>

commit ac9a059ae81fa31f9963614483af3b5e3bfd672c
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sun Aug 4 20:15:36 2019 +0200

    Try to make it work for PowerPC

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit c81acf3b009e8538783489d1468f33faf65d8b01
Merge: c064116 75462bf
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sun Aug 4 20:14:16 2019 +0200

    Merge remote-tracking branch 'upstream/master' into power_supply_class

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit c0641162c3a432f29df30c8d0632a7756d7d2bff
Merge: 06f6e3e 0b710bb
Author: Sven Haardiek <sven@haardiek.de>
Date:   Fri Aug 2 18:30:28 2019 +0200

    Merge branch 'master' into power_supply_class

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 06f6e3e8b2a9b2e3f345b6d312a777731bb4b403
Author: Sven Haardiek <sven.haardiek@iotec-gmbh.de>
Date:   Fri Mar 22 15:36:03 2019 +0100

    Fix Pull Request comments

    * concise metric conditions
    * combine info about power supply to one metric

    Signed-off-by: Sven Haardiek <sven.haardiek@iotec-gmbh.de>

commit 785c3735c4626de56f8341f800ab7bb5e2594d08
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sat Mar 9 18:47:52 2019 +0100

    Use sys.ttar instead of uploading the files

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit e07bff5d938457147b9009aef7d42d763018cd66
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sat Mar 9 18:34:50 2019 +0100

    Add information about from /sys/class/power_supply

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 55b3e34840c9dfc6513ae8e69b6479d5842a3091
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sat Mar 9 18:09:45 2019 +0100

    Use cyclecount instead of cycle_count since it is a gauge

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 602350b333cf9353d2cd0ffd40206c96ffe29941
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sat Mar 9 18:09:25 2019 +0100

    other build options

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 5aa38f678451d5b63ffdc32336345a1ff6703725
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sat Mar 9 18:08:56 2019 +0100

    Update fixtures

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit c6acc474a4224b8d9f7b178d0d2e02636d8629ea
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sat Mar 9 17:20:30 2019 +0100

    Update command line parameter flag

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit f5a329e6ae5ed3b16aa866d67b944f1a73edfe42
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sat Mar 9 17:20:06 2019 +0100

    Update procfs dependency

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 38d5fa5165643d6a44dc863b3a1696774259ac0d
Merge: 5a7ce69 28f3582
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sat Mar 9 16:28:29 2019 +0100

    Merge branch 'power_supply_class' of github.com:shaardie/node_exporter into power_supply_class

commit 5a7ce69505079c9c090e44448cfbd7ffb2b04df7
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sat Oct 20 18:55:49 2018 +0200

    Updated Metrics of Power Supply Class

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 690ab1b9c1f2e183b7088cf81c7f266d85ee6df6
Author: Sven Haardiek <sven@haardiek.de>
Date:   Fri Oct 19 20:03:42 2018 +0200

    Start work on Power Supply Collector

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 28f358222bbac4315fbf44d94da36d4b0ff2ed55
Author: Sven Haardiek <sven@haardiek.de>
Date:   Sat Oct 20 18:55:49 2018 +0200

    Updated Metrics of Power Supply Class

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

commit 751d99b818503e9a4430b10c39760f180349b294
Author: Sven Haardiek <sven@haardiek.de>
Date:   Fri Oct 19 20:03:42 2018 +0200

    Start work on Power Supply Collector

    Signed-off-by: Sven Haardiek <sven@haardiek.de>

Signed-off-by: Sven Haardiek <sven@haardiek.de>
2019-10-27 16:03:35 +01:00
Ben Kochie 74a90e81c0
Merge pull request #1486 from mknapphrt/mount_timeout
Add a flag to adjust mount timeout
2019-10-23 13:34:18 +02:00
Mark Knapp c9603c6ea2 Add a flag to adjust mount timeout
Signed-off-by: Mark Knapp <mknapp@hudson-trading.com>
2019-10-22 14:47:59 -04:00
John Belmonte 15e36e2230 fix typo in cpufreq metric names (#1510)
Signed-off-by: John Belmonte <john@neggie.net>
2019-10-11 02:12:20 +09:00
Ben Kochie fb54f7f2e0
Merge pull request #1489 from pgier/cpuinfo
add node_cpu_info metric
2019-10-08 14:58:11 +02:00
Matt Layher ce693648d3
collector: clean up DRBD collector, less global state
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-10-04 10:40:18 -04:00
Matt Layher a1659da2e7
collector: remove commented-out import from bcache collector
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-10-01 11:47:25 -04:00
Paul Gier 4d72cb8059 add node_cpu_info metric
Contains information gathered from /proc/cpuinfo

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-09-25 14:38:57 -05:00
Benjamin Drung 27b8c93a5a Use InfiniBandClass from procfs library (#1396)
Parsing the sysfs files for InfiniBand was added to the procfs library
(see https://github.com/prometheus/procfs/pull/164).

Therefore use `InfiniBandClass` from the procfs library instead of
parsing sysfs itself.

If the port counter return `N/A (no PMA)` no metric will be returned
(instead of returning 0 for this metric.

Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
2019-09-23 18:18:35 +02:00
Ben Kochie 82b7b1f732
Merge branch 'master' into coolingDevice 2019-09-09 17:44:03 +02:00
dt-rush 93fbb93a46 fix issue where rootfs path strips to the empty string (#1464)
Change-type: patch
Connects-to: #1463
Signed-off-by: dt-rush <nickp@balena.io>
2019-09-09 17:39:24 +02:00
Paul Gier 8c3de12c22 systemd: check version for availability of properties (#1413)
The dbus property 'SystemState' and the timer property 'LastTriggerUSec'
were added in version 212 of systemd.
Check that the version of systemd is higher than 212 before attempting
to query these properties

f755e3b74b
dedabea4b3

Resolves issue #291

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-09-04 16:27:25 +02:00
Alex Schmitz 664025d60c
Scrape cooling_device state
Signed-off-by: Alex Schmitz <alex.schmitz@gmail.com>
2019-08-30 08:58:47 -05:00
Boris Momčilović 93c12e03a1 Ipvs firewall mark (#1455)
* IPVS: include firewall mark label

Signed-off-by: Boris Momčilović <boris@firstbeatmedia.com>
2019-08-27 14:24:11 +02:00
Phil Frost 26d4fbdf07 Fix seconds reported by schedstat (#1426)
Upstream bugfix: https://github.com/prometheus/procfs/pull/191

Signed-off-by: Phil Frost <phil@postmates.com>
2019-08-06 19:08:06 +02:00
Richard Kojedzinszky 75462bf4fe Scrape thermal_zone temperatures (#1425)
* Scrape thermal_zone temperatures

Signed-off-by: Richard Kojedzinszky <richard@kojedz.in>
2019-08-04 12:56:36 +02:00
Philip Gough 2d95ecaa96 Extends uname collector to export on Darwin OS (#1433)
Adds uname collector support for Darwin and OpenBSD

Signed-off-by: Philip Gough <philip.p.gough@gmail.com>
2019-08-03 12:32:43 +02:00
Dipack P Panjabi a7452023db Added mountinfo changes to node_exporter (#1417)
Use the extra information gleaned from the mountinfo file to add
a 'mountaddr' field for NFS metrics. This helps prevent prometheus from
ignoring mounts that come from the same URL, but are actually from
different IP addresses.

This commit also rebases to current master

Signed-off-by: Dipack P Panjabi <dpanjabi@hudson-trading.com>
2019-07-28 11:32:40 +02:00
Matthias Rampke b133213c7a Report non-fatal collection errors in the exporter metric. (#1439)
As per prometheus/client_golang#543, pass the Registry for exporter
metrics when setting up the /metrics HTTP handler.

With this, the `promhttp_metric_handler_errors_total` metric will
increment on (possibly non-fatal) collection-time errors, such as
duplicate metrics from text files.

Signed-off-by: Matthias Rampke <mr@soundcloud.com>
2019-07-28 10:37:10 +02:00
dt-rush 5d3e2ce2ef properly strip path.rootfs from mountpoint labels (#1421)
Change-type: patch
Connects-to: #1418
Signed-off-by: dt-rush <nickp@balena.io>
2019-07-19 16:51:17 +02:00
Steven Kreuzer d8e47a9f9f Expose additional XFS runtime statistics (#1423)
Include directory operation, read/write system call, and vnode runtime
statistics for XFS filesystems.

Signed-off-by: Steven Kreuzer <skreuzer@FreeBSD.org>
2019-07-15 16:28:09 +02:00
detailyang 7fe9713edf bugfix: avoid nil reference when ignore is nil (#1414)
Signed-off-by: detailyang <detailyang@gmail.com>
2019-07-12 14:23:54 +02:00
Phil Frost f693a71c06 Scrape CPU latency stats from /proc/schedstat (#1389)
These are useful as a direct indication of CPU contention and task
scheduler latency.

Handy references:
 - https://github.com/torvalds/linux/blob/master/Documentation/scheduler/sched-stats.txt
 - https://doc.opensuse.org/documentation/leap/tuning/html/book.sle.tuning/cha.tuning.taskscheduler.html

procfs is updated to pull in the enabling change:
https://github.com/prometheus/procfs/pull/186

Signed-off-by: Phil Frost <phil@postmates.com>
2019-07-10 09:16:24 +02:00
秋葉 777b751f90 read /proc/net files with a single read syscall (#1380)
Signed-off-by: Hanaasagi <ambiguous404@gmail.com>
2019-07-08 15:53:14 +02:00
Derek Marcotte 3d504bc5cb Added FreeBSD zfs support per #1063. (#1394)
Based on the solaris implementation.  There's a lot of other sysctls
available on FreeBSD that aren't reported here.  It'll be easy to add,
if they're useful.  All of the sysctls are uint64.

Signed-off-by: Derek Marcotte <554b8425@razorfever.net>
2019-07-03 15:47:39 +02:00
Advait Bhatwadekar 3f49b31101 Closes issue #261 on node_exporter. (#1403)
* Closes issue #261 on node_exporter.

Delegated mdstat parsing to procfs project. mdadm_linux.go now only exports the metrics.
-> Added disk labels: "fail", "spare", "active" to indicate disk status
-> hanged metric node_md_disks_total ==> node_md_disks_required
-> Removed test cases for mdadm_linux.go, as the functionality they tested for has been moved to procfs project.

Signed-off-by: Advait Bhatwadekar <advait123@ymail.com>
2019-07-01 11:56:06 +02:00
Ben Kochie ccf27426ad
Fix 64k page e2e fixture (#1404)
Update for change in https://github.com/prometheus/node_exporter/pull/1224

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-06-28 09:53:35 +02:00
mknapphrt 3108a50fb6 Fix systemd restart counter label from state to name (#1393)
Signed-off-by: Mark Knapp <mknapp@hudson-trading.com>
2019-06-25 09:37:48 +02:00
Leonid Evdokimov 22a7dbae08 Ignore iso9600 filesystem on Linux (#1355)
The filesystem is read-only and is often used for a virtual FS
with a configuration file for a virtual machine.

Signed-off-by: Leonid Evdokimov <leon@darkk.net.ru>
2019-06-18 17:47:05 +01:00
Paul Gier 2bc133cd48 update procfs to v0.0.2 (#1376)
Signed-off-by: Paul Gier <pgier@redhat.com>
2019-06-12 20:47:16 +02:00
Ben Kochie 8146998945
Fix rollover bug in mountstats collector (#1364)
* Update procfs vendor to pull in github.com/prometheus/procfs/pull/165
* Update mountstats collector to use new types.
* Rollover counter automatically to avoid float64 accuracy issues.
* Update e2e test.

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-05-31 18:30:37 +02:00
Noam Meltzer 501ccf9fb4 Add --collector.netdev.device-whitelist flag (#1279)
* Add --collector.netdev.device-whitelist flag

Sometimes it is desired to monitor only one netdev. The golang regexp
does not support a negated regex, so the ignored-devices flag is too
cumbersome for this task.
This change introduces a new flag: accept-devices, which is mutually
exclusive to ignored-devices. This flag allows specifying ONLY the
netdev you'd like.

Signed-off-by: Noam Meltzer <noam@cynerio.co>
2019-05-31 17:55:50 +02:00
David O'Rourke 814ef064c0 meminfo: Fix the size mismatch in the swapTotal check mib for BSD. (#1345)
Signed-off-by: David O'Rourke <david.orourke@gmail.com>
2019-05-14 17:42:36 -05:00
Ben Kochie f10c665d33
Cleanup uname Update call (#1342)
Make collector a pointer for consistency.

Fixes: https://github.com/prometheus/node_exporter/issues/1300

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-05-13 11:44:12 -05:00
Paul Gier 8b13c130b7 log pid when there is a problem reading the process stats (#1341)
Signed-off-by: Paul Gier <pgier@redhat.com>
2019-05-10 13:04:26 -05:00
Paul Gier d0a66c4c40 use sys/unix package instead of syscall (#1340)
According to the golang docs, the syscall package is deprecated.
https://golang.org/pkg/syscall
This updates collectors to use the x/sys/unix package instead.
Also updates the vendored x/sys/unix module to latest.

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-05-10 13:04:06 -05:00
Daniel Hodges 7882009870 Add perf exporter (#1274)
Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2019-05-07 13:21:41 +02:00
Paul Gier 86f9079429 update procfs to latest (#1335)
Updates for procfs refactoring

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-05-07 06:38:21 +02:00
Ben Kochie 78b9eb9c2c Use 64-bit Darwin netstat counters (#1319)
Avoid 32-bit counter rollovers.

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-04-25 10:07:56 +02:00
Christian Hoffmann 36e3b2a923 textfile: use opened file's mtime as timestamp (#1326)
Previously, the node_textfile_mtime_seconds metric was based on the
Fileinfo.ModTime() of the ioutil.ReadDir() return value. This is based
on lstat() and therefore has unintended consequences for symlinks
(modification time of the symlink instead of the symlink target is
returned). It is also racy as the lstat() is performed before reading
the file.

This commit changes the node_textfile_mtime_seconds metric to be based
on a fresh Stat() call on the open file.  This eliminates the race and
works as expected for symlinks. Fixes #1324.

Signed-off-by: Christian Hoffmann <mail@hoffmann-christian.info>
2019-04-18 17:47:04 +02:00
Daniele Sluijters cc2fd82008 Expose /proc/pressure (#1261)
This enables the collection of pressure stall information as exposed
by the `/proc/pressure` interface added in the 4.20 release of the
Linux kernel.

Closes #1174

Signed-off-by: Daniele Sluijters <daenney@users.noreply.github.com>
2019-04-18 12:19:20 +02:00
Paul Gier b1298677aa Early init of procfs (#1315)
Minor change to match naming convention in other collectors.

Initialize the proc or sys FS instance once while initializing
each collector instead of re-creating for each metric update.

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-04-10 18:16:12 +02:00
Paul Gier cc847f2f44 collector/cpu: split cpu freq metrics into separate collector (#1253)
The cpu frequency information is not always needed and/or available.
This change allows the cpu frequency metrics to be enabled/disabled
separately from the other cpu metrics, and also prevents a frequency
metric failure (such as a parse error) from failing the main cpu
collector.

Fixes #1241

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-02-19 17:22:54 +01:00
Ben Kochie f028b81615
Update systemd blacklist (#1255)
Include additional unit types in the default systemd collector
blacklist.

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-02-17 17:57:15 +01:00
Paul Gier cb9e23c536 Systemd refactor (#1254)
This reduces the system metric collection time by using a wait group
and go routines to allow the systemd metric calls happen concurrently.

Also, makes the start time, restarts, tasks_max, and tasks_current metrics disabled by default
because these can be time consuming to gather.

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-02-11 23:27:21 +01:00
Sachi King 18fc512fc4 Bond: Monitor bond mii_status not link operstate (#1124)
With a bond interface the state of the slave interface from the bond's
point of view is reflected in `mii_status` and is independent of the
link's `operstate`.

When a bond is monitored with `miimon`, `mii_status` will reflect the
state of the physical link as configured via the operator.

When a bond is monitored via `arp_interval` the `mii_status` will
reflect the results of the bond ARP checking.  This means the link can
be down from the bond's point of view, but up from a physical
connection point of view.

If a bond is not monitored via miimon or arp, the `mii_status` should
likely be always `up`, however I have observed a case where this is not
true and the `operstate` is `up` while `mii_status` is `down`.  Kernel
bond documentation stresses that a bond should not be configured without
one of `mii_mon` or `arp_interval` configured however.

This change results in the metric 'node_bonding_active' matching the
up/down state of the bond's point of view rather than operstate.

Signed-off-by: Sachi King <nakato@nakato.io>
2019-02-10 11:00:04 +01:00
Paul Gier e0d6d11859 netclass_linux: remove varying labels from the 'up' metric (#1243)
* netclass_linux: remove varying labels from the 'up' metric

This moves the variable label values such as 'operstate' out of
the 'network_up' metric and into a separate metric called '_info'.
This allows the 'up' metric to remain continous over state changes.
Fixes #1236

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-02-07 15:59:32 +01:00
Johannes 'fish' Ziemke 6ea0aa73e4 Rename interface to device in netclass collector (#1224)
* Rename interface to device in netclass collector

This makes it consistent with other networking metrics like node_network_receive_bytes_total

This closes #1223 

Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org>
2019-02-06 20:02:48 +01:00
Ralf Horstmann 3867ad5ab0 Add diskstats collector for OpenBSD (#1250)
* Add diskstats collector for OpenBSD

Tested on i386 and amd64, OpenBSD 6.4 and -current.

* Refactor diskstats collectors

This moves common descriptors from Linux, Darwin, OpenBSD
diskstats collectors into diskstats_common.go

Signed-off-by: Ralf Horstmann <ralf+github@ackstorm.de>
2019-02-06 11:36:22 +01:00
David O'Rourke d442108d7a collector: Implement uname collector for FreeBSD (#1239)
* collector: Implement uname collector for FreeBSD

Signed-off-by: David O'Rourke <david.orourke@gmail.com>
2019-02-05 17:39:24 +01:00
Paul Gier 2b81bff518 collector: use path/filepath for handling file paths (#1245)
Similar to #1228.  Update the remaining collectors to use
'path/filepath' intead of 'path' for manipulating file paths.

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-02-05 16:37:27 +01:00
Ralf Horstmann dda51ad06a Fix staticcheck ST1003 warnings (#1249)
This fixes a few staticcheck ST1003 warnings in OpenBSD CPU
collector. No functional change.

Signed-off-by: Ralf Horstmann <ralf+github@ackstorm.de>
2019-02-05 07:46:50 +01:00
mknapphrt 7fbdd0ae93 Update procfs vendor (#1248)
Signed-off-by: Mark Knapp <mknapp@hudson-trading.com>
2019-02-04 16:54:41 +01:00
Paul Gier 40dce45d8d collector/systemd: add new label "type" for systemd_unit_state (#1229)
Adds a new label called "type" systemd_unit_state which contains the
Type field from the unit file.  This applies only to the .service and
.mount unit types.  The other unit types do not include the optional
type field.

Fixes #1210

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-01-29 23:54:47 +01:00
Matt Layher 3b5c2f6463 collector: use path/filepath for handling file paths (#1228)
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-01-21 17:44:55 +01:00
Jon Davies e766485286 Add kstat-based Solaris metrics (#1197)
* collector/loadavg_solaris.go: Use libkstat to gather load averages.
* go.mod: Added go-kstat.
* boot_time_solaris.go: Added.
* cpu_solaris.go: Added.
* README.md: Updated entries for Solaris.
* collector/zfs_solaris.go: Added.
* CHANGELOG.md: Added note about kstat-based Solaris metrics.

Signed-off-by: Jonathan Davies <jpds@protonmail.com>
2019-01-12 13:33:56 +01:00
Ben Kochie 070e4b2e17 Update Makefile.common (#1220)
* Update Makefile.common

Update to new staticcheck method[0].

[0]: https://github.com/prometheus/prometheus/pull/5057

Signed-off-by: Ben Kochie <superq@gmail.com>

* Fix staticcheck errors.

Signed-off-by: Ben Kochie <superq@gmail.com>
2019-01-04 15:58:53 +00:00
Ben Kochie 73ddf5f1f7 netstat: Add TCP In/Out Segs (#1185)
* netstat: Add TCP In/Out Segs

In order to get a better idea of TCP packet loss, we need to know how
many `node_netstat_Tcp_OutSegs` there are so we can compare this to
`node_netstat_Tcp_RetransSegs`.

Signed-off-by: Ben Kochie <superq@gmail.com>

* Update fixtures

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-12-08 12:16:02 +01:00
Tariq Ibrahim 6bd51269b7 update to host_statistics64 for Darwin meminfo (#1183)
Signed-off-by: tariqibrahim <tariq181290@gmail.com>
2018-12-06 16:47:20 +01:00
Ben Kochie 4abc6fba7d
Add fallback for missing /proc/1/mounts (#1172)
* Add fallback for missing /proc/1/mounts

On some systems, `/proc/1/mounts` is hidden from non-root users due to
the `hidepid` procfs feature. Attempt to fallback to `/proc/mounts` if
`/proc/1/mounts` is not found.

Signed-off-by: Ben Kochie <superq@gmail.com>

* Add tests.

Signed-off-by: Ben Kochie <superq@gmail.com>

* Add CHANGELOG entry.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-11-30 14:01:55 +01:00
Jerome Froelich 0cb0c4d911 Remove unused variable readOnly from filesystem_linux.go. (#1173)
The pull request #1002 changed the logic used on Linux servers to determine if a filesystem is
read-only. As a result of this change, the variable `readOnly` is now unused and can be removed.

Signed-off-by: Jerome Froelich <jeromefroelich@hotmail.com>
2018-11-30 14:01:39 +01:00
Nemikolh 62f99f95f0 Add receive/transmit bytes total metric (wifi collector). (#1150)
Signed-off-by: Nemikolh <Nemikolh@users.noreply.github.com>
2018-11-19 19:15:54 +01:00
ioriveur 17fee8081f Check BSD's mib which accounts for swap size (#1149)
* Change Dfly's CPU counting frequency, see: https://github.com/prometheus/node_exporter/issues/1129

Signed-off-by: iori-yja <fivio.11235813@gmail.com>

* Convert Dfly's CPU unit into second

Signed-off-by: iori-yja <fivio.11235813@gmail.com>

* Check BSD's mib which accounts for swap size; see #1127

Signed-off-by: iori-yja <fivo.11235813@gmail.com>

* fix swap check code

Signed-off-by: iori-yja <fivo.11235813@gmail.com>
2018-11-17 11:02:54 +01:00
Arno Uhlig 6edd9d217e [systemd] collect taskCurrent, tasksMax per systemd unit (#1098)
* [systemd] collect taskCurrent, tasksMax per systemd unit

Signed-off-by: Arno Uhlig <arno.uhlig@sap.com>
2018-11-14 10:50:39 +01:00
Ben Kochie b1eec66640
Add TCPSynRetrans to netstat default filter (#1143)
Tcp SYN packet retransmits are a very useful signal as they affect
network performance disproportionately to regular TCP retransmits.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-11-07 17:21:18 +01:00
Matt Layher 073e056121
Merge pull request #1131 from prometheus/mdl-collector-export
collector: export NodeCollector for documentation purposes
2018-10-31 12:38:48 -04:00
Matt Layher c0a55e3f80 collector: add bounds check and test for filesystem collector (#1133)
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2018-10-30 22:12:42 +01:00
Patrick bdc0e7e678 Collect additional common Infiniband counters (#1120)
* Collect additional common Infiniband counters

Signed-off-by: Patrick Freeman <will.pat.free@gmail.com>
2018-10-30 21:54:09 +01:00
Paul Gier 988f049040 collector/hwmon_linux: handle temperature sensor file which doesn't have item suffix (#1123)
In some cases the file might be called "temp" instead of the usual format "temp<index>_<item>"
as described in the kernel docs: https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
In this case, treat this as an _input file containing the current temperature reading.

Fixes #1122

Signed-off-by: Paul Gier <pgier@redhat.com>
2018-10-30 18:49:22 +01:00
Paul Gier 38163f234f collector/diskstats: don't fail if there are extra stats, just ignore… (#1125)
* collector/diskstats: don't fail if there are extra stats, just ignore them

Signed-off-by: Paul Gier <pgier@redhat.com>
2018-10-30 18:45:00 +01:00
Matt Layher 778124a56c collector: add bounds check and test for tcpstat collector (#1134)
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2018-10-27 09:21:36 +02:00
Matt Layher 3d798aa4a1 collector: fix golint problems in ZFS collector (#1132)
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2018-10-27 09:18:33 +02:00
Matt Layher 2c2ee93519
collector: export NodeCollector for documentation purposes
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2018-10-26 15:42:00 -04:00
Ben Kochie a0a164defb
Update cpufreq metrics collector (#1117)
* Update Linux cpufreq collector to use new procfs library functions.
* Split thermal throttle collection to a separate function.
* Add new required fixtures and repack ttar file.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-10-18 17:28:19 +02:00
Paul Gier 7057c64f45 fix a few minor golint warnings (#1110)
Signed-off-by: Paul Gier <pgier@redhat.com>
2018-10-15 18:44:06 +02:00
Paul Gier e8d8199072 Update diskstats for linux kernel 4.19 (#1109)
The format of /proc/diskstats is changing in linux-4.19 to include some
additional fields.  See: https://www.kernel.org/doc/Documentation/iostats.txt

* collector/diskstats: use constants for some hard coded strings
* collector/diskstats: update diskstats for linux-4.19
* collector/diskstats: remove kernel doc url from individual metrics

Signed-off-by: Paul Gier <pgier@redhat.com>
2018-10-15 17:24:28 +02:00
Ben Kochie 0880d460d7
Ignore additional virtual filesystems (#1104)
Add more virtual filesystems to the default ignore list
* bpf
* cgroup2
* selinuxfs
* squashfs

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-10-12 11:24:32 +02:00
Dario Maiocchi 01ec8c5c5c Remove continue with label (#1084)
Instead of continue with label use helper function
Signed-off-by: dmaiocchi <dmaiocchi@suse.com>
2018-10-05 13:20:30 +02:00
Ben Kochie a1ce712e22
Cleanup unused /proc/mounts fixture. (#1097)
* Cleanup unused /proc/mounts fixture.
* Ignore Uint -> Unit in codespell.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-10-04 18:07:12 +02:00
Mario Trangoni 3659260b66 infiniband: Handle iWARP* RDMA modules N/A (#974)
* infiniband: Add not connected i40iw0/ports/1 fixtures
* infiniband: Handle issue when iWARP* RDMA modules are not available

This is related to #966, and handle this error,

Jun 07 13:33:24 hostname node_exporter[81888]: time="2018-06-07T13:33:24+02:00" level=error msg="ERROR: infiniband
collector failed after 0.000929s: strconv.ParseUint: parsing \"N/A (no PMA)\": invalid syntax" source="collector.go:132"

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2018-10-04 15:05:59 +02:00
Yecheng Fu 0f9842f20a [continue 912] strip rootfs prefix for run in docker (#1058)
* strip rootfs prefix for run in docker
* Use `/` as default value of path.rootfs, and parse mounts from `/proc/1/mounts`.
* No need to mount `/proc` and `/sys` because we share host's PID
namespace, which allows processes within the container to see all of the
processes on the system.

Closes: #66

Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
Signed-off-by: Yecheng Fu <cofyc.jackson@gmail.com>
2018-10-04 14:11:21 +02:00
Ralf Horstmann 9f820bd3ee Update cpu collector for OpenBSD 6.4 (#1094)
Starting with (not yet released) OpenBSD 6.4, sysctl KERN_CPTIME2 will
return ENODEV for offline CPUs.

SMT siblings are reported as offline when hw.smt is disabled, which is
the default since one of the later Spectre variants. So this might
affect a few systems.

For more details see:
https://cvsweb.openbsd.org/src/sys/kern/kern_sysctl.c#rev1.348

Signed-off-by: Ralf Horstmann <ralf+github@ackstorm.de>
2018-10-02 10:21:30 +02:00
Daniele Sluijters d999dacdc6 filesystem: Ignore netns/nsfs mounts (#1047)
When starting Docker containers a whole bunch of netns (network
namespace) mounts are created that the node exporter can't make any
sense of (and can't read either).

This ignores all nsfs filesystems.

Fixes #875

Signed-off-by: Daniele Sluijters <daenney@users.noreply.github.com>
2018-09-26 10:45:51 +02:00
Ben Kochie 0fdc089187
Change systemd unit filtering (#1083)
* Change systemd unit filtering

Get all units from systemd and filter in Go.
* Improves compatibility with older versions of systemd.
* Improve debugging by printing when units pass the filter.
* Remove extraneous newlines from log messages.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-09-24 15:04:55 +02:00
Luca Bruno 4672ea1671 collector/timex: remove cgo dependency (#1079)
This removes the cgo import from timex collector, as it was only used
to define two constants. Those are part of the Linux kernel<->userspace
interface, thus there is no need to depend on libc to source them:
https://github.com/torvalds/linux/blob/v4.18/include/uapi/linux/timex.h

Signed-off-by: Luca Bruno <luca.bruno@coreos.com>
2018-09-20 11:51:34 +02:00
Björn Rabenstein 1c9ea46cca Update vendoring for client_golang and friends (#1076)
Signed-off-by: beorn7 <beorn@soundcloud.com>
2018-09-17 17:09:52 +02:00
Ben Kochie ebdd524123
Correctly cast Darwin memory info (#1060)
* Correctly cast Darwin memory info

* Cast stats to float64 before doing math on them to avoid integer
wrapping.
* Remove invalid `_total` suffix from gauge values.
* Handle counters in `meminfo.go`.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-09-07 22:27:52 +02:00
Marco Tulio R Braga 05e55bddad Fix typo on description of read_time_seconds_total (#1057)
Fix typo on unit description of metric `*read_time_seconds_total` from milliseconds to seconds.

Signed-off-by: Marco Tulio R Braga <marco.tulio@mtulio.eng.br>
2018-09-02 09:46:45 +02:00
Dan Fredell c52e0d3353 Fix SmartOS build #1017 (#1018)
Signed-off-by: Dan Fredell <Dan.Fredell@gmail.com>
2018-08-23 10:57:15 +00:00
James Hartig 60c827231a NRestarts or NRefused aren't available on older systemd versions (#1039)
* If NRestarts or NRefused are not available, don't ignore the unit itself
* Don't report systemd metrics (NRestarts/NRefused) that are not available

Signed-off-by: James Hartig <james@getadmiral.com>
2018-08-14 14:28:26 +02:00
Ben Kochie fe5a117831
Handle vanishing PIDs (#1043)
PIDs can vanish (exit) from /proc/ between gathering the list of PIDs
and getting all of their stats.

* Ignore file not found errors.
* Explicitly count the PIDs we find.
* Cleanup some error style issues.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-08-13 17:27:23 +02:00
Ben Kochie 0662673ad6
Disable wifi collector by default (#1037)
* Disable wifi collector by default

Disable the wifi collector by default due to suspected cashing issues and goroutine leaks.
* https://github.com/prometheus/node_exporter/issues/870
* https://github.com/prometheus/node_exporter/issues/1008

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-08-07 10:27:20 +02:00
Ben Kochie 5d23ad0ca7
Fix supervisord collector (#978)
* Replace supervisord xmlrpc library
* Use `github.com/mattn/go-xmlrpc` that doesn't leak goroutines.
* Fix uptime metric

* Use Prometheus best practices for uptime metric.
  * Use "start time" rather than "uptime".
  * Don't emit a start time if the process is down.
* Add changelog entry.
* Add example compatibility rules.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-08-06 16:54:46 +02:00
Julius Volz 2c52b8c761
systemd: Remove unneeded/unhandled error returns (#1035)
Signed-off-by: Julius Volz <julius.volz@gmail.com>
2018-08-05 16:55:25 +02:00
Christian Hoffmann 6bdc5558ec build: make staticcheck happy by using real regexp patterns #1025 (#1026)
Signed-off-by: Christian Hoffmann <mail@hoffmann-christian.info>
2018-07-30 07:57:18 +02:00
Hannes Körber 14a4f0028e Enable nfs protocol (#998)
* vendor: Update prometheus/procfs

Signed-off-by: Hannes Körber <hannes.koerber@haktec.de>

* mountstats: Use new NFS protocol field

In https://github.com/prometheus/procfs/pull/100, the NFSTransportStats
struct was expanded by a field called protocol that specifies the NFS
protocol in use, either "tcp" or "udp". This commit adds the protocol as
a label to all NFS metrics exported via the mountstats collector.

Signed-off-by: Hannes Körber <hannes.koerber@haktec.de>

* Update fixtures for UDP mount

Signed-off-by: Hannes Körber <hannes.koerber@haktec.de>
2018-07-24 00:47:12 +02:00
Johannes Wienke 5c780d132c Exclude only subdirectories of /var/lib/docker (#1003)
It is quite common to put /var/lib/docker itself on a separate partition
and that should be monitored as well.

Signed-off-by: Johannes Wienke <languitar@semipol.de>
2018-07-23 15:43:42 +02:00
Ben Kochie 23f95c8e04
Fix ntp collector thread safety (#1014)
Make the ntp collector thread safe by wrapping a mutex lock around the
leapMidnight variable.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-07-22 14:36:33 +02:00
xginn8 140b8b85c3 Filter out uninstalled systemd units when collecting all units (#1011)
fixes #567

Signed-off-by: Matthew McGinn <mamcgi@gmail.com>
2018-07-22 09:20:03 +02:00
Sven Lange 2ae8c1c7a7 Add systemd uptime metric collection (#952)
* Add systemd uptime metric collection

Signed-off-by: Sven Lange <tdl@hadiko.de>
2018-07-18 16:02:05 +02:00
neiledgar 7e4d9bd150 Update wifi stats to support multiple stations (#977) (#980)
Signed-off-by: neiledgar <neil.edgar@btinternet.com>
2018-07-16 16:02:25 +02:00
xginn8 9b97f44a70 Add a counter for refused socket unit connections, available as of systemd 239 (#995)
Signed-off-by: xginn8 <mamcgi@gmail.com>
2018-07-16 16:01:42 +02:00
Brandon Gilmore 76bbd8dd18 Use /proc/mounts instead of statfs(2) for ro state (#1002)
While the statfs(2) approach is reliable for normally mounted filesystems, the
flags returned can be inconsistent when filesystem has been remounted read-only
after encountering an error. The returned flags do accurately represent the
internal state of the filesystem, but they do not reflect whether the VFS layer
will accept writes. Instead, it makes sense to parse the current VFS mount
state from the options field in /proc/mounts since it takes precedence.

Signed-off-by: Brandon Gilmore <bgilmore@valvesoftware.com>
2018-07-16 15:56:27 +02:00
Jan Klat c4102f1175 Add sys/class/net parsing from procfs and expose its metrics (#851)
* add sys/class/net parsing from procfs and expose its metrics

Signed-off-by: Jan Klat <jenik@klatys.cz>

* change code to use int pointers per procfs change, move netclass to separate collector, change metric naming

Signed-off-by: Jan Klat <jenik@klatys.cz>

* bump year in licence, remove redundant newline, correct fixtures

Signed-off-by: Jan Klat <jenik@klatys.cz>

* fix style

Signed-off-by: Jan Klat <jenik@klatys.cz>

* change carrier changes to counter type

Signed-off-by: Jan Klat <jenik@klatys.cz>

* fix e2e output

Signed-off-by: Jan Klat <jenik@klatys.cz>

* add fixtures

Signed-off-by: Jan Klat <jenik@klatys.cz>

* update vendor, use fixtures correctly

Signed-off-by: Jan Klat <jenik@klatys.cz>

* change fixtures (device in /sys/class/net should be symlinked)

Signed-off-by: Jan Klat <jenik@klatys.cz>

* correct fixtures for 64k page, updated readme

Signed-off-by: Jan Klat <jenik@klatys.cz>
2018-07-16 15:08:18 +02:00
mknapphrt 09b4305090 Changed the way that stuck mounts are handled. If a mount fails to return, it will stop being queried until it returns. (#997)
Fixed spelling mistakes.

Update transport_generic.go

Changed to a mutex approach instead of channels and added a timeout before declaring a mount stuck.

Removed unnecessary lock channel and clarified some var names.

Fixed style nits.

Signed-off-by: Mark Knapp <mknapp@hudson-trading.com>
2018-07-14 11:10:28 +02:00
xginn8 ac5a981761 Adding socket stat collection for systemd socket units (#968)
Signed-off-by: xginn8 <mamcgi@gmail.com>
2018-07-05 16:26:48 +02:00
xginn8 8af84a215d Add support for NRestarts counter introduced in systemd 235 (#992)
* Add support for NRestarts counter introduced in systemd 235

`.service` units increment this counter any time the Restart= condition is
triggered.

Signed-off-by: Matthew McGinn <mamcgi@gmail.com>
2018-07-05 13:31:45 +02:00
Ben Kochie 107e5dfecc
Fix mdadm collector issues (#985)
* Send "Personality unknown" to debug, not info, remove unnecessary newline.
* Add support for "linear" personality.
* Always set number of active disks to 0 when a device is inactive.
* Add total disks calculation to unknown personalites.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-07-02 12:38:20 +02:00
Derek Marcotte 2678d68dcc Fix for #945, cpu temperature is signed. (#965)
* Fix for #945, cpu temperature is signed.

Added a type conversion to cpu temperature sysctl.  Will still
collect/report -1 when the value is -1, this is because it should be up
to interpretation whether this is the correct value for the system or
not.

Some drivers will report -1 for cpu temperature.  Other sensors will
report "an input into the fan control algorithm", i.e. not the actual
temperature, but how much fan it wants.  Some people cool their machines
with liquid nitrogen.

Signed-off-by: Derek Marcotte <554b8425@razorfever.net>
2018-06-07 15:01:25 +02:00
Brad Beam e3cf1d5187 Adding support for evaluating octal characters in mountpoint (#954)
Signed-off-by: Brad Beam <brad.beam@b-rad.info>
2018-06-06 16:49:19 +02:00
Pavlo Kutishchev 456bf5094a Add processes exporter (#950)
* Add processes exporter

Signed-off-by: Pavel Kutishchev <pavel.kutishchev@olx.com>
Signed-off-by: Ben Kochie <superq@gmail.com>
2018-06-05 19:38:32 +02:00
Alexey Kopytov dd98a09bb2 A couple of ARM64-related fixes (#934)
* Do not rely on AArch64 CPUs to support 32-bit ARM for cross-testing.

Signed-off-by: Alexey Kopytov <akopytov@gmail.com>

* aarch64 like ppc64le reports 64k node_sockstat_TCP_mem_bytes due to 64k pages.

Signed-off-by: Alexey Kopytov <akopytov@gmail.com>
2018-05-14 15:55:49 +02:00
Steve Kotsopoulos 84dc362b05 Align Darwin disk stat names with Linux (#930)
Signed-off-by: Steve Kotsopoulos <sk@fywss.com>
2018-05-02 11:32:55 +02:00
Mario Trangoni 24a28fcc9e Remove unused func, var, and const (#928)
Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2018-04-29 14:35:43 +02:00
Mario Trangoni c9f421d0dd Fix some golint issues (#927)
* collector/cpu_*: rename nodeCpuSecondsDesc to nodeCPUSecondsDesc

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* collector/qdisc_linux.go: add NewQdiscStatCollector comment

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* collector/cpu_linux.go: rename core_map to coreMap

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2018-04-29 14:34:47 +02:00
Ben Kochie 361b5bf85d
Merge pull request #852 from prometheus/remove-gmond
Remove gmond collector
2018-04-27 10:02:16 +02:00
Ben Kochie b10ca77680
Fix /proc/net/dev/ interface name handling
* Allow any character (UTF-8) for Linux interface names.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-04-18 12:53:59 +02:00
Ben Kochie 1ab4a460c7 Update ppc64le end-to-end fixture.
Signed-off-by: Ben Kochie <superq@gmail.com>
2018-04-18 09:12:21 +02:00
Johannes 'fish' Ziemke fd66a86a30 Remove gmond collector
Signed-off-by: Johannes 'fish' Ziemke <github@freigeist.org>
2018-04-17 20:20:24 +02:00
Ben Kochie 0f5be132ac
Merge pull request #904 from prometheus/superq/if_alias
Fix parsing of interface aliases in netdev linux
2018-04-17 13:37:21 +02:00
Ben Kochie a528966dcd Fix parsing of interface aliases in netdev linux
Very old kernels expose interface aliases as `foo0:0`, adjust the line
parsing to handle these names.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-04-17 13:15:02 +02:00
Ben Kochie f6008b242b
Merge pull request #901 from mischief/bsd_boottime
collector: implement node_boot_time_seconds for OpenBSD/NetBSD/Darwin
2018-04-17 07:48:39 +02:00
Jürgen Hötzel de0632c2e9 Fix memory corruption when number of filesystems > 16 (#900)
Signed-off-by: Juergen Hoetzel <juergen@archlinux.org>
2018-04-16 12:39:15 +02:00
mischief 26a385d7ab collector: implement node_boot_time_seconds for OpenBSD/NetBSD/Darwin
Signed-off-by: mischief <mischief@offblast.org>
2018-04-15 08:26:46 +00:00
Ben Kochie 015b86670a
Update ppc64le e2e output.
Signed-off-by: Ben Kochie <superq@gmail.com>
2018-04-14 15:28:06 +02:00
Ben Kochie 0507b0c9a2
Fix formatting.
Signed-off-by: Ben Kochie <superq@gmail.com>
2018-04-14 15:02:20 +02:00
Dmitriy Lukyanchikov eddd1b9357 Fix netdev collector for linux (#890)
fix variable name, fix transmitHeader extracting
modify fixtures to run tests with updated netdev_linux collector

Signed-off-by: dmitriy-lukyanchikov <d.lukyanchikov@anchorfree.com>
2018-04-14 13:58:56 +02:00
Derek Marcotte fe86e908da Update ppc64 fixtures to unbreak end-to-end.
efc1fdb added new labels.

Signed-off-by: Derek Marcotte <554b8425@razorfever.net>
2018-04-13 06:33:38 -04:00
Karsten Weiss 7e392e6634 Fix spelling mistakes found by codespell
Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-09 18:27:17 +02:00
Karsten Weiss efc1fdb6d0 cpu: Add a 2nd label 'package' to metric node_cpu_core_throttles_total (#871)
* cpu: Add a 2nd label 'package' to metric node_cpu_core_throttles_total

This commit fixes the node_cpu_core_throttles_total metrics on
multi-socket systems as the core_ids are the same for each package.
I.e. we need to count them seperately.

Rename the node_package_throttles_total metric label `node` to `package`.

Reorganize the sys.ttar archive and use the same symlinks as the Linux
kernel. Also, the new fixtures now use a dual-socket dual-core cpu w/o
HT/SMT (node0: cpu0+1, node1: cpu2+3) as well as processor-less
(memory-only) NUMA node 'node2' (this is a very rare case).

Signed-off-by: Karsten Weiss <knweiss@gmail.com>

* cpu: Use the direct /sys path to the cpu files.

Use the direct path /sys/devices/system/cpu/cpu[0-9]* (without symlinks)
instead of /sys/bus/cpu/devices/cpu[0-9]*.

The latter path also does not exist e.g. on RHEL 6.9's kernel.

Signed-off-by: Karsten Weiss <knweiss@gmail.com>

* cpu: Reverse core+package throttle processing order

Signed-off-by: Karsten Weiss <knweiss@gmail.com>

* cpu: Add documentation URLs

Signed-off-by: Karsten Weiss <knweiss@gmail.com>
2018-04-09 18:01:52 +02:00
Brian Brazil 31ce32f1fe
Greatly trim what netstat collector exposes by default (#876)
Netstat is 40% of the metrics on my laptop, many of which
are highly detailed information about IP internals in the kernel.
~300 such metrics on every machine in your fleet is excessive,
so focus on key metrics by default, overridable by the user.

Fixes #515

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2018-03-30 19:28:08 +01:00
Ben Kochie cf3edadcbb Update fixtures
* Add oom_kill to fixture.
* Update e2e outputs.
* Put regexp in order.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-03-29 22:00:02 +01:00
Brian Brazil 499c342fed Greatly reduce the metrics vmstat returns by default.
Vmstat has over 100 fields, most of which are highly
detailed debug information. Trim this down to only
essential fields by default, configurable by flag.

Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2018-03-29 22:00:02 +01:00
Brian Brazil c8c144587e
Enable bonding collector by default. (#872)
Signed-off-by: Brian Brazil <brian.brazil@robustperception.io>
2018-03-29 15:18:12 +01:00
Ben Kochie 779090db7e
Update ppc64le fixture (#867)
Update to match standard e2e output.

Signed-off-by: Ben Kochie <superq@gmail.com>
2018-03-27 17:05:20 +02:00
Mario Trangoni 1f11a86d59 Fix nfs golint issues (#863)
* procfs: update vendoring

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* procfs: fix e2e tests after nfs changes

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>
2018-03-22 22:25:37 +01:00
Ben Kochie 7b720df1c5
Use lowercase cpu label name in interrupts (#849)
To match other CPU related metric labels, use a lowercase named label.
2018-03-08 15:04:49 +01:00
Johannes 'fish' Ziemke 424ca8e322 Drop exec_ in boot_timestamp_seconds on *bsd (#839)
This closes #827.
2018-03-08 12:59:48 +01:00
colmbuckley 098f975b48 Correct the ClocksPerSec scaling factor on Darwin (#846)
* Update cpu_darwin.go

Change the definition of ClocksPerSec to read from limits.h

* Update cpu_darwin.go
2018-03-07 11:56:57 +01:00
Julius Volz 864a6ee935 Treat custom textfile metric timestamps as errors (#769)
This is clearer behavior and users will notice and fix their textfiles faster
than if we just output a warning.
2018-02-27 19:43:38 +01:00
Rene Treffer c504c7e264 Only report core throttles per core, not per cpu (#836)
* Only report core throttles per core, not per cpu

* Add topology/core_id to the cpu sysfs fixtures

* Add new cpu fixtures to ttar file

* Merge core_id reading and thermal throttle accounting

* Declare core_id
2018-02-27 19:43:15 +01:00
Ben Kochie e0d54a509c
Cleanup NFS metrics (#834)
* Cleanup NFS metrics

* Update `nfs` metric names to match `nfsd`.
* Remove uneeded `tcp` label from TCP connections metric.
* Remove uneeded `v` on `nfsd` metrics.
* Enable all `nfs` v4 client metrics.
* Remove `nfs` metric name overrides.

* Add ppc64le fixture.

* Fix typo.
2018-02-21 07:25:41 +01:00
Ben Kochie 3f41a2fecb
Update ppc64le fixture (#832)
Updates fixture for ppc64le arch to latest output.
2018-02-19 20:43:33 +01:00
Ben Kochie d33a447047
Remove deprecated prometheus.InstrumentHandlerFunc (#831)
Update Prometheus client golang use to use `promhttp.Handler()` instead
of `prometheus.InstrumentHandlerFunc()`.
2018-02-19 15:44:59 +01:00
Richard Elling d7348a5c78 updates for zfsonlinux 0.7.5 (#779)
* updates for zfsonlinux 0.7.5

* add constants for KSTAT_DATA_* types

* added e2e test for negative values represented by uint64 that can result from ZFS bugs
2018-02-16 15:46:31 +01:00
Ben Kochie 6468e7c80b
Enable NFS client metrics by default. (#828)
Enable NFS client metrics by default now that it nolonger prints errors
on scrape if there are no metrics to display.

Also fixup the nfsd README to match the nfs entry.
2018-02-16 15:42:47 +01:00
Ralf Horstmann 8d9c7ca659 Use swpginuse instead of swpgonly in meminfo_openbsd (#813)
All tools in OpenBSD base system use swpginuse instead of swpgonly
for reporting swap usage (snmpd, swapctl, top, vmstat), so let
memory collector use that as well for consistency.
2018-02-16 11:34:41 +01:00
Kasinath Kottukkal f6965e1812 Add overlay to defIgnoredFSTypes (#824)
* Add overlay to defIgnoredFSTypes

To avoid statfs() errors if node_exporter is running as non privileged user.

* Updated defIngoredFSTypes values in sorted order
2018-02-16 09:47:50 +01:00
Ben Kochie 01bd99fb1a
Refactor NFS client collector (#816)
* Update vendor github.com/prometheus/procfs/...

* Refactor NFS collector

Use new procfs library to parse NFS client stats.

* Ignore nfs proc file not existing.

* Refactor with reflection to walk the structs.
2018-02-15 13:40:38 +01:00
Brian Brazil 52c031890e
Add _seconds suffix to node_time. (#823) 2018-02-14 16:59:08 +00:00
Ben Kochie 05eabe60fb
Fix error output in nfsd collector. (#821) 2018-02-14 13:57:35 +01:00
Ben Kochie 3de2542d21
Fix NFSd metric type (#819)
RPC Count should be a counter, not a gauge.
2018-02-13 17:03:22 +01:00
Matt Layher 544488ddd6 Fix remaining metric naming issues (#799) 2018-02-12 18:53:31 +01:00
Ben Kochie 6a041692ed
Add NFS Server metrics collector. (#803)
* Add NFS Server metrics collector.

* Add File Handles metrics.

* Add nfsd IO stats.

* Add metrics for NFSd threads.

* Add metrics for NFSd read ahead cache.

* Add NFSd network traffic counters.

* Add RPC metrics.

* Add V2 requests metrics.

* Add NFSv3 metrics.

* Add NFSv4 metrics.

* Update reply cache comment.

* Update help text.
2018-02-12 17:56:05 +01:00
Brian Brazil 1072f2868d Fix log level regression in #533 2018-02-07 15:16:20 +00:00
Brian Brazil 7e41a2b279 Ignore /var/lib/docker by default. (#814)
The node exporter runs unprivileged, so it cannot statfs any filesystems
under this directory causing log spam.  In addition there tends to be
high churn in the filesystems here (as it's basically application
monitoring) which can cause high cardinaltiy and in one case caused
Prometheus's index symbol table to get very large.
Accordingly this should be ignored to reduce log spam and avoid
performance issues. The filesystems themselves can in principle be
monitored via container oriented exporters, and the underlying
filesystems will still be monitored.
2018-02-06 17:10:59 +01:00
Ralf Horstmann 29ac809e48 Use unified CPU metric description on OpenBSD (#810) 2018-02-01 23:59:19 +01:00
Derek Marcotte fde5d2c6c9 Remove unsafe typecasts from sysctl_bsd getStructTimeval. (#741)
There is a simpler way.
2018-02-01 18:43:40 +01:00
Ben Kochie 14d60958d6
Unify CPU collector conventions (#806)
* Unify CPU collector conventions

Add a common CPU metric description.
* All collectors use the same `nodeCpuSecondsDesc`.
* All collectors drop the `cpu` prefix for `cpu` label values.

* Fix subsystem string in cpu_freebsd.

* Fix Linux CPU freq label names.
2018-02-01 18:42:20 +01:00
Ralf Horstmann e3c76b1f0c Add OpenBSD CPU collector (#805) 2018-02-01 18:33:49 +01:00
Tom Wilkie 6833eec187 Fix tests. 2018-01-31 15:22:17 +00:00
Tom Wilkie 0316bacceb Only use one dbus connection, required some refactoring. 2018-01-31 15:19:18 +00:00
Tom Wilkie a7fd6b8743 Export systemd timer last trigger sec. 2018-01-31 15:07:04 +00:00
Ben Kochie 111e3af437
Remove obsolete megacli collector. (#798)
This collector has been replaced by the textfile collector tool
`storcli.py`.
2018-01-23 11:25:42 +01:00
Julius Volz 6cac74f0e0
Add unit suffix to textfile collector mtime metric (#796) 2018-01-22 14:02:19 +01:00
Brian Brazil a98067a294 Make metrics better follow guidelines (#787)
* Improve stat linux metric names.

cpu is no longer used.

* node_cpu -> node_cpu_seconds_total for Linux

* Improve filesystem metric names with units

* Improve units and names of linux disk stats

Remove sector metrics, the bytes metrics cover those already.

* Infiniband counters should end in _total

* Improve timex metric names, convert to more normal units.

See
3c073991eb/kernel/time/ntp.c (L909)
for what stabil means, looks like a moving average of some form.

* Update test fixture

* For meminfo metrics that had "kB" units, add _bytes

* Interrupts counter should have _total
2018-01-17 17:55:55 +01:00
Ben Kochie b4d7ba119a
Add fixture for ppc64le (#785)
* Add support for per-architecture fixtures.
* Add output for ppc64le.
2018-01-11 13:56:19 +01:00
Nick Owens 0629a081db multiply page size after float64 coercion to avoid signed integer overflow (#780) 2018-01-08 15:36:49 +01:00
Franz Pletz d432f9857e Use uint64 in the ZFS collector (#714)
ZFS metrics can also be unsigned 64-bit integers that won't fit in
int64 and causes the whole collector to fail.
2018-01-06 12:36:55 +01:00
Derek Marcotte 477fe4665a Move FreeBSD/DragonflyBSD out of meminfo add kvm. (#547)
* Move FreeBSD/DragonflyBSD out of meminfo add kvm.

This gives us SwapUsed, and everything under one roof.

* Fix typos per review.

* Update to use newer API.

* Remove premature optimization per PR feedback.
2018-01-04 12:23:26 +01:00
Sevag Hanssian 4329b0a86b Add summary metrics for systemd exporter (#765) 2018-01-04 11:49:36 +01:00
Matthieu Guegan d6ef10bb56 Add openbsd meminfo (#724)
* Implements meminfo collector for OpenBSD

This is a rework of #151.

* Fix CGO import

* Add some useful metrics

* Rename total -> size for normalization
2018-01-04 10:32:08 +01:00
Ben Kochie 7f6c59e198
Ignore more virtual filesystems (#775)
Add additional Linux virtual filesystem types to the default list.
2018-01-03 17:22:02 +01:00
Netmonk 2aa8d0eb0c [FIX] Exclude Linux proc from filesystem type regexp (#774)
* [FIX] Issue 63, error on excluding proc filesystem on linux, improving regexp

* [FIX] Reordering filter order
2018-01-03 11:40:32 +01:00
Julius Volz f536857ac6
Fix e2e tests after textfile custom timestamp removal (#768) 2017-12-24 11:54:33 +01:00
Shubheksha Jalan 1f2458f42c Filter out testfile metrics correctly when using collect[] filters (#763)
* remove injection hook for textfile metrics, convert them to prometheus format

* add support for summaries

* add support for histograms

* add logic for handling inconsistent labels within a metric family for counter, gauge, untyped

* change logic for parsing the metrics textfile

* fix logic to adding missing labels

* Export time and error metrics for textfiles

* Add tests for new textfile collector, fix found bugs

* refactor Update() to split into smaller functions

* remove parseTextFiles(), fix import issue

* add mtime metric directly to channel, fix handling of mtime during testing

* rename variables related to labels

* refactor: add default case, remove if guard for metrics, remove extra loop and slice

* refactor: remove extra loop iterating over metric families

* test: add test case for different metric type, fix found bug

* test: add test for metrics with inconsistent labels

* test: add test for histogram

* test: add test for histogram with extra dimension

* test: add test for summary

* test: add test for summary with extra dimension

* remove unnecessary creation of protobuf

* nit: remove extra blank line
2017-12-23 20:21:58 +01:00
Ben Kochie cd2a17176a
Add full make to CircleCI (#761)
* Add full make to CircleCI

Ensure end-to-end test is run.

* Fix go fmt error.

* Fix end-to-end output.
2017-12-21 16:24:23 +01:00
Wei Li 1e9bb4ec3a textfile: fix duplicate metrics error (#738)
The textfile gatherer should only be added to gatherer list once.

Signed-off-by: Li Wei <liwei@anbutu.com>
2017-12-06 17:05:40 +01:00
Kristian Klausen a96f1738b3 netdev: Change valueType to CounterValue (#749)
All the metric only goes up, so the type should be counter.
This also add _total to all the metric name.

Fix: #747
2017-12-06 13:58:35 +01:00
Ben Kochie 2a80537547
Split out guest cpu metrics on Linux. (#744)
Linux "guest" metrics for VMs are already accounted for in node_cpu
`user` and `nice` metrics.  Separate these into their own metric to
avoid duplication of data.
2017-11-23 15:04:47 +01:00
Karsten Weiss a8d7d1101a cpu: Support processor-less (memory-only) NUMA nodes (#734)
* cpu: Support processor-less (memory-only) NUMA nodes

Processor-less (memory-only) NUMA nodes exist e.g. in systems that use
Intel Optane drives for RAM expansion using Intel Memory Drive
Technology (IMDT).

IMDT RAM expansion supports two modes:

* "Unify Remote Memory domains": present a processor-less (memory-only)
  NUMA domain, which is the default
* "Expand local memory domains": to expand each processor’s memory domain
  with a portion of the memory made available by Optane and IMDT

This commit fixes a crash in the first case (when "cpulist" is empty).

Here's an example of such a system:

$ numastat -m|head -n5

Per-node system memory usage (in MBs):
                          Node 0          Node 1          Node 2           Total
                 --------------- --------------- --------------- ---------------
MemTotal               118239.56       130816.00       464384.00       713439.56

$ for i in {0..2}; do echo -n "$i: " ; cat /sys/bus/node/devices/node$i/cpulist ; done
0: 0-7,16-23
1: 8-15,24-31
2:

$ /opt/vsmp/bin/vsmpversion -vvv
Memory Drive Technology: 8.2.1455.74 (Sep 28 2017 13:09:59)
System configuration:
    Boards:      3
       1 x Proc. + I/O + Memory
       2 x NVM devices (Intel SSDPED1K375GAQ)
    Processors:  2, Cores: 16, Threads: 32
        Intel(R) Xeon(R) CPU E5-2667 v4 @ 3.20GHz Stepping 01
    Memory (MB): 713472 (of 977450), Cache: 251416, Private: 12562
       1 x 249088MB   [262036/   678/12270]
       1 x 232192MB   [357707/125369/  146]  82:00.0#1
       1 x 232192MB   [357707/125369/  146]  83:00.0#1

* cpu: rename some variables (pkg => node)

* cpu: Use %v not %q in log.Debugf() format strings
2017-11-10 15:31:26 +01:00
Matt Layher f6f9c8d6cc Add and use sysReadFile in hwmon collector (#728) 2017-11-07 07:49:37 +01:00
Tobias Klauser d73f1e60c4 Simplify Utsname string conversion (#716)
* Update golang.org/x/sys/unix

This allows to use simplified string conversion of Utsname members.

* Simplify Utsname string conversion

Use Utsname from golang.org/x/sys/unix which contains byte array
instead of int8/uint8 array members. This allows to simplify the string
conversions of these members.
2017-11-02 11:57:14 +01:00
Ben Kochie ea250d73f4
Fix off by one in Linux interrupts collector (#721)
* Fix off by one in Linux interrupts collector

* Fix off by one in CPU column handler.
* Add test.

* Enable interrupts in end-to-end test.
2017-11-02 09:59:46 +01:00
Matt Layher 296b62acb7
netstat: return nothing when /proc/net/snmp6 not found 2017-10-31 15:26:32 -04:00
Derek Marcotte 0eecaa9547 Correct buffer_bytes > INT_MAX on BSD/amd64. (#712)
* Correct buffer_bytes > INT_MAX on BSD/amd64.

The sysctl vfs.bufspace returns either an int or a long, depending on
the value.  Large values of vfs.bufspace will result in error messages
like:

  couldn't get meminfo: cannot allocate memory

This will detect the returned data type, and cast appropriately.

* Added explicit length checks per feedback.

* Flatten Value() to make it easier to read.

* Simplify per feedback.

* Fix style.

* Doc updates.
2017-10-25 20:55:22 +02:00
Matt Layher f9ad88fc03
xfs: expose correct fields, fix metric names 2017-10-20 18:41:51 -04:00
Siavash Safi f3a7022602 Add collect[] parameter (#699)
* Add `collect[]` parameter

* Add TODo comment about staticcheck ignored

* Restore promhttp.HandlerOpts

* Log a warning and return HTTP error instead of failing

* Check collector existence and status, cleanups

* Fix warnings and error messages

* Don't panic, return error if collector registration failed

* Update README
2017-10-14 14:23:42 +02:00
Ben Kochie deadfef4c9 Update vendoring (#685)
* Update vendor github.com/coreos/go-systemd/dbus@v15

* Update vendor github.com/ema/qdisc

* Update vendor github.com/godbus/dbus

* Update vendor github.com/golang/protobuf/proto

* Update vendor github.com/lufia/iostat

* Update vendor github.com/matttproud/golang_protobuf_extensions/pbutil@v1.0.0

* Update vendor github.com/prometheus/client_golang/...

* Update vendor github.com/prometheus/common/...

* Update vendor github.com/prometheus/procfs/...

* Update vendor github.com/sirupsen/logrus@v1.0.3

Adds vendor golang.org/x/crypto

* Update vendor golang.org/x/net/...

* Update vendor golang.org/x/sys/...

* Update end to end output.
2017-10-05 16:20:47 +02:00
Brett Vickers b62c7bc0ad Updated vendored ntp package (#681)
The github.com/beevik/ntp package was recently updated with some
API changes that broke node_exporter. This commit fetches the
latest version of the ntp package and brings node_exporter in
line with the latest API.
2017-10-04 08:33:49 +02:00
Calle Pettersson 859a825bb8 Replace --collectors.enabled with per-collector flags (#640)
* Move NodeCollector into package collector

* Refactor collector enabling

* Update README with new collector enabled flags

* Fix out-of-date inline flag reference syntax

* Use new flags in end-to-end tests

* Add flag to disable all default collectors

* Track if a flag has been set explicitly

* Add --collectors.disable-defaults to README

* Revert disable-defaults flag

* Shorten flags

* Fixup timex collector registration

* Fix end-to-end tests

* Change procfs and sysfs path flags

* Fix review comments
2017-09-28 15:06:26 +02:00
Sami Kerola 3762191e66 Add timex collector (#664)
This collector is based on adjtimex(2) system call.  The collector returns
three values, status if time is synchronised, offset to remote reference,
and local clock frequency adjustment.

Values are taken from kernel time keeping data structures to avoid getting
involved how the synchronisation is implemented.  By that I mean one should
not care if time is update using ntpd, systemd.timesyncd, ptpd, and so on.
Since all time sync implementation will always end up telling to kernel what
is the status with time one can simply omit the software in between, and
look results of the syncing.  As a positive side effect this makes collector
very quick and conceptually specific, this does not monitor availability of
NTP server, or network in between, or dns resolution, and other unrelated
but necessary things.

Minimum set of values to keep eye on are the following three:

    The node_timex_sync_status tells if local clock is in sync with a remote
    clock.  Value is set to zero when synchronisation to a reliable server
    is lost, or a time sync software is misconfigured.

    The node_timex_offset_seconds tells how much local clock is off when
    compared to reference.  In case of multiple time references this value
    is outcome of RFC 5905 adjustment algorithm.  Ideally offset should be
    close to zero, and it depends about use case how large value is
    acceptable.  For example a typical web server is probably fine if offset
    is about 0.1 or less, but that would not be good enough for mobile phone
    base station operator.

    The node_timex_freq tells amount of adjustment to local clock tick
    frequency.  For example if offset is one second and growing the local
    clock will need instruction to tick quicker.  Number value itself is not
    very important, and occasional small adjustments are fine.  When
    frequency is unusually in stable one can assume quality of time stamps
    will not be accurate to very far in sub second range.  Obviously
    explaining why local clock frequency behaves like a passenger in roller
    coaster is different matter.  Explanations can vary from system load, to
    environmental issues such as a machine being physically too hot.

Rest of the measurements can help when debugging.  If you run a clock server
do probably want to collect and keep track of everything.

Pull-request: https://github.com/prometheus/node_exporter/pull/664
2017-09-19 07:54:06 -07:00
Leonid Evdokimov c169b4b1c5 Add metrics from SNTPv4 packet to ntp collector & add ntpd sanity check (#655)
* Add metrics from SNTPv4 packet to ntp collector & add ntpd sanity check

1. Checking local clock against remote NTP daemon is bad idea, local
ntpd acting as a  client should do it better and avoid excessive load on
remote NTP server so the collector is refactored to query local NTP
server.

2. Checking local clock against remote one does not check local ntpd
itself. Local ntpd may be down or out of sync due to network issues, but
clock will be OK.

3. Checking NTP server using sanity of it's response is tricky and
depends on ntpd implementation, that's why common `node_ntp_sanity`
variable is exported.

* `govendor add golang.org/x/net/ipv4`, it is dependency of github.com/beevik/ntp

* Update github.com/beevik/ntp to include boring SNTP fix

* Use variable name from RFC5905

* ntp: move code to make export of raw metrics more explicit

* Move NTP math to `github.com/beevik/ntp`

* Make `golint` happy

* Add some brief docs explaining `ntp` #655 and `timex` #664 modules

* ntp: drop XXX comment that got its decision

* ntp: add `_seconds` suffix to relevant metrics

* Better `node_ntp_leap` comment

* s/node_ntp_reftime/node_ntp_reference_timestamp_seconds/ as requested by @discordianfish

* Extract subsystem name to const as suggested by @SuperQ
2017-09-19 10:36:14 +02:00
Karsten Weiss b0d5c00832 cpu: Metric 'package_throttles_total' is per package. (#657)
* cpu: Metric 'package_throttles_total' is per package.

'package_throttles_total' is per package, not per cpu. This also reduces
the total number of cpu time series a lot (esp for multi core cpus).

* cpu: Better handling of a cpulist edge-case.

* cpu: Extract the package number from the directory name.

Do not rely on the range index.

* cpu: Add package_throttle_count for node0 cpu1

This file must be ignored by the cpu collector.
2017-09-07 23:24:18 +02:00
Matthias Rampke e1f129c729 Use int64 throughout the ZFS collector.
This avoids issues with integer overflows on 32-bit architectures. The
Prometheus data format is float64, so regardless of the architecture we
should handle large numbers.

Fixes #629.
2017-08-21 16:40:16 +00:00
Ben Kochie 8839640cd1 Ignore wifi collector permission errors (#646)
Ignore the permission denined error when the wifi collector has no
permission to read metrics.
2017-08-18 10:19:48 +02:00
Calle Pettersson dfe07eaae8 Switch to kingpin flags (#639)
* Switch to kingpin flags

* Fix logrus vendoring

* Fix flags in main tests

* Fix vendoring versions
2017-08-12 15:07:24 +02:00
Ben Kochie 46c31d8a7e Enable IPVS collector by default (#623)
* Silence error output when no IPVS present.
* Enable by default.
* Update end-to-end fixture.
* Update README.
2017-07-26 15:20:28 +02:00
Tobias Schmidt 515b5a933d Fix build tags of loadavg collector
The collector is only implemented for a subset of all operating systems
supported by go. Compilation will fail if attempted for another OS
target.
2017-07-20 15:13:58 -04:00
Tobias Schmidt 016d79535d Fix build tags of meminfo collector
The meminfo collector only supports darwin, dragonfly, freebsd and linux
and must not be included in other archtictures.
2017-07-20 14:37:10 -04:00
Andrea De Pasquale 1369763067 Change raid0 status line regexp for mdadm collector (#619) 2017-07-20 17:04:33 +02:00
Tobias Schmidt 921319c7eb Merge pull request #583 from knweiss/golint
Golint fixes
2017-07-10 23:49:36 +02:00
Aleksey Zhukov 7a914e58f2 Add parsing /proc/net/snmp6 file for netstat-linux (#615)
* Add parsing /proc/net/snmp6 file

* add /proc/net/snmp6 fixture

* fix e2e test

* gofmt

* remove unuser variable

* safe checks

* add tests

* change help format
2017-07-08 20:16:35 +02:00
Matt Layher 6e82fd1c56 Add XFS block mapping and block map B-tree stats (#575) 2017-07-07 07:27:52 +02:00
ideaship 8d90276283 Add bcache collector (#597)
* Add bcache collector for Linux

This collector gathers metrics related to the Linux block cache
(bcache) from sysfs.

* Removed commented out code

* Use project comment style

* Add _sectors to metric name to indicate unit

* Really use project comment style

* Rename bcache.go to bcache_linux.go

* Keep collector namespace clean

Rename:
- metric -> bcacheMetric
- periodStatsToMetrics -> bcachePeriodStatsToMetric

* Shorten slice initialization

* Change label names to backing_device, cache_device

* Remove five minute metrics (keep only total)

* Include units in additional metric names

* Enable bcache collector by default

* Provide metrics in seconds, not nanoseconds

* remove metrics with label "all"

* Add fixtures, update end-to-end for bcache collector

* Move fixtures/sys into tar.gz

This changeset moves the collector/fixtures/sys directory into
collector/fixtures/sys.tar.gz and tweaks the Makefile to unpack the
tarball before tests are run.

The reason for this change is that Windows does not allow colons in a
path (colons are present in some of the bcache fixture files), nor can
it (out of the box) deal with pathnames longer than 260 characters
(which we would be increasingly likely to hit if we tried to replace
colons with longer codes that are guaranteed not the turn up in regular
file names).

* Add ttar: plain text archive, replacement for tar

This changeset adds ttar, a plain text replacement for tar, and uses it
for the sysfs fixture archive. The syntax is loosely based on tar(1).

Using a plain text archive makes it possible to review changes without
downloading and extracting the archive. Also, when working on the repo,
git diff and git log become useful again, allowing a committer to verify
and track changes over time.

The code is written in bash, because bash is available out of the box on
all major flavors of Linux and on macOS. The feature set used is
restricted to bash version 3.2 because that is what Apple is still
shipping.

The programm also works on Windows if bash is installed. Obviously, it
does not solve the Windows limitations (path length limited to 260
characters, no symbolic links) that prompted the move to an archive
format in the first place.
2017-07-07 07:20:18 +02:00
kadota kyohei a077024f51 add diskstats on Darwin (#593)
* Add diskstats collector for Darwin

* Update year in the header

* Update README.md

* Add github.com/lufia/iostat to vendored packages

* Change stats to follow naming guidelines

* Add a entry of github.com/lufia/iostat into vendor.json

* Remove /proc/diskstats from description
2017-07-06 13:51:24 +02:00
Rene Treffer 56bf8d4b2d Add link to kernel documentation for sysfs/cpufreq files 2017-06-27 11:25:06 +02:00
Rene Treffer bcc3cd92b8 Fix cpufreq statistics by converting kHz to Hz 2017-06-27 11:05:55 +02:00
Ben Kochie 182810056f Fix Linux cpu errors (#606)
Make the Linux cpu collector soft-error on missing `cpufreq` and
`thermal_throttle` features.
2017-06-20 07:51:26 +02:00
Rene Treffer 2e9f1913b8 Move stat_linux to cpu_linux and add cpufreq stats (#548) 2017-06-13 11:21:53 +02:00
Emanuele Rocca 047003b6bb Add qdisc collector for Linux (#580)
* Add qdisc collector for Linux

This collector gathers basic queueing discipline metrics via netlink,
similarly to what `tc -s qdisc show` does.

* qdisc collector: nl-specific code moved, names fixed

- netlink-specific parts moved to github.com/ema/qdisc
- avoid using shortened names
- counters renamed into XXX_total

* Get rid of parseMessage error checking leftover

* Add github.com/ema/qdisc to vendored packages

* Update help texts and comments

* Add qdisc collector to README file

* qdisc collector end-to-end testing

* Update qdisc dependency to latest version

Update github.com/ema/qdisc dependency to revision 2c7e72d, which
includes unit testing.

* qdisc collector: rename "iface" label into "device"
2017-05-23 11:55:50 +02:00
Karsten Weiss b2f4fd5776 Remove unused devstatCollector struct member 'bytes_total'.
This also fixes this golint issue:

devstat_freebsd.go:40:2: don't use underscores in Go names; struct field bytes_total should be bytesTotal
2017-05-14 19:51:53 +02:00
Jonas Große Sundrup e6d031788f Correct typo (#582) 2017-05-14 19:46:23 +02:00
Karsten Weiss bca09abf1c golint: Fix NewStatCollector() doc string. 2017-05-14 13:51:47 +02:00
Karsten Weiss b3e7420a27 cpu_darwin.go: s/cpu_ticks/cpuTicks/g 2017-05-14 13:51:42 +02:00
Karsten Weiss b05c7d8dab cpu_darwin.go: Fix doc strings. 2017-05-14 13:51:34 +02:00
Karsten Weiss fff03c6c0c Fix NewTCPStatCollector doc string. 2017-05-14 13:23:57 +02:00
Karsten Weiss 6720cfdbfe golint: Fix comment on exported function NewDevstatCollector. 2017-05-14 13:21:39 +02:00
Karsten Weiss b73af72853 Explicitly check for the rc 3 in call to getloadavg(). Reorder logic. 2017-05-14 13:07:54 +02:00
Karsten Weiss af358ec800 golint fixes: if block ends with a return statement, so drop this else and outdent its block. 2017-05-14 12:55:44 +02:00
Karsten Weiss 732f839810 sysctl_bsd.go: golint fixes. Typo fix. 2017-05-14 12:51:57 +02:00
Robert Clark 58f50b31f2 Multiply port data XMIT/RCV metrics by 4 (#579)
According to Mellanox, it is standard practice that the port_xmit_data and port_rcv_data
files are split into 4 lanes. To get the actual transmit and receive values for each
port, the metric needs to be multiplied by 4.

Signed-Off-By: Robert Clark <robert.d.clark@hpe.com>
2017-05-12 07:28:53 +02:00
Ben Kochie 8f3cddf734 Merge pull request #568 from mdlayher/xfs-init
Initial XFS collector
2017-04-25 09:54:28 +02:00
Kai S 59f9b8c5c1 Handle nonexisting bonding_masters file (#569)
* silently ignore nonexisting bonding_masters file

Add an empty fixtures dir without a bonding_masters file to test.

* Moved the check to the Update() method

Dropped the empty test dir.
2017-04-24 23:19:17 +04:00
Matt Layher 1feb091b36
Initial XFS collector 2017-04-22 11:53:07 -04:00