Telegraf exec input make a changing data

hello everyone,

I found a problem while using exec.
my shell:

alert_test_3.sh: |
#/bin/bash
echo "IfTable,agent_host=test,hostname=test,ifDescr=test,ifType=6 ifOperStatus=1,ifAdminStatus=1"
sleep 30s
echo "IfTable,agent_host=test,hostname=test,ifDescr=test,ifType=6 ifOperStatus=2,ifAdminStatus=1"
telegraf.conf: |
[agent]
interval = "60s"
round_interval = false
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "2s"
debug = true
omit_hostname = true
[[inputs.exec]]
  commands = [
    "bash /etc/telegraf/alert_test_3.sh"
    ]
  timeout = "60s"
  data_format = "influx"

I do want to simulate a situation.
In prometheus I have an alert rule that requires an hour minimum of 1 and currently is 2.

min_over_time(IfTable_ifOperStatus{ifDescr!~"(ifType="6"}[1h]) == 1 and IfTable_ifOperStatus{ifType="6"} == 2 and IfTable_ifAdminStatus{ifType="6"} == 1

My prometheus acquisition cycle is 30s. For work reasons, I need to artificially create this kind of data to keep this alert firing.But I can only get the data after 30s, the data before 30s will not be collected.I don’t know why.I hope you can give me some advice :grimacing:

the points you are writing are identical (same key), that’s why.
the second point is updating the first one, the timestamp is the same because the timestamp is added by InfluxDB when the data is written (unless you specify it).

if you want more points using this method just write one point with echo, and lower the interval parameter to 20/30s. this way you will get more than one point in a minute (since the timestamp will differ)