I want to write the metrics of a Prometheus input in a file using telegraf output plugin in azure kubernetes services.
This is my configmap YAML:
apiVersion: v1
kind: ConfigMap
metadata:
name: telegraf
labels:
k8s-app: telegraf
data:
telegraf.conf: |+
[global_tags]
env = "$ENV"
[agent]
hostname = "$HOSTNAME"
[[inputs.prometheus]]
urls = ["http://10.240.0.4:30121/metrics"]
[[outputs.file]]
files = ["stdout","metrics.out"]
data_format = "graphite"
I could verify that scraping is happening by performing logs on Telegraf pod but I couldn't find the output file "metrics.out" anywhere in my directory.
This is a part of the logs of Telegraf pod:
aks-agentpool-26375359-vmss00000i.prod.http:--10_240_0_4:30121-metrics.process_virtual_memory_bytes.gauge 1.19939072e+08 1624612150
aks-agentpool-26375359-vmss00000i.prod.http:--10_240_0_4:30121-metrics.mongodb_instance_uptime_estimate_seconds.counter 947 1624612150
aks-agentpool-26375359-vmss00000i.admin.prod.http:--10_240_0_4:30121-metrics.mongodb_mongod_db_data_size_bytes.gauge 59 1624612150
aks-agentpool-26375359-vmss00000i.config.prod.http:--10_240_0_4:30121-metrics.mongodb_mongod_db_data_size_bytes.gauge 99 1624612150
aks-agentpool-26375359-vmss00000i.local.prod.http:--10_240_0_4:30121-metrics.mongodb_mongod_db_data_size_bytes.gauge 1994 1624612150
aks-agentpool-26375359-vmss00000i.admin.prod.http:--10_240_0_4:30121-metrics.mongodb_mongod_db_objects_total.gauge 1 1624612150
aks-agentpool-26375359-vmss00000i.config.prod.http:--10_240_0_4:30121-metrics.mongodb_mongod_db_objects_total.gauge 1 1624612150
aks-agentpool-26375359-vmss00000i.local.prod.http:--10_240_0_4:30121-metrics.mongodb_mongod_db_objects_total.gauge 1 1624612150
aks-agentpool-26375359-vmss00000i.prod.reader.http:--10_240_0_4:30121-metrics.mongodb_mongod_global_lock_client.gauge 0 1624612150
aks-agentpool-26375359-vmss00000i.prod.writer.http:--10_240_0_4:30121-metrics.mongodb_mongod_global_lock_client.gauge 0 1624612150
aks-agentpool-26375359-vmss00000i.prod.http:--10_240_0_4:30121-metrics.go_memstats_gc_cpu_fraction.gauge 3.805405699243547e-05 1624612150
aks-agentpool-26375359-vmss00000i.prod.http:--10_240_0_4:30121-metrics.mongodb_exporter_last_scrape_error.gauge 0 1624612150
aks-agentpool-26375359-vmss00000i.prod.networkInProgress.http:--10_240_0_4:30121-metrics.mongodb_mongod_metrics_repl_executor_queue.gauge 0 1624612150