Skip to content
This repository has been archived by the owner on Oct 18, 2023. It is now read-only.

Commit

Permalink
Rename interrupts cpu_as_tags to cpu_as_tag; update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnelson committed Nov 30, 2018
1 parent 9a637ed commit 7479352
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 41 deletions.
99 changes: 66 additions & 33 deletions plugins/inputs/interrupts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,81 @@
The interrupts plugin gathers metrics about IRQs from `/proc/interrupts` and `/proc/softirqs`.

### Configuration
```
```toml
[[inputs.interrupts]]
# To report cpus as tags instead of fields use cpu_as_tags
# cpu_as_tags = false
#
## When set to true, cpu metrics are tagged with the cpu. Otherwise cpu is
## stored as a field.
##
## The default is false for backwards compatibility, and will be changed to
## true in a future version. It is recommended to set to true on new
## deployments.
# cpu_as_tag = false

## To filter which IRQs to collect, make use of tagpass / tagdrop, i.e.
# [inputs.interrupts.tagdrop]
# irq = [ "NET_RX", "TASKLET" ]
# irq = [ "NET_RX", "TASKLET" ]
```

### Measurements
There are two measurements reported by this plugin.
- `interrupts` gathers metrics from the `/proc/interrupts` file
- `soft_interrupts` gathers metrics from the `/proc/softirqs` file
### Metrics

There are two styles depending on the value of `cpu_as_tag`.

With `cpu_as_tag = false`:

- interrupts
- tags:
- irq (IRQ name)
- type
- device (name of the device that is located at the IRQ)
- cpu
- fields:
- cpu (int, number of interrupts per cpu)
- total (int, total number of interrupts)

### Fields
For cpu_as_tags=false (default):
- CPUx: the amount of interrupts for the IRQ handled by the CPU
- Total: sum of interrupts for the IRS for all CPUs
For cpu_as_tags=true ():
- Count: the amount of interrupts for the IRQ handled by CPU described in CPU tag
- soft_interrupts
- tags:
- irq (IRQ name)
- type
- device (name of the device that is located at the IRQ)
- cpu
- fields:
- cpu (int, number of interrupts per cpu)
- total (int, total number of interrupts)

### Tags
- irq: the IRQ
- type: the type of interrupt
- device: the name of the device that is located at that IRQ
- cpu: the CPU (when cpus_as_tags=true)
With `cpu_as_tag = true`:

- interrupts
- tags:
- irq (IRQ name)
- type
- device (name of the device that is located at the IRQ)
- cpu
- fields:
- count (int, number of interrupts)

- soft_interrupts
- tags:
- irq (IRQ name)
- type
- device (name of the device that is located at the IRQ)
- cpu
- fields:
- count (int, number of interrupts)

### Example Output

With `cpu_as_tag = false`:
```
interrupts,irq=0,type=IO-APIC,device=2-edge\ timer,cpu=cpu0 count=23i 1489346531000000000
interrupts,irq=1,type=IO-APIC,device=1-edge\ i8042,cpu=cpu0 count=9i 1489346531000000000
interrupts,irq=30,type=PCI-MSI,device=65537-edge\ virtio1-input.0,cpu=cpu1 count=1i 1489346531000000000
soft_interrupts,irq=NET_RX,cpu=cpu0 count=280879i 1489346531000000000
```
./telegraf --config ~/interrupts_config.conf --test
For cpus_as_tags=false (default):
* Plugin: inputs.interrupts, Collection 1
> interrupts,irq=0,type=IO-APIC,device=2-edge\ timer,host=hostname,cpu=cpu0 count=23i 1489346531000000000
> interrupts,irq=1,host=hostname,type=IO-APIC,device=1-edge\ i8042,cpu=cpu0 count=9i 1489346531000000000
> interrupts,irq=30,type=PCI-MSI,device=65537-edge\ virtio1-input.0,host=hostname,cpu=cpu1 count=1i 1489346531000000000
> soft_interrupts,irq=NET_RX,host=hostname,cpu=cpu0 count=280879i 1489346531000000000
For cpus_as_tags=true:
> interrupts,cpu=cpu6,host=hostname,irq=PIW,type=Posted-interrupt\ wakeup\ event count=0i 1543539773000000000
> interrupts,cpu=cpu7,host=hostname,irq=PIW,type=Posted-interrupt\ wakeup\ event count=0i 1543539773000000000
> soft_interrupts,cpu=cpu0,host=hostname,irq=HI count=246441i 1543539773000000000
> soft_interrupts,cpu=cpu1,host=hostname,irq=HI count=159154i 1543539773000000000

With `cpu_as_tag = true`:
```
interrupts,cpu=cpu6,irq=PIW,type=Posted-interrupt\ wakeup\ event count=0i 1543539773000000000
interrupts,cpu=cpu7,irq=PIW,type=Posted-interrupt\ wakeup\ event count=0i 1543539773000000000
soft_interrupts,cpu=cpu0,irq=HI count=246441i 1543539773000000000
soft_interrupts,cpu=cpu1,irq=HI count=159154i 1543539773000000000
```
17 changes: 11 additions & 6 deletions plugins/inputs/interrupts/interrupts.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
)

type Interrupts struct {
CpuAsTags bool
CpuAsTag bool `toml:"cpu_as_tag"`
}

type IRQ struct {
Expand All @@ -29,12 +29,17 @@ func NewIRQ(id string) *IRQ {
}

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

func (s *Interrupts) Description() string {
Expand Down Expand Up @@ -116,7 +121,7 @@ func (s *Interrupts) Gather(acc telegraf.Accumulator) error {
acc.AddError(fmt.Errorf("Parsing %s: %s", file, err))
continue
}
reportMetrics(measurement, irqs, acc, s.CpuAsTags)
reportMetrics(measurement, irqs, acc, s.CpuAsTag)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/unbound/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ a validating, recursive, and caching DNS resolver.

## When set to true, thread metrics are tagged with the thread id.
##
## The default is false for backwards compatibility, and will be change to
## The default is false for backwards compatibility, and will be changed to
## true in a future version. It is recommended to set to true on new
## deployments.
thread_as_tag = false
Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/unbound/unbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var sampleConfig = `
## When set to true, thread metrics are tagged with the thread id.
##
## The default is false for backwards compatibility, and will be change to
## The default is false for backwards compatibility, and will be changed to
## true in a future version. It is recommended to set to true on new
## deployments.
thread_as_tag = false
Expand Down

0 comments on commit 7479352

Please sign in to comment.