Skip to content

Commit 7479352

Browse files
committed
Rename interrupts cpu_as_tags to cpu_as_tag; update readme
1 parent 9a637ed commit 7479352

File tree

4 files changed

+79
-41
lines changed

4 files changed

+79
-41
lines changed

plugins/inputs/interrupts/README.md

Lines changed: 66 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,48 +3,81 @@
33
The interrupts plugin gathers metrics about IRQs from `/proc/interrupts` and `/proc/softirqs`.
44

55
### Configuration
6-
```
6+
```toml
77
[[inputs.interrupts]]
8-
# To report cpus as tags instead of fields use cpu_as_tags
9-
# cpu_as_tags = false
10-
#
8+
## When set to true, cpu metrics are tagged with the cpu. Otherwise cpu is
9+
## stored as a field.
10+
##
11+
## The default is false for backwards compatibility, and will be changed to
12+
## true in a future version. It is recommended to set to true on new
13+
## deployments.
14+
# cpu_as_tag = false
15+
1116
## To filter which IRQs to collect, make use of tagpass / tagdrop, i.e.
1217
# [inputs.interrupts.tagdrop]
13-
# irq = [ "NET_RX", "TASKLET" ]
18+
# irq = [ "NET_RX", "TASKLET" ]
1419
```
1520

16-
### Measurements
17-
There are two measurements reported by this plugin.
18-
- `interrupts` gathers metrics from the `/proc/interrupts` file
19-
- `soft_interrupts` gathers metrics from the `/proc/softirqs` file
21+
### Metrics
22+
23+
There are two styles depending on the value of `cpu_as_tag`.
24+
25+
With `cpu_as_tag = false`:
26+
27+
- interrupts
28+
- tags:
29+
- irq (IRQ name)
30+
- type
31+
- device (name of the device that is located at the IRQ)
32+
- cpu
33+
- fields:
34+
- cpu (int, number of interrupts per cpu)
35+
- total (int, total number of interrupts)
2036

21-
### Fields
22-
For cpu_as_tags=false (default):
23-
- CPUx: the amount of interrupts for the IRQ handled by the CPU
24-
- Total: sum of interrupts for the IRS for all CPUs
25-
For cpu_as_tags=true ():
26-
- Count: the amount of interrupts for the IRQ handled by CPU described in CPU tag
37+
- soft_interrupts
38+
- tags:
39+
- irq (IRQ name)
40+
- type
41+
- device (name of the device that is located at the IRQ)
42+
- cpu
43+
- fields:
44+
- cpu (int, number of interrupts per cpu)
45+
- total (int, total number of interrupts)
2746

28-
### Tags
29-
- irq: the IRQ
30-
- type: the type of interrupt
31-
- device: the name of the device that is located at that IRQ
32-
- cpu: the CPU (when cpus_as_tags=true)
47+
With `cpu_as_tag = true`:
48+
49+
- interrupts
50+
- tags:
51+
- irq (IRQ name)
52+
- type
53+
- device (name of the device that is located at the IRQ)
54+
- cpu
55+
- fields:
56+
- count (int, number of interrupts)
57+
58+
- soft_interrupts
59+
- tags:
60+
- irq (IRQ name)
61+
- type
62+
- device (name of the device that is located at the IRQ)
63+
- cpu
64+
- fields:
65+
- count (int, number of interrupts)
3366

3467
### Example Output
68+
69+
With `cpu_as_tag = false`:
70+
```
71+
interrupts,irq=0,type=IO-APIC,device=2-edge\ timer,cpu=cpu0 count=23i 1489346531000000000
72+
interrupts,irq=1,type=IO-APIC,device=1-edge\ i8042,cpu=cpu0 count=9i 1489346531000000000
73+
interrupts,irq=30,type=PCI-MSI,device=65537-edge\ virtio1-input.0,cpu=cpu1 count=1i 1489346531000000000
74+
soft_interrupts,irq=NET_RX,cpu=cpu0 count=280879i 1489346531000000000
3575
```
36-
./telegraf --config ~/interrupts_config.conf --test
37-
For cpus_as_tags=false (default):
38-
* Plugin: inputs.interrupts, Collection 1
39-
> interrupts,irq=0,type=IO-APIC,device=2-edge\ timer,host=hostname,cpu=cpu0 count=23i 1489346531000000000
40-
> interrupts,irq=1,host=hostname,type=IO-APIC,device=1-edge\ i8042,cpu=cpu0 count=9i 1489346531000000000
41-
> interrupts,irq=30,type=PCI-MSI,device=65537-edge\ virtio1-input.0,host=hostname,cpu=cpu1 count=1i 1489346531000000000
42-
> soft_interrupts,irq=NET_RX,host=hostname,cpu=cpu0 count=280879i 1489346531000000000
43-
44-
For cpus_as_tags=true:
45-
> interrupts,cpu=cpu6,host=hostname,irq=PIW,type=Posted-interrupt\ wakeup\ event count=0i 1543539773000000000
46-
> interrupts,cpu=cpu7,host=hostname,irq=PIW,type=Posted-interrupt\ wakeup\ event count=0i 1543539773000000000
47-
> soft_interrupts,cpu=cpu0,host=hostname,irq=HI count=246441i 1543539773000000000
48-
> soft_interrupts,cpu=cpu1,host=hostname,irq=HI count=159154i 1543539773000000000
4976

77+
With `cpu_as_tag = true`:
78+
```
79+
interrupts,cpu=cpu6,irq=PIW,type=Posted-interrupt\ wakeup\ event count=0i 1543539773000000000
80+
interrupts,cpu=cpu7,irq=PIW,type=Posted-interrupt\ wakeup\ event count=0i 1543539773000000000
81+
soft_interrupts,cpu=cpu0,irq=HI count=246441i 1543539773000000000
82+
soft_interrupts,cpu=cpu1,irq=HI count=159154i 1543539773000000000
5083
```

plugins/inputs/interrupts/interrupts.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
type Interrupts struct {
16-
CpuAsTags bool
16+
CpuAsTag bool `toml:"cpu_as_tag"`
1717
}
1818

1919
type IRQ struct {
@@ -29,12 +29,17 @@ func NewIRQ(id string) *IRQ {
2929
}
3030

3131
const sampleConfig = `
32-
## To report cpus as tags instead of fields use cpu_as_tags
33-
# cpu_as_tags = false
34-
#
32+
## When set to true, cpu metrics are tagged with the cpu. Otherwise cpu is
33+
## stored as a field.
34+
##
35+
## The default is false for backwards compatibility, and will be changed to
36+
## true in a future version. It is recommended to set to true on new
37+
## deployments.
38+
# cpu_as_tag = false
39+
3540
## To filter which IRQs to collect, make use of tagpass / tagdrop, i.e.
3641
# [inputs.interrupts.tagdrop]
37-
# irq = [ "NET_RX", "TASKLET" ]
42+
# irq = [ "NET_RX", "TASKLET" ]
3843
`
3944

4045
func (s *Interrupts) Description() string {
@@ -116,7 +121,7 @@ func (s *Interrupts) Gather(acc telegraf.Accumulator) error {
116121
acc.AddError(fmt.Errorf("Parsing %s: %s", file, err))
117122
continue
118123
}
119-
reportMetrics(measurement, irqs, acc, s.CpuAsTags)
124+
reportMetrics(measurement, irqs, acc, s.CpuAsTag)
120125
}
121126
return nil
122127
}

plugins/inputs/unbound/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ a validating, recursive, and caching DNS resolver.
2323

2424
## When set to true, thread metrics are tagged with the thread id.
2525
##
26-
## The default is false for backwards compatibility, and will be change to
26+
## The default is false for backwards compatibility, and will be changed to
2727
## true in a future version. It is recommended to set to true on new
2828
## deployments.
2929
thread_as_tag = false

plugins/inputs/unbound/unbound.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ var sampleConfig = `
5050
5151
## When set to true, thread metrics are tagged with the thread id.
5252
##
53-
## The default is false for backwards compatibility, and will be change to
53+
## The default is false for backwards compatibility, and will be changed to
5454
## true in a future version. It is recommended to set to true on new
5555
## deployments.
5656
thread_as_tag = false

0 commit comments

Comments
 (0)