Regarding Setting High Retension for storage

274 views
Skip to first unread message

Aravind Viswanathan

unread,
Sep 8, 2020, 4:31:07 AM9/8/20
to Prometheus Users
Hi All,
I am new to Prometheus and noticed that the data in my Prometheus Server is defaulted to 15days and we would like to have the data for more than 1Y.

I have updated my configuration to ,

[Unit]
  Description=Prometheus Monitoring
  Wants=network-online.target
  After=network-online.target

[Service]
  User=prometheus
  Group=prometheus
  Type=simple
  ExecStart=/usr/local/bin/prometheus \
  --config.file /etc/prometheus/prometheus.yml \
  --storage.tsdb.path /var/lib/prometheus/ \
  --web.console.templates=/etc/prometheus/consoles \
  --web.console.libraries=/etc/prometheus/console_libraries
  ExecReload=/bin/kill -HUP $MAINPID
  --storage.tsdb.retention.time=1y

[Install]
  WantedBy=multi-user.target
~
~
Then i restarted Prometheus Service in Ubuntu
Navigated to status >> Runtime and Build Information i see
Storage Retention  as 15 Days
Also, navigated to  command line flags and i still see 

storage.tsdb.retention : 0s
storage.tsdb.retention.size : 0s
storage.tsdb.retention.time : 0s.

Is there something that i am missing?

Regards
Aravind Viswanathan. 

Brian Candler

unread,
Sep 8, 2020, 5:50:35 AM9/8/20
to Prometheus Users
Yes, you put the flag in the wrong place.  Add it to the end of the ExecStart line, not to the ExecReload line.

Aravind Viswanathan

unread,
Sep 8, 2020, 8:24:10 AM9/8/20
to Brian Candler, Prometheus Users
Thanks Brian,

Is this Correct?

[Unit]
  Description=Prometheus Monitoring
  Wants=network-online.target
  After=network-online.target

[Service]
  User=prometheus
  Group=prometheus
  Type=simple
  ExecStart=/usr/local/bin/prometheus \
  --config.file /etc/prometheus/prometheus.yml \
  --storage.tsdb.path /var/lib/prometheus/ \
  --web.console.templates=/etc/prometheus/consoles \
  --web.console.libraries=/etc/prometheus/console_libraries
  --storage.tsdb.retention.time=1y
  ExecReload=/bin/kill -HUP $MAINPID
 

[Install]
  WantedBy=multi-user.target
~
~

On Tue, Sep 8, 2020 at 3:20 PM Brian Candler <b.ca...@pobox.com> wrote:
Yes, you put the flag in the wrong place.  Add it to the end of the ExecStart line, not to the ExecReload line.

--
You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/rj695eUHMQA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/2bc6d8ff-8e41-4266-8139-9238c7798cdco%40googlegroups.com.


--
Thanks                                                                 

Aravind.V

Mobile:+91. 8197177674

Emailv_6...@hotmail.com, arw...@gmail.com

Brian Candler

unread,
Sep 8, 2020, 8:27:51 AM9/8/20
to Prometheus Users
Not quite.  Since you're splitting the command line over multiple lines, you need a trailing space and backslash after "console_libraries" to join it to the next line.

Aravind Viswanathan

unread,
Sep 9, 2020, 1:21:53 AM9/9/20
to Brian Candler, Prometheus Users
Hi Brian,

Thanks for the help.

OK After i did that and restarting the services I see the following under Command-Line Flags,

storage.tsdb.retention  : 0s
storage.tsdb.retention.size : 0B
storage.tsdb.retention.time: 1y

Is that correct or do I need to make any other configuration changes?
Regards
Aravind Viswanathan.
 

On Tue, Sep 8, 2020 at 5:57 PM Brian Candler <b.ca...@pobox.com> wrote:
Not quite.  Since you're splitting the command line over multiple lines, you need a trailing space and backslash after "console_libraries" to join it to the next line.

--
You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/rj695eUHMQA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prometheus-use...@googlegroups.com.

Brian Candler

unread,
Sep 9, 2020, 3:04:36 AM9/9/20
to Prometheus Users
The storage retention change is complete.
Reply all
Reply to author
Forward
0 new messages