Textfile Collector Using Multiple Shell Script

123 views
Skip to first unread message

Julian Ade Putra

unread,
Jan 21, 2021, 9:48:20 AM1/21/21
to Prometheus Users
Hi Expert,

Currently, i have 2 shell script using textfile collector. Each script will throw different name of prom file like below :

[middleware@XXXXX collector]$ ll
total 12
-rw-r--r-- 1 middleware middleware 4368 Jan 21 21:24 ngssp.jms.queue.prom
-rw-r--r-- 1 middleware middleware  590 Jan 21 21:24 standalone.jms.queue.prom

But only first prom file (ngssp.jms.queue.prom) can retrieve in node exporter metrics. Please advise how can i retrieve multiple prom file using textfile collector.

Regard,
Julian.

Stuart Clark

unread,
Jan 21, 2021, 10:38:31 AM1/21/21
to Julian Ade Putra, Prometheus Users
It should work with multiple files. Are there any errors logged by the node exporter?

What are the command line options in use, and what is the content of both files?
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Julian Ade Putra

unread,
Jan 23, 2021, 10:28:40 PM1/23/21
to Prometheus Users
Hi Stuart,

There is no error i found in log. Below is content of both files :

ngssp.jms.queue.prom :
jms_queue{product="NGSSP",qdomain="OSBD1",qname="NGSSP_JMS_Logger!OSB2JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD1",qname="NGSSP_JMS_Logger!OSB1JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD1",qname="NGSSP_JMS_Logger!OSB4JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD1",qname="NGSSP_JMS_Logger!OSB3JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD11",qname="NGSSP_JMS_Logger!OSB1JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD11",qname="NGSSP_JMS_Logger!OSB3JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD12",qname="NGSSP_JMS_Logger!OSB2JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD12",qname="NGSSP_JMS_Logger!OSB1JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD12",qname="NGSSP_JMS_Logger!OSB3JMSServer@NGSSP_Logger_Q"} 0

standalone.jms.queue.prom :
jms_queue{product="STANDALONE",qdomain="StandAlone",qname="IOMFPA_JMS_Module!IOM_FPA_JMSServer5@ConFPATargetQueue"} 0
jms_queue{product="STANDALONE",qdomain="StandAlone",qname="IOMFPA_JMS_Module!IOM_FPA_JMSServer2@ConFPATargetQueue"} 0
jms_queue{product="STANDALONE",qdomain="StandAlone",qname="IOMFPA_JMS_Module!IOM_FPA_JMSServer1@ConFPATargetQueue"} 0
jms_queue{product="STANDALONE",qdomain="StandAlone",qname="IOMFPA_JMS_Module!IOM_FPA_JMSServer4@ConFPATargetQueue"} 0
jms_queue{product="STANDALONE",qdomain="StandAlone",qname="IOMFPA_JMS_Module!IOM_FPA_JMSServer3@ConFPATargetQueue"} 0

Regards,
Julian

Julius Volz

unread,
Jan 25, 2021, 9:59:37 AM1/25/21
to Julian Ade Putra, Prometheus Users
Hi Julian,

You are running into the somewhat dangerous issue https://github.com/prometheus/node_exporter/issues/1885, where if the same metric name is mentioned in multiple files and does not have an explicit HELP string set, then the Node Exporter will auto-generate the HELP string with the textfile name in the name, which then leads to conflicting HELP strings for the same metric across files, and only the first file's metrics are reported. You can work around this by adding an explicit same HELP string, like so:

File A:

# HELP jms_queue My metric help string

jms_queue{product="NGSSP",qdomain="OSBD1",qname="NGSSP_JMS_Logger!OSB2JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD1",qname="NGSSP_JMS_Logger!OSB1JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD1",qname="NGSSP_JMS_Logger!OSB4JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD1",qname="NGSSP_JMS_Logger!OSB3JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD11",qname="NGSSP_JMS_Logger!OSB1JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD11",qname="NGSSP_JMS_Logger!OSB3JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD12",qname="NGSSP_JMS_Logger!OSB2JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD12",qname="NGSSP_JMS_Logger!OSB1JMSServer@NGSSP_Logger_Q"} 0
jms_queue{product="NGSSP",qdomain="OSBD12",qname="NGSSP_JMS_Logger!OSB3JMSServer@NGSSP_Logger_Q"} 0

File B:

# HELP jms_queue My metric help string

jms_queue{product="STANDALONE",qdomain="StandAlone",qname="IOMFPA_JMS_Module!IOM_FPA_JMSServer5@ConFPATargetQueue"} 0
jms_queue{product="STANDALONE",qdomain="StandAlone",qname="IOMFPA_JMS_Module!IOM_FPA_JMSServer2@ConFPATargetQueue"} 0
jms_queue{product="STANDALONE",qdomain="StandAlone",qname="IOMFPA_JMS_Module!IOM_FPA_JMSServer1@ConFPATargetQueue"} 0
jms_queue{product="STANDALONE",qdomain="StandAlone",qname="IOMFPA_JMS_Module!IOM_FPA_JMSServer4@ConFPATargetQueue"} 0
jms_queue{product="STANDALONE",qdomain="StandAlone",qname="IOMFPA_JMS_Module!IOM_FPA_JMSServer3@ConFPATargetQueue"} 0

As I understand it, there is otherwise currently neither an error being logged, nor a metric indicating that some metrics were dropped :O (e.g. node_scrape_collector_success{collector="textfile"} is still set to 1).

Regards,
Julius

--
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 prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/5d2aa332-c291-4cdf-adf9-0127a0c6e76en%40googlegroups.com.


--
Julius Volz
PromLabs - promlabs.com

Julian Ade Putra

unread,
Jan 26, 2021, 8:12:25 AM1/26/21
to Prometheus Users
Hi Julius,

I follow your suggestion to add HELP string but still same. Yes, there is no error being logged and node_scrape_collector_success{collector="textfile"} 1. 
Any other suggestion?


Regards,
Julian

Julius Volz

unread,
Jan 26, 2021, 9:16:47 AM1/26/21
to Julian Ade Putra, Prometheus Users
Hi Julian,

it worked for me... are you sure you are setting the *same* HELP string in both files?

Julian Ade Putra

unread,
Jan 26, 2021, 9:40:23 AM1/26/21
to Prometheus Users
Hi Julius,

My bad to put different HELP sting for both file. Now, after set HELP string same for both files its works. Thanks!

Regards,
Julian

Julius Volz

unread,
Jan 26, 2021, 10:52:48 AM1/26/21
to Julian Ade Putra, Prometheus Users
Reply all
Reply to author
Forward
0 new messages