Giter Club home page Giter Club logo

passenger_exporter's Introduction

************************
passenger_exporter_nginx
------------------------

This is a Prometheus exporter for passenger with nginx integration.

https://www.phusionpassenger.com/

*********************
Building the Exporter
---------------------

The default Makefile target creates a statically linked binary for Linux.

A Dockerfile and Makefile target are also supplied:

make build-docker

********************
Running the Exporter
--------------------

Usage of passenger_exporter_nginx:
  -log.format value
      If set use a syslog logger or JSON logging.
      Example: logger:syslog?appname=bob&local=7 or logger:stdout?json=true.
      Defaults to stderr.
  -log.level value
      Only log messages with the given severity or above.
      Valid levels: [debug, info, warn, error, fatal]. (default info)
  -passenger.command string
      Passenger command for querying passenger status.
      (default "passenger-status --show=xml")
  -passenger.pid-file string
    	Optional path to a file containing the passenger/nginx PID for additional metrics.
  -passenger.command.timeout duration
      Timeout for passenger.command. (default 500ms)
  -web.listen-address string
      Address to listen on for web interface and telemetry. (default ":9149")
  -web.telemetry-path string
      Path under which to expose metrics. (default "/metrics")

To run the Docker image:

docker run -p 9106:9106 -v $PATH_TO_PASSENGER_STATUS:/bin \
        passenger_exporter_nginx:latest /passenger_exporter_nginx

Notes for running the Docker container:

- You must mount the passenger-status binary within the container to
  have access.
- You must expose the -web.listen-address port on the container to be scraped.

**********
Collectors
----------

An example of the metrics exported can be seen in testdata/scrape_output.txt

*************
Running Tests
-------------

Tests can be run with:

go test .

Additionally, the testdata/scrape_output.txt can be regenerated by passing the
--golden flag:

go test -v . --golden

passenger_exporter's People

Contributors

daveworth avatar rtreffer avatar stuartnelson3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

passenger_exporter's Issues

panic: runtime error: index out of range

I have installed passenger_exporter on ubuntu 16.04 system and the process kills itself after some random time.

$ sudo systemctl status passenger_exporter
โ— passenger_exporter.service - Passenger Exporter
   Loaded: loaded (/etc/systemd/system/passenger_exporter.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2018-12-24 09:39:45 UTC; 1h 39min ago
  Process: 1453 ExecStart=/usr/local/bin/passenger_exporter -passenger.command /usr/sbin/passenger-status --show=xml (code=exited, status=2)
 Main PID: 1453 (code=exited, status=2)

Dec 24 09:28:34 localhost systemd[1]: Started Passenger Exporter.
Dec 24 09:28:34 localhost passenger_exporter[1453]: time="2018-12-24T09:28:34Z" level=info msg="Starting passenger-exporter (version=, bra
Dec 24 09:28:34 localhost passenger_exporter[1453]: time="2018-12-24T09:28:34Z" level=info msg="Build context (go=go1.11, user=, date=)" s
Dec 24 09:28:34 localhost passenger_exporter[1453]: time="2018-12-24T09:28:34Z" level=info msg="Listening on :9149" source="passenger_expo
Dec 24 09:39:45 localhost passenger_exporter[1453]: panic: runtime error: index out of range
Dec 24 09:39:45 localhost systemd[1]: passenger_exporter.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 24 09:39:45 localhost systemd[1]: passenger_exporter.service: Unit entered failed state.
Dec 24 09:39:45 localhost systemd[1]: passenger_exporter.service: Failed with result 'exit-code'.

Repository address in .promu.yml doesn't exist

Running go get github.com/stuartnelson3/passenger_exporter and then make results in:

can't load package: package github.com/stuartnelson3/passenger_exporter_nginx: cannot find package "github.com/stuartnelson3/passenger_exporter_nginx".

.promu.yml refers to github.com/stuartnelson3/passenger_exporter_nginx which doesn't seem to exist (note "_nginx" suffix) - possibly this is a mistake?

Get PID from passenger-status

Hey

Is there any way to get the PID from the passenger-status output?
i'm trying to get this from the "passenger_nginx_proc_memory" metric.

Here's an example.

  • PID: 12352 Sessions: 0 Processed: 0 Uptime: 3h 12m 46s
    CPU: 0% Memory : 9M Last used: 3h 12m 4

The exporter does not work with multiple passenger applications.

If there are several passenger apps running, the exporter will return the following error:

An error has occurred during metrics collection:

collected metric passenger_nginx_app_group_queue label:<name:"default" value:"true" > gauge:<value:0 > was collected before with the same name and label values

This is due to this metric:

ch <- prometheus.MustNewConstMetric(e.appGroupQueue, prometheus.GaugeValue, parseFloat(sg.Group.GetWaitListSize), sg.Group.Default)

that uses label: default, but its value is always true:

Below is the edited output of passenger-status --show=xml when runing two apps.

<?xml version="1.0" encoding="iso8859-1"?>
<info version="3">
   <passenger_version>6.0.1</passenger_version>
   <group_count>2</group_count>
   <process_count>6</process_count>
   <max>6</max>
   <capacity_used>6</capacity_used>
   <get_wait_list_size>0</get_wait_list_size>
   <supergroups>
      <supergroup>
         <name>APP_1-NAME</name>
         <state>READY</state>
         <get_wait_list_size>0</get_wait_list_size>
         <capacity_used>3</capacity_used>
         <group default="true">
            <name>APP_1-NAME</name>
            <component_name>APP_1-NAME</component_name>
            <app_root>/path/to/APP_1/current</app_root>
            ....
            <options>
               <app_root>/path/to/APP_1/current</app_root>
               <app_group_name>APP_1-NAME</app_group_name>
               <app_type>ruby</app_type>
               ....
            </options>
            <processes>
               <process>
                  <pid>5465</pid>
                  ....
               </process>
            </processes>
         </group>
      </supergroup>
      <supergroup>
         <name>APP_2-NAME</name>
         <state>READY</state>
         <get_wait_list_size>0</get_wait_list_size>
         <capacity_used>3</capacity_used>
         <group default="true">
            <name>APP_2-NAME</name>
            <component_name>APP_2-NAME</component_name>
            <app_root>/path/to/APP_2/current</app_root>
            <app_type>ruby</app_type>
            ....
            <options>
               <app_root>/path/to/APP_2/current</app_root>
               <app_group_name>APP_2-NAME</app_group_name>
               <app_type>ruby</app_type>
               ....
            </options>
            <processes>
               <process>
                  <pid>27619</pid>
                  ....
               </process>
            </processes>
         </group>
      </supergroup>
   </supergroups>
</info>

Notice the two <group default="true"> elements.

Do you know if this can be solved with some passenger configuration options? or should the metric label be changed ?

Unable to parse config file: .promu.yml

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 promu build --prefix /home/micah/working/passenger_exporter
Unable to parse config file: .promu.yml
!! yaml: unmarshal errors:
  line 1: cannot unmarshal !!str `1.10.1` into struct { CGo bool; Version string }
make: *** [Makefile:16: passenger_exporter_nginx] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.