I had this guide open in a tab just in case: https://www.influxdata.com/blog/monitoring-jenkins-with-influxdb/
After Set-up we need to create/gather these piece of information from our account:
token
api tokenorganization
Free Tier accounts, this value is your emailbucket
You can create buckets, find tokens, and set the permissions in the Load Data tab at https://us-west-2-1.aws.cloud2.influxdata.com.
There are three keys
url
, URL of your the jenkins service you want to monitorusername
, login credentialspassword
, login credentials
[[outputs.influxdb_v2]]
## The URLs of the InfluxDB cluster nodes.
##
## Multiple URLs can be specified for a single cluster, only ONE of the
## urls will be written to each interval.
## urls exp: http://127.0.0.1:9999
urls = ["https://us-west-2-1.aws.cloud2.influxdata.com"]
## Token for authentication.
token = "your-api-key-here"
## Organization is the name of the organization you wish to write to; must exist.
organization = "your-organization-on-influx-cloud-account"
## Destination bucket to write into.
bucket = "a-bucket-associated-to-your-influx-cloud-account"
(note: Installation was a breeze)
References
- How to Variables - https://v2.docs.influxdata.com/v2.0/visualize-data/variables/create-variable/
- Flux docs - getting started
-
- conditionals
- windowing-aggregating - https://docs.influxdata.com/flux/v0.50/guides/windowing-aggregating/
- grouping data
The difficulty at first was trying to build the cells without looking at the data "view raw data" toggle feature. It was literally like building something blind. I took a step back and explored how the data in the raw view looked like.
The documentation for functions, aggregators, etc in the "script editor" was tremendously helpful. I feel comfortable with the "Script Editor" after some tinkering!
🚫 ✅ Figuring out how to add variables was a challenge at first because I tried to do a "Query Variable" with the hopes that if I return a table with unique "_value" per row that I would be a variable that has a "drop-down" selection like a "CSV variable". I found out after that the query variable does not work that way. So I switch it to a CSV variable and all worked great.
✅ I like the power of the variables and how it's used on the dashboard.
🚫 I wish variables could be used as values in the "customize" feature of cells. I'd use a query variable that would query for a count of unique values in a list (job names), and use this value and the upper range for a chart like the "Gauge"'s maximum threshold.
🤔 I just wrote a script with groups twice... I think I should use join()
instead of the last group()
? I have removed the script but I'm glad to have learn ahout join()
🚫 "Need Help?" I often trigger this feature due to invisible box-sizing
🚫 🤔 I created a histogram but I think i should use the histrogram()
function in it
😲 I didn't realize that the autorefresh
value at the dashboard level was a toggle for the value inside of a cell! After learning this I renamed all my cells by removing any units of time (e.g. "failures in past hour" was renamed to "failures").
jenkinsHostname
type: CSV variablejenkinsJobNames
type: CSV variablejenkinsBucket
type: CSV variable
After a few hiccups the exporting was simple. I was able to import the dashboard into my cloud account and everything worked fine once I updated the variables. Below are some notes for the exporting process.
At first I used the export feature through the UI. I noticed that it only exported as a JSON. I noticed that the examples in GitHub were in .yml
so I dived into the documentation.
Installed Influxdb locally.
Imported the dashboard from the cloud onto my local computer via JSON.
🚫 encountered a bug where I was unable to export the dashboard due to the charts using a "smoothing" alogorithmn would cause an error. Changing these charts to "linear" got me around this blocker
🚫 Encountered environment variable issue with CLI tool influx and setting a file at ~/.influxdbv2/credentials
with export INFLUX_TOKEN=TOKEN_HERE
. The file is removed (not specified in documentation that thing would happen) and the influxdb log shows an error: 2020-04-09T02:12:09.840928Z info Unauthorized {"log_id": "0M37Sdzl000", "error": "authorization not found"} . Generated a couple tokens before I stopped and tried the flag.
✅Running the CLI and setting the token with -t
flag works as expected
Documentation for INFLUX_TOKEN difference between these two pages, just something I noticed.
- https://v2.docs.influxdata.com/v2.0/reference/cli/influx/
- https://v2.docs.influxdata.com/v2.0/get-started/
I was able to export and use the -f flag to create a .yml file
Updated the file with [[inputs.jenkins]] configs