Quick Start to Using Influxdb on Macos
Intro
OSS 2.0 is a release candidate at this time, so this may change once it’s released.
It wasn’t quite clear to me how to get up and running quickly with a docker based setup for OSS 2.0 version, so this may save you some time if you are interested. It also should be very similar to the Windows workflow excepting the basic brew
commands and service install commands you’ll just want to flip over to choco install telegraf
.
Docker Compose
Grabbed this from a comment and modified the ports as the were flipped from the 9999
range used during first early access.
|
|
The main modifications I made was ensuring it auto started.
Access the instance on localhost:8086
.
Telegraf
It’s pretty straight-forward using homebrew. brew install telegraf
The configuration file is created by default at: /usr/local/etc/telegraf.conf
as well as the telegraf.d
directory.
I’m still a bit new on macOS, so once I opened Chronograf, I wanted to try the new http based configuration endpoint, so I used the web gui to create a telegraf config for system metrics and tried replacing the telegraf.conf
reference in the plist file.
This didn’t work for me as I couldn’t get the environment variable for the token to be used, so I ended up leaving it as is, and instead edited the configuration.
brew services stop telegraf
micro /usr/Local/Cellar/telegraf/1.15.3/homebrew.mxcl.telegraf.plist
I updated the configuration (see line 16) unsuccessfully with the http config endpoint.
|
|
What worked for me was to edit: micro /usr/local/etc/telegraf.conf
and add the following (I set the token explicitly in my test case).
|
|
- Start service with
brew services restart telegraf
and it should start sending data. - NOTE: I’m still getting the hang of brew and service management on Linux/macOS, so the first time I did this it didn’t work and I ended up starting it using
telegraf -config http://localhost:8086/api/v2/telegrafs/068ab4d50aa24000
and just running initially in my console (having already set theINFLUX_TOKEN
environment variable) Any comments on if I did something wrong here would be appreciated 😁 I’m pretty sure the culprit is the need for theINFLUX_TOKEN
environment variable and I’m not sure if the service load with brew is actually sourcing the.profile
I put this in. Maybe I can pass it explicitly?
Additional Monitoring
This is a work in progress. I found GitHub Issue #3192 and used it as a starting point to experiment with getting a “top processes” for evaluating what specifically was impacting my systems at the time of a spike. I’ll update this once I’ve gotten things further improved.
|
|
Final Result
I like the final result. Dark theme for the win.
I’ve had some spikes in Vscode recently, impacting my CPU so I’ve been meaning to do something like this for a while, but finally got it knocked out today once I realized there was a 2.0 docker release I could use to get up and running easily. Next step will be to add some process level detail so I can track the culprit (probably VScode + Docker Codespaces).
Wishlist
- Pretty formatting of date/time like Grafana does, such as converting seconds into hour/minutes.
- Log viewing api so I could query cloudwatch logs like Grafana offers without needing to ingest.
- Edit existing telegraf configuration in the load data section. Right now I can’t edit.
- MSSQL Custom SQL Server query plugin to be released 😁 Issue 1894 & PR 3069 Right now I’ve done custom exec based queries using dbatools and locally included PowerShell modules. This sorta defeats the flexibility of having a custom query call so I can minimize external dependencies.
Webmentions