Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
telegraf-nftables
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Due to inactivity, this project is scheduled to be deleted on 2035-04-24.
Why is this scheduled?
Show more breadcrumbs
vqgroup
telegraf-nftables
Commits
7b09623f
Commit
7b09623f
authored
9 years ago
by
Cameron Sparr
Browse files
Options
Downloads
Patches
Plain Diff
Add number of users to 'system' plugin
see #235
parent
2f45b8b7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
plugins/inputs/system/SYSTEM_README.md
+35
-0
35 additions, 0 deletions
plugins/inputs/system/SYSTEM_README.md
plugins/inputs/system/system.go
+6
-0
6 additions, 0 deletions
plugins/inputs/system/system.go
with
42 additions
and
0 deletions
CHANGELOG.md
+
1
−
0
View file @
7b09623f
...
...
@@ -15,6 +15,7 @@
-
[
#799
](
https://github.com/influxdata/telegraf/pull/799
)
: Add number of threads for procstat input plugin. Thanks @titilambert!
-
[
#776
](
https://github.com/influxdata/telegraf/pull/776
)
: Add Zookeeper chroot option to kafka_consumer. Thanks @prune998!
-
[
#811
](
https://github.com/influxdata/telegraf/pull/811
)
: Add processes plugin for classifying total procs on system. Thanks @titilambert!
-
[
#235
](
https://github.com/influxdata/telegraf/issues/235
)
: Add number of users to the
`system`
input plugin.
### Bugfixes
-
[
#748
](
https://github.com/influxdata/telegraf/issues/748
)
: Fix sensor plugin split on ":"
...
...
This diff is collapsed.
Click to expand it.
plugins/inputs/system/SYSTEM_README.md
0 → 100644
+
35
−
0
View file @
7b09623f
# System Input Plugin
The system plugin gathers general stats on system load, uptime,
and number of users logged in. It is basically equivalent
to the unix
`uptime`
command.
### Configuration:
```
toml
# Read metrics about system load & uptime
[[inputs.system]]
# no configuration
```
### Measurements & Fields:
-
system
-
load1 (float)
-
load15 (float)
-
load5 (float)
-
n_users (integer)
-
uptime (integer, seconds)
-
uptime_format (string)
### Tags:
None
### Example Output:
```
$ telegraf -config ~/ws/telegraf.conf -input-filter system -test
* Plugin: system, Collection 1
> system load1=2.05,load15=2.38,load5=2.03,n_users=4i,uptime=239043i,uptime_format="2 days, 18:24" 1457546165399253452
```
This diff is collapsed.
Click to expand it.
plugins/inputs/system/system.go
+
6
−
0
View file @
7b09623f
...
...
@@ -31,11 +31,17 @@ func (_ *SystemStats) Gather(acc telegraf.Accumulator) error {
return
err
}
users
,
err
:=
host
.
Users
()
if
err
!=
nil
{
return
err
}
fields
:=
map
[
string
]
interface
{}{
"load1"
:
loadavg
.
Load1
,
"load5"
:
loadavg
.
Load5
,
"load15"
:
loadavg
.
Load15
,
"uptime"
:
hostinfo
.
Uptime
,
"n_users"
:
len
(
users
),
"uptime_format"
:
format_uptime
(
hostinfo
.
Uptime
),
}
acc
.
AddFields
(
"system"
,
fields
,
nil
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment