influxdata / influxdata/kapacitor
Different expected values with Graphite as input
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Hi,
I just started testing Kapacitor with [[graphite]] InfluxDB service.
Afer creatng the alert, I realized that the **result exposed by Kapacitor seems to be the Graphite value divided by 10!**
So, some questions:
* Do you have any idea why is this happening?
* There is some way to see what value is Kapacitor evaluating?
## Case:
I have the following test configuration:
_Kapacitor Graphite section conf_
````
[[graphite]]
enabled = true
database = "monitoring"
bind-address = ":2006"
retention-policy = "autogen"
protocol = "tcp"
consistency-level = "one"
separator = "_"
templates = [
#CPU
"*.*.*.*.*.system.cpu.* system.sceneario.center.site.hostname.measurement.measurement.field",
]
````
I'm duplicating data using carbon-c-relay to the localhost:**2006** port, in order to let Kapacitor listen to data:
- Data is sent every 1 minute
- There are 2 host: `hostAA`, `hostBB`.
- Measurement: system_cpu -> field: 'percent-active'
I created an alert with the following configuration, note that is always firing just to test it, called `test_cpu`
_Test alert to eval CPU percent-active field_
````
stream
// Select just the cpu measurement from our example database.
|from()
.measurement('system_cpu')
.groupBy(*)
|default()
.field('percent-active',0.0)
|window()
.period(1m)
.every(1m)
|mean('percent-active')
|alert()
.warn(lambda:"mean" > 0.01)
.crit(lambda: "mean" > 90)
// Whenever we get an alert write it to a file.
.id('kapacitor/{{ index .Tags "service" }}')
.message('{{ .ID }} is {{ .Level }} value:{{ index .Fields "mean" }}')
.log('/tmp/alerts.log')
.details('''
{{ .ID }}
{{ .Message }}
Value: {{ index .Fields "value" }}
''')
````
_Result eval:_
So as I expected, it is processing percent-active and firing the `warn` alert correctly. The problem is that the value, seems wrong if I compare it directly with Graphite...**The value on Kapacitor seems to be the value on Graphite/10**!!
````
[cpu_alert:alert5] 2017/02/09 15:08:11 D! WARNING alert triggered id:kapacitor/ msg:kapacitor/ is WARNING value:0.5250772 data:&{system_cpu map[center:X scenario:devel hostname:hostAA system:Y site:Z] [time mean] [[2017-02-09 15:08:10 +0100 CET 0.5250772]]}
[cpu_alert:alert5] 2017/02/09 15:07:24 D! WARNING alert triggered id:kapacitor/ msg:kapacitor/ is WARNING value:0.3852104 data:&{system_cpu map[center:X, scenario:devel hostname:hostBB system:Y site:Z] [time mean] [[2017-02-09 15:07:23 +0100 CET 0.3852104]]}
````

Runing Kapacitor 1.2.0
Thanks for all,
Greetings.
Contributor guide
Research direction
Start by reproducing the reported result with the supplied Graphite listener configuration and TICKscript, focusing on the percent-active field, one-minute window, and mean calculation. Compare the value received by Kapacitor with the source Graphite value and determine whether the conversion is expected or incorrect; done means documenting the cause and the correct observable value or behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100