Access denied-Prometheus

Hi everyone!

I’m testing monitoring with Prometheus and the SNMP Exporter, but I get an ‘Access Denied’ error when I try to add Prometheus as a data source as http://localhost:9090. Has anyone run into this before or know how to fix it?

Cheers,
Ori

Hi,

Do you use Grafana could? If so, where is Prometheus instance? Also in Grafana Cloud or do you self host prometheus?

Hi @dawiddebowski

Thanks for your reply!
My Prometheus instance is self-hosted and installed in the ‘documents’ directory.
I’m manually launching the prometheus.exe file from the command line each time, and trying to access it from Grafana. Do you have any suggestions or ideas?

Ori


Past this prometheus.yml script mention below

global:
scrape_interval: 15s

scrape_configs:

  • job_name: ‘prometheus’
    static_configs:

    • targets: [‘localhost:9090’]
  • job_name: ‘snmp’
    static_configs:

    • targets:
      • 192.168.1.1 # ← replace with your network device IP
        metrics_path: /snmp
        params:
        module: [if_mib] # ← default module name in snmp.yml
        relabel_configs:
    • source_labels: [address]
      target_label: __param_target
    • source_labels: [__param_target]
      target_label: instance
    • target_label: address
      replacement: localhost:9116 # SNMP Exporter host and port

Run command
C:\Prometheus>prometheus.exe --config.file=prometheus.yml --web.listen-address=“0.0.0.0:9090”

Hi @infofcc3

I just adjusted the .yml file and run command that you mentioned, but does not work and still access denied on Grafana side…strange…

Do you have any idea?
Ori

Type this in chrome url and see this is the screen. if not then prometheus not run.
http://localhost:9090/

Windows Firewall Port 9090 Allow

  1. Open Windows Defender Firewall
  2. Go to Advanced Settings
  3. Create New Inbound Rule:
  • Type: Port
  • Port: 9090
  • Protocol: TCP
  • Action: Allow the connection
  • Apply to: Domain, Private, Public
  • Name: Prometheus Access

Where is your grafana install, on prem or cloud?

@infofcc3 This is my firewall config here.

and the Prometheus instance seems to be running.

but it doesn’t work…

Hi @yosiasz

I believe my Grafana is installed locally. I’ll attach my service config.

For same config file it will run. i was run on different laptop. install grafana, downlode prometheus and change prometheus.yml file after save and test. it will run and display logs.

Hi @infofcc3

Thanks for your reply and sorry for delay.

I just re-install the grafana and trying to connect with prometheus in datasource section but problem happened again… will attach here the current all config related to this integration.

Prometheus instance

prometheus.yml

Grafana datasouce section

firewall setting window

please mail your anydesk id aryan.goswami@dataabsolute.com i am try to connect your desktop and solving the problem.

@infofcc3

Thanks, I just send it to you.

Right now, I still haven’t been able to resolve this issue. Since it works with my local Grafana setup but not with Grafana Cloud, I suspect the problem lies somewhere between Prometheus and Grafana Cloud. Could anyone offer some advice?

Hello guys @infofcc3 @dawiddebowski @yosiasz
Since the local setup of Grafana, Prometheus, and the SNMP Exporter is working fine, I’m starting to suspect the issue lies with Grafana Cloud and Prometheus. Do you have any suggestions or solutions for this?

Absolutely, you can use “localhost” in Grafana Cloud. How it will know which localhost is it, yours, mine,…?

Be familiar with localhost concept, then also with ssh tunneling first. Then you will be able to use/understand PDC:

If you have local instance of prometheus, you’ll have to somehow expose it to the internet, so Grafana Cloud can actually connect to it (if you for example run a REST API on your local computer on port 8080, you cannot access it from your phone on localhost:8080, right?). AFAIK Grafana Cloud comes with metrics storage, so you can send the data from your prometheus instance (probably something here would help). Just notice that there’s a pricing tier for the metrics you’ll send and store.

1 Like

@dawiddebowski Hello Thanks for your info.
Now, the connection issue between Grafana Cloud and the local Prometheus has been resolved! the root cause was the presence of unnecessary angle brackets within the basic_auth: section of the prometheus.yml file, even though the remote_write URLand other settings were correctly specified. Below are examples of a bad and a good config.

Bad Examble:

basic_auth:
  username: "<167263>"
  password: "<abc_xxxxxxxxxxxxxxxxx>"

Good Example:

basic_auth:
  username: "167263"
  password: "abc_xxxxxxxxxxxxxxxxx"

Thank you everyone for your support! @yosiasz @jangaraj @infofcc3 @dawiddebowski

Best,
Ori

2 Likes