<p>I'm working with prometheus to scrape k8s service metrics.</p>
<p>I created a service monitor for my service as below :</p>
<pre><code>apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: scmpoll-service-monitor-{{ .Release.Name }}
  namespace: {{ .Release.Namespace }}
  labels:
    app: scmpoll-{{ template &quot;jenkins-exporter.name&quot; . }}
    chart: {{ template &quot;jenkins-exporter.chart&quot; . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  namespaceSelector:
    matchNames:
    - {{ .Release.Namespace }}
  selector:
    matchLabels:
      app: scmpoll-{{ template &quot;jenkins-exporter.name&quot; . }}
      chart: {{ template &quot;jenkins-exporter.chart&quot; . }}
      release: {{ .Release.Name }}
  endpoints:
  - interval: 1440m
    targetPort: 9759
    path: /metrics
    port: http
</code></pre>
<p>I set interval: 1440m because I want prometheus to scrape data once a day.</p>
<p>After deploying the chart, the service monitor was added to prometheus targets but with status unknown and scrape duration 0s. The screenshot below:</p>
<p><a href="https://i.stack.imgur.com/JBXzy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JBXzy.png" alt="enter image description here" /></a></p>
<p>Also I have the service monitor added to prometheus config:</p>
<pre><code>- job_name: monitoring/scmpoll-service-monitor-my-release/0
  honor_timestamps: true
  scrape_interval: 1d
  scrape_timeout: 10s
  metrics_path: /metrics
  scheme: http
</code></pre>
<p>I can see that scrape-intervel is set to 1d (24h) but the state is unknown in the screenshot above. Do I have to wait for the next 24h and check or does this mean the configuration is wrong?</p>
<p>Test : i made test with scrape 20minutes and it was the same thing : status unknow with no metrics until the 20 minutes passed and status became UP and metrics were scraped.</p>
<p>I'm not working on prometheus-operator chart, it's an independent chart.</p>

ben amara marwa
<p>It's not recommended to use Prometheus for such long <code>scrape_interval</code>. 2 minutes is suggested by many. Read this for details- <a href="https://prometheus.io/docs/prometheus/latest/querying/basics/#staleness" rel="nofollow noreferrer">Staleness</a>.</p>
<p>If you want to scrape data with interval exceeding 2 minutes, you can use <a href="https://github.com/VictoriaMetrics/VictoriaMetrics/" rel="nofollow noreferrer">VictoriaMetrics</a>. It supports time series with arbitrary long scrape intervals.</p>
