stuartnelson3 / passenger_exporter Goto Github PK
View Code? Open in Web Editor NEWprometheus passenger exporter for nginx integration
License: MIT License
prometheus passenger exporter for nginx integration
License: MIT License
************************ 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
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'.
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?
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.
Create a Grafana dashboard and include it with the exporter.
If anyone has a Grafana dashboard make it available on grafana.org and send it to @stuartnelson3 .
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:
Line 169 in 6b9b629
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 ?
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.