Specify more than one database and/or retention policy in a tick script

Working off the example cpu_alert_stream.tick I have a dataframe defined like this:

// Dataframe
var data = stream
|from()
.database(‘metrics_cust1’)
.retentionPolicy(‘default’)
.measurement(‘cpu’)
.groupBy(‘host’)
.where(lambda: “cpu” == ‘cpu-total’)
|window()
.period(period)
.every(every)
|mean(‘usage_user’)
.as(‘stat’)
From the looks of it, if I want to monitor another database on the same influxdb server it appears I will have to make another duplicate tick script with a different name and the database field changed. I would also have to define another cpu_alert_stream.

Is there a way for me to avoid having to recreate tick scripts for say another environment? For example, prod/stg/dev. Or, cust1/cust2/cust3/.

Something like this?

.database(‘metrics_cust1’, ‘metrics_cust2’, ‘metrics_custn’)
or

.database(‘metrics_cust1’)
.database(‘metrics_cust2’)

Even if I created a new stream per database, I’d still end up having to create another similar tick_script.

@dashvvv This is a usecase for templated .tick scripts. There is some documentation here.