Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not lock /prometheus/DIRTY, Prometheus already running? #1060

Closed
djenriquez opened this Issue Sep 8, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@djenriquez
Copy link

djenriquez commented Sep 8, 2015

Hello,

I am having some trouble configuring Prometheus. I currently seem to keep running into this problem:

prometheus, version 0.15.1 (branch: master, revision: 64349aa)
  build user:       julius@julius-thinkpad
  build date:       20150727-17:56:51
  go version:       1.4.2
time="2015-09-08T05:40:04Z" level=info msg="Loading configuration file /etc/prometheus/prometheus.yml" file=main.go line=173 
time="2015-09-08T05:40:04Z" level=info msg="Loading series map and head chunks..." file=storage.go line=263 
time="2015-09-08T05:40:04Z" level=info msg="0 series loaded." file=storage.go line=268 
time="2015-09-08T05:40:04Z" level=info msg="Starting target manager..." file=targetmanager.go line=75 
time="2015-09-08T05:40:04Z" level=info msg="Listening on :9090" file=web.go line=186 
prometheus, version 0.15.1 (branch: master, revision: 64349aa)
  build user:       julius@julius-thinkpad
  build date:       20150727-17:56:51
  go version:       1.4.2
time="2015-09-08T05:40:05Z" level=info msg="Loading configuration file /etc/prometheus/prometheus.yml" file=main.go line=173 
time="2015-09-08T05:40:05Z" level=error msg="Could not lock /prometheus/DIRTY, Prometheus already running?" file=persistence.go line=178 
time="2015-09-08T05:40:05Z" level=error msg="Error opening memory series storage: resource temporarily unavailable" file=main.go line=116 
prometheus, version 0.15.1 (branch: master, revision: 64349aa)
  build user:       julius@julius-thinkpad
  build date:       20150727-17:56:51
  go version:       1.4.2
time="2015-09-08T05:40:06Z" level=info msg="Loading configuration file /etc/prometheus/prometheus.yml" file=main.go line=173 
time="2015-09-08T05:40:06Z" level=error msg="Could not lock /prometheus/DIRTY, Prometheus already running?" file=persistence.go line=178 
time="2015-09-08T05:40:06Z" level=error msg="Error opening memory series storage: resource temporarily unavailable" file=main.go line=116 
prometheus, version 0.15.1 (branch: master, revision: 64349aa)
  build user:       julius@julius-thinkpad
  build date:       20150727-17:56:51
  go version:       1.4.2
time="2015-09-08T05:40:07Z" level=info msg="Loading configuration file /etc/prometheus/prometheus.yml" file=main.go line=173 
time="2015-09-08T05:40:07Z" level=error msg="Could not lock /prometheus/DIRTY, Prometheus already running?" file=persistence.go line=178 
time="2015-09-08T05:40:07Z" level=error msg="Error opening memory series storage: resource temporarily unavailable" file=main.go line=116 
prometheus, version 0.15.1 (branch: master, revision: 64349aa)
  build user:       julius@julius-thinkpad
  build date:       20150727-17:56:51
  go version:       1.4.2

When I use the example configuration from the Getting Started guide, everything works fine:

global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.
  evaluation_interval: 15s # By default, scrape targets every 15 seconds.
  # scrape_timeout is set to the global default (10s).

  # Attach these extra labels to all timeseries collected by this Prometheus instance.
  labels:
    monitor: 'codelab-monitor'

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s
    scrape_timeout: 10s

    target_groups:
      - targets: ['localhost:9090']

However, it seems that if i change this file in ANYWAY, for example, remove the # Override the global defaults and scrape targets from this job every 5 seconds. line, the logs start reporting this DIRTY issue.

In fact, even removing the blank lines like this configuration:

global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.
  evaluation_interval: 15s # By default, scrape targets every 15 seconds.
  # scrape_timeout is set to the global default (10s).

  # Attach these extra labels to all timeseries collected by this Prometheus instance.
  labels:
    monitor: 'codelab-monitor'

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'
    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s
    scrape_timeout: 10s
    target_groups:
      - targets: ['localhost:9090']

ends up throwing the same error.

I am running Prometheus in a docker container, incase that matters.

Any idea what is going on?

@beorn7

This comment has been minimized.

Copy link
Member

beorn7 commented Sep 8, 2015

Looks like Prometheus cannot write into the directory you have configured as storage location (configured by flag -storage.local.path). Why changing the config changes that, is a mystery to me. Perhaps Docker somehow changes write access if you change something in your container?

@djenriquez

This comment has been minimized.

Copy link
Author

djenriquez commented Sep 8, 2015

The problem was related to how I was building my docker image from my Dockerfile. Using the RUN command, I created the /prometheus folder which i then extracted the tar.gz file into. I then moved the items into their appropriate locations in /bin/ and /etc/prometheus. After the RUN command, I set VOLUME ["/prometheus"].

I did some rearranging, by setting VOLUME ["/prometheus"] before the RUN command, and used a different folder to extract the tar.gz contents into: /tmp/prometheus/

After this, everything was fine.

@beorn7

This comment has been minimized.

Copy link
Member

beorn7 commented Sep 8, 2015

Glad to hear. :)

@beorn7 beorn7 closed this Sep 8, 2015

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 24, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.