Giter Site home page Giter Site logo

prometheus-metrics-in-wordpress's People

Contributors

jblew avatar mte90 avatar scrobbleme avatar widoz avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

prometheus-metrics-in-wordpress's Issues

Permission denied when trying to access metrics

I installed the plugin and configured wp-config.php but when I go to https://<my-url>/wp-json/metrics?all=yes&prometheus=<my-key> I get the message { "error": "You cannot access to that page" }. How can I fix this issue?

Just seein php_version as a metric version

I installed your plugin by first download the current master, made composer update -o. Than I zipped the hole folder and uploaded it by using the interface of WP.

Did I reproduce anything of your documentation wrong?

I just don't see any other metric than this:
image

I hope, you can help me.


Meta:
WP Version: 6.2


Help on configuring

Hello, I have a few setup questions:

  1. Do I need to install the WPDB-Status plugin? if so, how to do it
    image
  2. Do I need to add anything wp-config.php ?

I installed this plugin, created a key, and wrote a job for prometheus. It connects and shows the up status
Clicking on the link, as I understand it with metrics
http://192.168.10.49:8080/wp-json/metrics?autoload=yes&db_size=yes&pages=yes&pending_updates=yes&posts=yes&posts_without_content=yes&posts_without_title=yes&prometheus=9c136101-43e4-4a05-8069-0c4461e34a7a&transient=yes&user_sessions=yes&users=yes
I get a black screen
image
I guess I need to configure InfluxDB and see an example, but I don't understand what values need to be passed
bucket id hosting Vendor hosting Rate
P.S. I deploy wordpress locally as an experiment without using domains, wordpress is located on 192.168.10.49:8080

Feature request: please consider using gauges

Hi there,

first of all thanks for this plugin โ€” I'm not using it myself but like the idea. I'm opening this PR because I think you should consider to use gauges instead of counters. According the the prometheus documentation:

As posts and pages can be deleted, I would say that a gauge is most appropriated in most cases. This stackoverflow post is worth reading.

Hope this helps !

Help on configuring

hi,

apologies for this but am a WordPress newbie. Just wanted to understand exactly what I needed to do to get the capability running.

I have,

  1. added the define to wp-config.php
  2. added the new target in prometheus
  3. created a file prometheus-metrics-for-wp.php in the root directory

but as expected am getting a 404 on wp-json/metrics

I am clearly missing some WordPress config but don't know what I am missing.

Any help appreciated

Duplicates in the metrics with all yes

There are some duplicates in the prometheus request with v2:

