Sorry for the mistake in the above message. I created the filename with ".prom" only.
I added the --collector.textfile.directory=/var/lib/node_exporter as one of the scripts was working fine. but another file was issue. On Tuesday, 28 February 2023 at 23:25:20 UTC+5:30 Brian Candler wrote: > The problem is that the filename must end with ".prom", i.e. you need to > create "apt1.prom" not "apt1-prom" > > Also, you need to enable the functionality with a flag to node_exporter: > > node_exporter --collector.textfile.directory=/var/lib/node_exporter > > See the documentation here: > https://github.com/prometheus/node_exporter#textfile-collector > > On Tuesday, 28 February 2023 at 17:16:06 UTC Stuart Clark wrote: > >> On 28/02/2023 17:12, BHARATH KUMAR wrote: >> > Hello All, >> > >> > I want to calculate the pod age running on every server. I wrote a >> > shell script. I added this script under the folder >> /var/lib/node_exporter. >> > >> > I created a cronjob for this script to run every minute >> > * * * * * root bash /var/lib/node_exporter/custom_metrics.sh > >> > /var/lib/node_exporter/apt1-prom >> > >> > I store the above cronjob in the /etc/cron.d folder with filename: >> > prom-apt1. >> > >> > But I am not able to see the metrics I created in Prometheus UI. >> > >> > >> > >> > But similarly, I created another shell script file to fetch some >> > metrics. I followed the same procedure as above. >> > >> > * * * * * root bash /var/lib/node_exporter/custom1.sh > >> > /var/lib/node_exporter/apt-prom >> > >> > I store the above cronjob in the /etc/cron.d folder with filename: >> > prom-apt. >> > >> > The metrics which I mentioned in custom1.sh, I am able to see those >> > metrics in Prometheus UI. >> > >> > >> > Could anyone help me? >> > >> What is the contents of those files in /var/lib/node_exporter? >> >> -- >> Stuart Clark >> >> -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/96ebb6eb-31b3-44e5-b8cc-adf6b94cf1a7n%40googlegroups.com.

