# From checks to influxdb

**URL:** <https://discourse.sensu.io/t/from-checks-to-influxdb/1975>\
**Category:** Sensu Go\
**Created:** [July 29, 2020, 6:23pm UTC](https://discourse.sensu.io/t/from-checks-to-influxdb/1975 "2020-07-29T18:23:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ohhfine](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/ohhfine/32/434_2.png) [@ohhfine](https://discourse.sensu.io/u/ohhfine)\
**Post date:** [July 29, 2020, 6:23pm UTC](https://discourse.sensu.io/t/from-checks-to-influxdb/1975/1 "2020-07-29T18:23:37Z")

</div>

Again, noob but have a home lab im trying to learn on, using ubuntu and centos

I have been following the doc’s as best i can and pieced stuff together to try an accomplish collecting custom metrics that are flowing on the event bus and putting it into influx for reporting purposes but i am failing at this point, have posted some lines from syslog and my handler and check configuration bellow. is anyone aware of a complete walkthrough on how to do this? I’m pretty sure once i see what i have done wrong it will open up my eyes.

once i get checks sorted out i will start to play with some plugins, also want to do something with statd as well but just baby steps right now

(posted in yaml format, is json easier to read?)

i have also used the format graphite\_plaintext and receive a similar area

Many thanks for any response  
Andrew

Jul 29 11:39:52 zig sensu-agent[852]: {“asset”:“cpu-checks-plugins”,“component”:“asset-manager”,“entity”:“zig”,“level”:“info”,“msg”:“asset includes builds, using builds instead of asset”,“time”:“2020-07-29T11:39:52-04:00”}  
Jul 29 11:39:52 zig sensu-agent[852]: {“asset”:“sensu-ruby-runtime”,“component”:“asset-manager”,“entity”:“zig”,“level”:“info”,“msg”:“asset includes builds, using builds instead of asset”,“time”:“2020-07-29T11:39:52-04:00”}  
Jul 29 11:39:57 zig sensu-agent[852]: {“check”:“check-cpu”,“component”:“agent”,“error”:“unable to extract metric from check output”,“level”:“error”,“line”:0,“msg”:“influxdb line format requires 2 arguments with a 3rd (optional) timestamp”,“namespace”:“default”,“time”:“2020-07-29T11:39:57-04:00”}

skipper@backend:/var/log$ sensuctl handler list --format yaml  
type: Handler  
api\_version: core/v2  
metadata:  
created\_by: skipper  
name: influx-db  
namespace: default  
spec:  
command: sensu-influxdb-handler -d sensu  
env\_vars:

- INFLUXDB\_ADDR=http://192.168.1.55:8086
- INFLUXDB\_USER=sensu
- INFLUXDB\_PASS=sensu  
filters: null  
handlers: null  
runtime\_assets:
- influxdb-handler  
secrets: null  
timeout: 0  
type: pipe  
skipper@backend:/var/log$

skipper@backend:/var/log$ sensuctl check list --format yaml  
type: CheckConfig  
api\_version: core/v2  
metadata:  
created\_by: skipper  
name: check-cpu  
namespace: default  
spec:  
check\_hooks: null  
command: check-cpu.rb -w 75 -c 90  
env\_vars: null  
handlers:   
high\_flap\_threshold: 0  
interval: 150  
low\_flap\_threshold: 0  
output\_metric\_format: influxdb\_line  
output\_metric\_handlers:

- influx-db  
proxy\_entity\_name: “”  
publish: true  
round\_robin: false  
runtime\_assets:
- cpu-checks-plugins
- sensu-ruby-runtime  
secrets: null  
stdin: false  
subdue: null  
subscriptions:
- Linux  
timeout: 0  
ttl: 0

---

<div class="post-metadata">

**Author:** ![aaronsachs](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/aaronsachs/32/47_2.png) [@aaronsachs](https://discourse.sensu.io/u/aaronsachs)\
**Post date:** [July 29, 2020, 6:27pm UTC](https://discourse.sensu.io/t/from-checks-to-influxdb/1975/2 "2020-07-29T18:27:51Z")

</div>

Hi @ohhfine, the issue I see right off the bat is that you’re using the `check-cpu` script, which doesn’t provide any metric data. If you wanted the status as a metric, you’d need to use the `-c` flag in your handler definition. Otherwise, you’d want to use `metrics-cpu` as your script. Another alternative would be to use a script that outputs nagios perfdata, which gets you both status and metric data in one script. The [nagios foundation collection](https://bonsai.sensu.io/assets/ncr-devops-platform/nagiosfoundation) is a good one to use in this case.

---

<div class="post-metadata">

**Author:** ![ohhfine](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.sensu.io/ohhfine/32/434_2.png) [@ohhfine](https://discourse.sensu.io/u/ohhfine)\
**Post date:** [July 29, 2020, 6:35pm UTC](https://discourse.sensu.io/t/from-checks-to-influxdb/1975/3 "2020-07-29T18:35:10Z")

</div>

this is very good thank you for the quick feed back, so the script i am using outputs this in event console

“CheckCPU TOTAL OK: total=0.1 user=0.0 nice=0.0 system=0.1 idle=99.9 iowait=0.0 irq=0.0 softirq=0.0 steal=0.0 guest=0.0 guest\_nice=0.0”

i will read up on the -c flag for handler but will look at your other suggestions by changing the script in the check

Thanks again Aaron