# HELP wp_posts_total Deprecated. Total number of posts published.
# TYPE wp_posts_total counter
wp_posts_total{host="https://domain.tld", status="published"} 16544
wp_posts_total{host="https://domain.tld", status="draft"} 25
# HELP wp_pages_total Deprecated. Total number of pages published.
# TYPE wp_pages_total counter
wp_pages_total{host="https://domain.tld", status="published"} 8
wp_pages_total{host="https://domain.tld", status="draft"} 0
# HELP wp_db_size Total DB size in MB
# TYPE wp_db_size gauge
wp_db_size{host="https://domain.tld"} 1103.93 1638445108000
# HELP wp_users_total Total number of users
# TYPE wp_users_total gauge
wp_users_total{host="https://domain.tld"} 133 1638445108000
# HELP wp_user_sessions User sessions
# TYPE wp_user_sessions gauge
wp_user_sessions{host="https://domain.tld"} 0 1638445108000
# HELP wp_options_autoload Options size in KB in autoload
# TYPE wp_options_autoload gauge
wp_options_autoload{host="https://domain.tld"} 351 1638445108000
# HELP wp_options_autoload_size Options in autoload
# TYPE wp_options_autoload_size gauge
wp_options_autoload_size{host="https://domain.tld"} 262 1638445108000
# HELP wp_posts_without_content Posts and Pages without content
# TYPE wp_posts_without_content gauge
wp_posts_without_content{host="https://domain.tld"} 15 1638445108000
# HELP wp_posts_without_title Posts and Pages without title
# TYPE wp_posts_without_title gauge
wp_posts_without_title{host="https://domain.tld"} 0 1638445108000
# HELP wp_post_types_total Total number of content by type and status
# TYPE wp_post_types_total gauge
wp_post_types_total{host="https://domain.tld",post_type="page",status="publish"} 8 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="publish"} 16544 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="future"} 28 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="draft"} 25 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="trash"} 48 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="auto-draft"} 22 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="attachment",status="trash"} 92 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="attachment",status="inherit"} 16461 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="publish"} 16544 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="future"} 28 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="draft"} 25 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="trash"} 48 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="auto-draft"} 22 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="attachment",status="trash"} 92 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="attachment",status="inherit"} 16461 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="chart",status="publish"} 2 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="chart",status="draft"} 1 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="people",status="publish"} 9266 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="people",status="draft"} 25 1638445108000
# HELP wp_pending_updates Pending updates in the WordPress website
# TYPE wp_pending_updates gauge
wp_pending_updates{host="https://domain.tld"} 1 1638445108000
# HELP wp_transient_autoload DB Transient in autoload.
# TYPE wp_transient_autoload gauge
wp_transient_autoload{host="https://domain.tld"} 4 1638445108000
# HELP perf_count_posts Measure the time in ns for a count query on the posts table
# TYPE perf_count_posts gauge
perf_count_posts{host="https://domain.tld"} 33892502 1638445108000
# HELP perf_write_temp_file Measure the time in ns of writing a large file
# TYPE perf_write_temp_file gauge
perf_write_temp_file{host="https://domain.tld"} 1840657292 1638445110000
# HELP wp_db_size Total DB size in MB
# TYPE wp_db_size gauge
wp_db_size{host="https://domain.tld"} 1103.93 1638445108000
# HELP wp_users_total Total number of users
# TYPE wp_users_total gauge
wp_users_total{host="https://domain.tld"} 133 1638445108000
# HELP wp_user_sessions User sessions
# TYPE wp_user_sessions gauge
wp_user_sessions{host="https://domain.tld"} 0 1638445108000
# HELP wp_options_autoload Options size in KB in autoload
# TYPE wp_options_autoload gauge
wp_options_autoload{host="https://domain.tld"} 351 1638445108000
# HELP wp_options_autoload_size Options in autoload
# TYPE wp_options_autoload_size gauge
wp_options_autoload_size{host="https://domain.tld"} 262 1638445108000
# HELP wp_posts_without_content Posts and Pages without content
# TYPE wp_posts_without_content gauge
wp_posts_without_content{host="https://domain.tld"} 15 1638445108000
# HELP wp_posts_without_title Posts and Pages without title
# TYPE wp_posts_without_title gauge
wp_posts_without_title{host="https://domain.tld"} 0 1638445108000
# HELP wp_post_types_total Total number of content by type and status
# TYPE wp_post_types_total gauge
wp_post_types_total{host="https://domain.tld",post_type="page",status="publish"} 8 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="publish"} 16544 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="future"} 28 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="draft"} 25 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="trash"} 48 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="auto-draft"} 22 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="attachment",status="trash"} 92 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="attachment",status="inherit"} 16461 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="publish"} 16544 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="future"} 28 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="draft"} 25 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="trash"} 48 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="post",status="auto-draft"} 22 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="attachment",status="trash"} 92 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="attachment",status="inherit"} 16461 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="chart",status="publish"} 2 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="chart",status="draft"} 1 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="people",status="publish"} 9266 1638445108000
wp_post_types_total{host="https://domain.tld",post_type="people",status="draft"} 25 1638445108000
# HELP wp_pending_updates Pending updates in the WordPress website
# TYPE wp_pending_updates gauge
wp_pending_updates{host="https://domain.tld"} 1 1638445108000
# HELP wp_transient_autoload DB Transient in autoload.
# TYPE wp_transient_autoload gauge
wp_transient_autoload{host="https://domain.tld"} 4 1638445108000
# HELP perf_count_posts Measure the time in ns for a count query on the posts table
# TYPE perf_count_posts gauge
perf_count_posts{host="https://domain.tld"} 33892502 1638445108000
# HELP perf_write_temp_file Measure the time in ns of writing a large file
# TYPE perf_write_temp_file gauge
perf_write_temp_file{host="https://domain.tld"} 1840657292 1638445110000

Looking at https://github.com/CodeAtCode/Prometheus-Metrics-in-WordPress/blob/v2/prometheus-metrics-for-wp.php#L136-143 the legacy and new one are printed but the new one include also legacy metrics so they are printed again. Removing those will simplify the parsing and downloading of that page (yeah not so many kb but we are talking metrics after all)
Maybe add a parameter to the prometheus_get_metrics filter to specify legacy or not is the best way.

Return WordPress version as _info metric

Hello,

Could the plugin return the WordPress version as a metric?

This is something various exporters do via an _info metric:

The Prometheus Proxmox VE Exporter:

pve_version_info{instance="pve.example.com:9221",job="pve",release="7.3",repoid="d69b70d4",version="7.3-4"} 1

The Node exporter:

go_info{instance="foo.example.com:9100",job="node",version="go1.11.6"} 1

I've also done it on self-made applications:

mycompany_app_info{instance="app.example.com:443",job="app",version="42",build="ab2d3ef2ad62"} 1

The wp_info could be used:

wp_info{host="https://wp.example.com",version="6.1.1"} 1

If it's OK with you I can open a PR for this.

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.