Comments (16)
@danilorsilva the prometheus serviceaccount cant access the namespace. The account should be system:serviceaccount:openshift-monitoring:prometheus-k8s
from cluster-monitoring-operator.
Can you check if the label selectors of your ServieMonitor are matching the labels of your Service?
from cluster-monitoring-operator.
Yes, the labels are okay,
from cluster-monitoring-operator.
Can you share the ServiceMonitor object? Did you also configure the endpoints path to scrape /prometheus
? If one of these things in the ServiceMonitor do not match, it the target will be dropped during discovery.
from cluster-monitoring-operator.
@danilorsilva i have run in too the same problems while configuring heketi-metrics in the prometheus instance. Some tips to cross off your list if you are using the default Prometheus instance:
- is the servicemonitoring in the correct space?
- is the namespace/project correctly labeled to allow scraping
- did you grant the prometheus service account the rights to use the selector in the servicemonitor?
- What do the logs say from the prometheus pods and config-reloader?
from cluster-monitoring-operator.
1 - The ServiceMonitor must be on the same namespace/project that the service that i want to scrape? Or the ServiceMonitor must be on openshit-monitoring namespace and only set the namespace target inside the servicemonitor file?
2 - I put openshift.io/cluster-monitoring=true
label on the namespace.
from cluster-monitoring-operator.
The ServiceMonitor must be on openshit-monitoring namespace and only set the namespace target inside the servicemonitor file?
the servicemonitor must be in the openshift-monitoring namespace with a correct selector
from cluster-monitoring-operator.
What i did @Rikbruggink :
I have a namespace named test
and i set the label openshift.io/cluster-monitoring=true
to be monitored by the CMO.
Inside this namespace i have a pod and a service. This service has the label app: api-mobile and handle the requests to this pod.
I have created this servicemonitor:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
k8s-app: api-mobile-servicemonitor
name: api-mobile-servicemonitor
namespace: openshift-monitoring
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
interval: 30s
port: 8080-tcp
path: /prometheus
namespaceSelector:
matchNames:
- test
selector:
matchLabels:
app: api-mobile
The k8s-app is the label that i need to set on ServiceMonitor to be scraped bu Prometheus and load the configuration.
from cluster-monitoring-operator.
Did you grant the prometheus user rights to view the namespace?
from cluster-monitoring-operator.
No @Rikbruggink , how can i set this permission? Could you help me?
from cluster-monitoring-operator.
I can see my configuration on the "Configuration" option on Prometheus Web Interface, but i cannot see on "Targets" or "Service Discovery".
from cluster-monitoring-operator.
the command for that would be oc adm policy add-role-to-user view/edit/admin prometheus-serviceaccount. choose the role that you think is needed and use the correct serviceaccount
from cluster-monitoring-operator.
Okay, i will test and let you know. Thanks!
from cluster-monitoring-operator.
oc adm policy add-cluster-role-to-user cluster-admin system:serviceaccounts:prometheus-k8s
Without sucess.
from cluster-monitoring-operator.
I did a test with a Nginx + Service + ServiceMonitor on openshift-monitoring namespace, and it wotks. The problem is when i use another namespace.
from cluster-monitoring-operator.
@Rikbruggink my hero! It works!! Thank so much!
from cluster-monitoring-operator.
Related Issues (20)
- Support `Probe` resources HOT 3
- {Request} Ability to configure Prometheus Exporters HOT 5
- Invalid externalURL since ad2d747f2ef037647ebc9f7d5b22118d0dab4bd2 HOT 4
- Release 4.12 Checklist HOT 3
- Missing Metrics in Prometheus on openshift 3.11 HOT 4
- User workload prometheus scraps targets managed by monitoring prometheus instance HOT 4
- Release 4.13 Checklist HOT 5
- crio metrics via http is not safe HOT 7
- Allow kube-state-metrics configuration HOT 3
- Reject invalid PrometheusRule objects beforehand rather than failing the reconciliation HOT 5
- Alerts generated by user-workload-monitoring are not included in remoteWrite HOT 4
- typo in 4.14 CHANGELOG.md and CONTRIBUTING.md HOT 3
- OpenTelemetry Support HOT 16
- kubelet metrics not working in after upgrade to OKD 4.13 HOT 12
- wrong annotation for ThanosRulerConfig.Resources HOT 1
- I can't increase Prometheus startupProbe failureThreshold value HOT 6
- user-workload-monitoring doesn't support honoring labels HOT 4
- Additional Scrape Configuration is not supported HOT 8
- How to change default servicemonitors interval HOT 5
- Support enableRemoteWriteReceiver flag in prometheus{,K8s} config HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cluster-monitoring-operator.