Please show what the metrics look like once scraped into Prometheus.

If you're only looking at "curl" output then you won't see these labels. 
They are added by Prometheus itself.

And if it still doesn't look right, show the actual Prometheus scrape job 
(i.e. from prometheus.yml; if that's built by some Kubernetes operator then 
show the file it builds)

On Saturday, 9 September 2023 at 17:00:21 UTC+1 sneha wrote:

> two instances are there but one of the instance get name from service in 
> this case http, and other instance is without this name. unless i check 
> with the target query i cant differentiate .
> there are two parts one is service which looks like this 
>
> apiVersion: v1
> kind: Service
> metadata:
>     name: mysqld-exporter
>     labels:
>       app: mysqld-exporter
> spec:
>   type: ClusterIP
>   ports:
>    - port: 9104
>      protocol: TCP
>      name: http
>   selector:
>    app: mysqld-exporter
>
> and other is service monitor which is like this 
>
> apiVersion: monitoring.coreos.com/v1
> kind: ServiceMonitor
> metadata:
>    name: mysqld-exporter
> spec:
>   endpoints:
>     interval: 5s
>     targetPort: 9104
> namespaceSelector:
>  matchNames:
>   - default
> selector:
>   matchLabels:
>    app: mysqld-exporter
>
>
>
> On Friday, September 8, 2023 at 9:06:33 PM UTC+5:30 Brian Candler wrote:
>
>> Prometheus adds "job" and "instance" labels to all scraped metrics.
>>
>> Therefore, show some examples of your metrics once they have been stored 
>> in Prometheus: what is in the "instance" label? Does it not already 
>> distinguish them?
>>
>> If not, then show your Prometheus scrape job configuration.
>>
>> On Friday, 8 September 2023 at 15:37:14 UTC+1 sneha wrote:
>>
>>> Hi Brian,
>>>
>>> thanks it worked , using curl i am able to scrape individual database.
>>> any idea that is it possible in openshift to distinguish that metrics is 
>>> of which instance.
>>>
>>> Regards,
>>> Sneha
>>>
>>> On Monday, September 4, 2023 at 4:05:47 PM UTC+5:30 Brian Candler wrote:
>>>
>>>> On Monday, 4 September 2023 at 10:15:06 UTC+1 sneha wrote:
>>>>
>>>> i tried adding multiple db instance in .my.cnf file with mysql exporter 
>>>> version 0.15.0 but it only scrape DB instance only.
>>>> is there any sample to use mutliple DB instance for single exporter
>>>>
>>>>
>>>> Yes, there is an example Prometheus config at
>>>> https://github.com/prometheus/mysqld_exporter/#multi-target-support
>>>> (see under "On the prometheus side ... ")
>>>>
>>>> It sets the `target` parameter for each scrape to the DB of interest, 
>>>> whilst setting __address__ to point to the exporter itself.
>>>>
>>>> Before doing this, make sure you're able to scrape the exporter 
>>>> directly using curl, i.e.
>>>> curl 'http://localhost:9104/probe?target=server1:3306'
>>>> curl 'http://localhost:9104/probe?target=server2:3306'
>>>> should give you metrics for the two servers.
>>>>
>>>> and how to distinguish scrape data is of which instance.
>>>>
>>>>
>>>> In a label.  The example config that I linked above copies 
>>>> "__param_target" to "instance", so the "instance" label tells you which DB 
>>>> target was being scraped.
>>>>
>>>

-- 
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/47eb0bf4-5522-48df-ab4d-022345d1c229n%40googlegroups.com.

Reply via email to