# Provisioning datasource via config file giving error as unknown certificate

**URL:** <https://community.grafana.com/t/provisioning-datasource-via-config-file-giving-error-as-unknown-certificate/117312>\
**Category:** Prometheus\
**Created:** [March 19, 2024, 1:38am UTC](https://community.grafana.com/t/provisioning-datasource-via-config-file-giving-error-as-unknown-certificate/117312 "2024-03-19T01:38:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mamdyalv](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mamdyalv](https://community.grafana.com/u/mamdyalv)\
**Post date:** [March 19, 2024, 1:38am UTC](https://community.grafana.com/t/provisioning-datasource-via-config-file-giving-error-as-unknown-certificate/117312/1 "2024-03-19T01:38:49Z")

</div>

- What Grafana version and what operating system are you using?

- **What** are you trying to achieve?

I have 2 Prometheus urls and I am trying to add Prometheus datasource for grafana

- **How** are you trying to achieve it?

apiVersion: 1

datasources:

- name: PrometheusVPT

- Did you receive any errors in the Grafana UI or in related logs? If so, please tell us **exactly** what they were.

Error reading Prometheus: an error occured withing plugin

tls: unknown certificate

- Did you follow any online instructions? If so, what is the URL?  
Grafana documentation

---

<div class="post-metadata">

**Author:** ![codi639](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@codi639](https://community.grafana.com/u/codi639)\
**Post date:** [March 19, 2024, 7:59am UTC](https://community.grafana.com/t/provisioning-datasource-via-config-file-giving-error-as-unknown-certificate/117312/2 "2024-03-19T07:59:58Z")

</div>

Hello @mamdyalv,

I had a lot of issues with SSL/TLS certification with something else, I’ll just provide you some commands to try to figure out what could be wrong:  
First of all, check if your certificate are still up to date:

```bash
openssl x509 -enddate -noout -in <prometheus_certificate.pem> # Could be in /etc/prometheus/certs
openssl x509 -enddate -noout -in <ca_certificate.pem> # I guess /apps/certificate/csm_root_ca.pem

```

* * *

If this is okay, try to check if your prometheus\_certificate is correcly signed by your ca\_certificate:

```bash
openssl verify -CAfile <ca_certificate.pem> <prometheus_certificate.pem>

```

* * *

Finally, you can check what happen with your the TLS/SSL certification during the connection:

```auto
openssl s_client -connect fml-prometheus-nonprod.abc.com:9090

```

If you only want to see the SSL certificate and not all the detail:

```auto
openssl s_client -connect fml-prometheus-nonprod.abc.com:9090 | openssl x509

```

Let me know if you’ve been able to see any problems!

Regards

---

<div class="post-metadata">

**Author:** ![mamdyalv](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mamdyalv](https://community.grafana.com/u/mamdyalv)\
**Post date:** [March 20, 2024, 1:06pm UTC](https://community.grafana.com/t/provisioning-datasource-via-config-file-giving-error-as-unknown-certificate/117312/3 "2024-03-20T13:06:27Z")

</div>

I checked all you mentioned. Everything is seems to be okay but still I am facing error on grafana UI as:

Error reading Prometheus: an error occured within the plugin

And in grafana logs it showing error as:

Failed to parse tls ca pem certificate.  
Tls: unknown certificate

---

<div class="post-metadata">

**Author:** ![codi639](https://avatars.discourse-cdn.com/v4/letter/c/ba9def/32.png) [@codi639](https://community.grafana.com/u/codi639)\
**Post date:** [April 3, 2024, 2:26pm UTC](https://community.grafana.com/t/provisioning-datasource-via-config-file-giving-error-as-unknown-certificate/117312/4 "2024-04-03T14:26:29Z")

</div>

Hey @mamdyalv,

I’ll not be able to help you with Prometheus.

Can you show a little more of your Grafana log (please use ``` syntax), and the ssl part of your `grafana.ini` file?

Regards
