Julius - THANX
I did exactly this, and it works!
I think I was tricked by docker and the access right to the directory. The 
volume I mount is now owned by the same user as the one running 
pushgateway. 
without chmod 777 or controlling the user access I could not write.

Super - I got it.

On Wednesday, January 20, 2021 at 1:02:05 AM UTC+1 [email protected] 
wrote:

> Hi Peter, I just tried it locally with Pushgateway built from HEAD and the 
> persistence across restarts works fine for me (pushed metrics are still 
> present after a restart).
>
> Maybe in your Docker setup the problem is that you are directly mounting 
> in a single file, could you try passing the surrounding directory as the 
> volume instead? See also 
> https://forums.docker.com/t/sharing-a-single-file-via-a-volume-mount-does-not-work-as-expected/57088
>
> On Tue, Jan 19, 2021 at 10:56 AM Peter Toft <[email protected]> wrote:
>
>> Is anyone using this feature? Seems to be broken to mo and I cannot see 
>> any logs from this.
>>
>> On Friday, January 15, 2021 at 5:39:07 PM UTC+1 Peter Toft wrote:
>>
>>> The default is 5 minutes which is super for me. But I do not see 
>>> anything happening
>>>
>>>
>>>
>>> On Friday, January 15, 2021 at 3:23:17 PM UTC+1 Julien Pivotto wrote:
>>>
>>>> I think that this is flushed on disk at regular interval: 
>>>> --persistence.interval 
>>>>
>>>> On 15 Jan 06:08, Peter Toft wrote: 
>>>> > Thanx for the comment Julien. 
>>>> > I try exactly this with 
>>>> > pushgateway: 
>>>> > container_name: pushgateway 
>>>> > image: prom/pushgateway 
>>>> > ports: 
>>>> > - 9091:9091 
>>>> > volumes: 
>>>> > - ./pushgateway.txt:/var/log/pushgateway.txt 
>>>> > command: 
>>>> > - '--web.enable-admin-api' 
>>>> > - '--persistence.file=/var/log/pushgateway.txt' 
>>>> > 
>>>> > but I tried to login to the docker instance - the 
>>>> /var/log/pushgateway.txt 
>>>> > is empty :-( 
>>>> > 
>>>> > On Friday, January 15, 2021 at 2:00:43 PM UTC+1 Julien Pivotto wrote: 
>>>> > 
>>>> > > You will need to use a docker volume to save the file across 
>>>> restarts. 
>>>> > > 
>>>> > > On 15 Jan 03:36, Peter Toft wrote: 
>>>> > > > Thanx Stuart 
>>>> > > > I use docker where I just now added - 
>>>> > > > '--persistence.file=/var/log/pushgateway.txt' 
>>>> > > > It does not seem to give persistence. 
>>>> > > > 
>>>> > > > version: '3.3' 
>>>> > > > services: 
>>>> > > > pushgateway: 
>>>> > > > container_name: pushgateway 
>>>> > > > image: prom/pushgateway 
>>>> > > > ports: 
>>>> > > > - 9091:9091 
>>>> > > > volumes: 
>>>> > > > - ./pushgateway.txt:/var/log/pushgateway.txt 
>>>> > > > command: 
>>>> > > > - '--web.enable-admin-api' 
>>>> > > > - '--persistence.file=/var/log/pushgateway.txt' 
>>>> > > > prometheus: 
>>>> > > > container_name: prometheus 
>>>> > > > image: prom/prometheus 
>>>> > > > volumes: 
>>>> > > > - ./prometheus.yml:/etc/prometheus/prometheus.yml 
>>>> > > > ports: 
>>>> > > > - 9090:9090 
>>>> > > > command: 
>>>> > > > - '--config.file=/etc/prometheus/prometheus.yml' 
>>>> > > > - '--web.enable-admin-api' 
>>>> > > > - '--storage.tsdb.retention.time=1y' 
>>>> > > > grafana: 
>>>> > > > container_name: grafana 
>>>> > > > image: grafana/grafana 
>>>> > > > volumes: 
>>>> > > > - ./config/grafana.ini:/etc/grafana/grafana.ini 
>>>> > > > ports: 
>>>> > > > - 3000:3000 
>>>> > > > 
>>>> > > > 
>>>> > > > On Friday, January 15, 2021 at 11:02:59 AM UTC+1 Stuart Clark 
>>>> wrote: 
>>>> > > > 
>>>> > > > > The push gateway supports a persistence file via the 
>>>> > > --persistence.file 
>>>> > > > > parameter to allow cached metrics to survive restarts. 
>>>> > > > > 
>>>> > > > > On 15 January 2021 09:46:18 GMT, Peter Toft <[email protected]> 
>>>>
>>>> > > wrote: 
>>>> > > > >> 
>>>> > > > >> Hi guys 
>>>> > > > >> 
>>>> > > > >> I use a pushgateway -> prometheus -> grafana system to display 
>>>> > > simulation 
>>>> > > > >> metrics, and when I reboot the server I loose all the metrics 
>>>> I have 
>>>> > > in the 
>>>> > > > >> pushgateway. They appear when I have rerun my external test 
>>>> server 
>>>> > > pushing 
>>>> > > > >> metrics. 
>>>> > > > >> 
>>>> > > > >> If I know that there is a reboot of the pushgateway coming. Is 
>>>> there 
>>>> > > a 
>>>> > > > >> simple'ish way to save and after a reboot restore these 
>>>> metrics? 
>>>> > > > >> 
>>>> > > > >> Have a nice day 
>>>> > > > >> 
>>>> > > > >> /Peter 
>>>> > > > >> 
>>>> > > > >> 
>>>> > > > > -- 
>>>> > > > > Sent from my Android device with K-9 Mail. Please excuse my 
>>>> brevity. 
>>>> > > > > 
>>>> > > > 
>>>> > > > -- 
>>>> > > > You received this message because you are subscribed to the 
>>>> Google 
>>>> > > Groups "Prometheus Users" group. 
>>>> > > > To unsubscribe from this group and stop receiving emails from it, 
>>>> send 
>>>> > > an email to [email protected]. 
>>>> > > > To view this discussion on the web visit 
>>>> > > 
>>>> https://groups.google.com/d/msgid/prometheus-users/821d1de4-c59d-4cd9-938a-8e23dab2b2cbn%40googlegroups.com
>>>>  
>>>> > > . 
>>>> > > 
>>>> > > 
>>>> > > -- 
>>>> > > Julien Pivotto 
>>>> > > @roidelapluie 
>>>> > > 
>>>> > 
>>>> > -- 
>>>> > You received this message because you are subscribed to the Google 
>>>> Groups "Prometheus Users" group. 
>>>> > To unsubscribe from this group and stop receiving emails from it, 
>>>> send an email to [email protected]. 
>>>> > To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/prometheus-users/a2359aa2-ba16-4862-9831-6aefb7f7d88dn%40googlegroups.com.
>>>>  
>>>>
>>>>
>>>>
>>>> -- 
>>>> Julien Pivotto 
>>>> @roidelapluie 
>>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Prometheus Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/prometheus-users/dcecdd83-5fca-4fb5-a155-dbf477f1cce3n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/prometheus-users/dcecdd83-5fca-4fb5-a155-dbf477f1cce3n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Julius Volz
> PromLabs - promlabs.com
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/3f2cb90d-eca6-4eaa-9757-69b70c567f8fn%40googlegroups.com.

Reply via email to