jenkinsci / prometheus-plugin

Jenkins Prometheus Plugin
https://plugins.jenkins.io/prometheus/
Apache License 2.0
181 stars 151 forks source link

403 Forbidden or Unauthorized errror: while trying to access (http://<jenkins_pubip>:Port/prometheus) path even trying with a Read user with API generated token, the issue persist. #674

Closed waseemshaik1993 closed 2 months ago

waseemshaik1993 commented 3 months ago

Jenkins and plugins versions report

Environment ```text Paste the output here ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Ubuntu

Reproduction steps

Install Promtheus plugin into Jenkins management console.

Expected Results

NA

Actual Results

image

Anything else?

No

Are you interested in contributing a fix?

Yes

Waschndolos commented 3 months ago

Did you check: https://github.com/jenkinsci/prometheus-plugin/blob/master/docs/configuration/configuration.md#enable-authentication-for-prometheus-end-point? Any logs?

waseemshaik1993 commented 3 months ago

See I have checked the option enable authentication for Prometheus end point and tried accessing URL. Still the issue persists I can't be able to access the Jenkins Metrics. FYR below is the snip of the configuration and output:

Screenshot 2024-06-06 120721 Screenshot 2024-06-06 121213
waseemshaik1993 commented 3 months ago

Please guide me to get over this issue.

Waschndolos commented 3 months ago

@waseemshaik1993 try to remove the / in the Path configuration. It should be enough to simply have prometheus in there without the /

waseemshaik1993 commented 3 months ago

@Waschndolos I have removed the / in the path configuration. Restarted the jenkins and again tried but the issue persists. What would be the next step, please do let me know.

Screenshot 2024-06-06 142442
Waschndolos commented 3 months ago

@waseemshaik1993. I would check the following:

waseemshaik1993 commented 3 months ago

@Waschndolos Please check the following: • If the authentication is disabled, still plugin is not working. I mean not able to see metrics while accessing http://jenkins-ip/8080/prometheus
• Can you please tell me which logs, these are the system logs checked in Jenkins:

Screenshot 2024-06-07 110648
• Yes, tried checking first by enabling it and then by disabling as well. But no use.
• Yes I created a new user 'prometheus' gave all the permissions to read/view metrics
• Yes, matrix authorization strategy plugin installed and already gave permissions to user 'prometheus' metrics.view. Please check below snip
Screenshot 2024-06-07 110207
Waschndolos commented 3 months ago

@waseemshaik1993. I just tested it with the latest version - works without an issue on my side. What I've seen is that when I didn't yet installed the prometheus plugin I had the same page as you. Maybe the update of the plugin failed somehow and is now in a strange state. You may go ahead and save a screenshot of your configuration of the prometheus plugin and then go ahead and uninstall and reinstall the plugin. Don't know what else could be the issue

Waschndolos commented 3 months ago

Is it still an issue?

waseemshaik1993 commented 3 months ago

Is it still an issue?

@Waschndolos Yes, the issue persists till now. I am not sure what exactly the issue is. I provided you all the details below.

Manage Jenkins Errors:

Jenkins 0 Jenkins 1 Jenkins 3 Jenkins 4

Plugin-Updates required:

Jenkins 5

![image](https://github.com/jenkinsci/prometheus-plugin/assets/96241675/1e8c8eae-184c-48f6-8ced-585757008297

Installed Prometheus Plugins

Jenkins 6

And this the prometheus configurations: image

As per my understanding it may also be the version issue? i am not sure. Please go through and give me some suggestions.

Regards, Mohammed WAseem Shaik

Waschndolos commented 3 months ago

Have you uninstalled the plugin and reinstalled it?

waseemshaik1993 commented 3 months ago

Have you uninstalled the plugin and reinstalled it?

I did that, but i'll try reinstalling it again and let you know.

waseemshaik1993 commented 3 months ago

Hi @Waschndolos I have tried reinstalling the prometheus plugin into jenkins. Please find below observations:

image
Waschndolos commented 3 months ago

I guess you also restarted Jenkins afterwards. Puh.. no clue...

I guess it is an issue on your Jenkins instance as Nobody else reported any similar issue. Maybe a missing Dependency or a Plugin crashing on startup. Something like that. Maybe Check for exceptions in the Jenkins Controller log while startup. You may also Check the right Java Version for the Controller. Unfortunately I will be offline for the next 2 weeks.