From 1587069029e0cc3294135f05675cd865a0680936 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 25 Jun 2020 12:24:53 +0200 Subject: [PATCH] Import the old solr role. --- README.md | 86 +- defaults/main.yml | 63 +- handlers/main.yml | 6 +- meta/main.yml | 62 +- tasks/main.yml | 93 +- templates/solr | 78 + templates/solr-default.j2 | 159 ++ templates/solr-exporter-config.xml | 2089 +++++++++++++++++ templates/solr.xml.j2 | 62 + templates/solr_prometheus_exporter.systemd.j2 | 11 + templates/solr_prometheus_exporter.upstart.j2 | 12 + templates/zoo.cfg.j2 | 17 + 12 files changed, 2670 insertions(+), 68 deletions(-) create mode 100755 templates/solr create mode 100644 templates/solr-default.j2 create mode 100644 templates/solr-exporter-config.xml create mode 100644 templates/solr.xml.j2 create mode 100644 templates/solr_prometheus_exporter.systemd.j2 create mode 100644 templates/solr_prometheus_exporter.upstart.j2 create mode 100644 templates/zoo.cfg.j2 diff --git a/README.md b/README.md index 3637db8..1984d1e 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,81 @@ Role Name ========= -A brief description of the role goes here. - -Requirements ------------- - -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. +A role that installs a solr instance, Role Variables -------------- -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. +The most important variables are listed below: + +``` yaml +solr_install: True +solr_version: 7.4.0 +solr_http_port: 8983 +solr_service: -solr +solr_config_name: hindex +solr_shards: 1 +solr_instance: '{{ solr_service }}' +solr_custom_log4j: False +solr_rotate_logs_on_start: 'true' +solr_log_dir: /var/log/solr +solr_log_level: ERROR +solr_http_port_1: '{{ solr_http_port }}' +solr_zoo_port: 9983 +solr_zoo_port_1: 9984 +solr_zoo_port_2: 9985 +solr_jmx_port_1: 8601 +solr_jmx_enabled: 'false' +solr_user: solr +solr_group: solr +# We need to define this one because we are using the tomcat multiple instances role +solr_base_dir: /opt +solr_server_dir: '{{ solr_base_dir }}/solr' +solr_data_dir: '{{ solr_server_dir }}/server/solr' +solr_conf_dir: '{{ solr_server_dir }}/conf' +solr_collections_base_dir: '{{ solr_data_dir }}/data/solr' +solr_pid_dir: '{{ solr_server_dir }}/bin' +solr_heap: 1024M +solr_mode: solrcloud +solr_download_dir: '{{ solr_base_dir }}/download' +solr_zookeeper_data_dir: '{{ solr_data_dir }}/zoo_data' +solr_install_collection1: False +solr_download_url: 'http://www-eu.apache.org/dist/lucene/solr/{{ solr_version }}/solr-{{ solr_version }}.tgz' +solr_jar_files: + - contrib/analysis-extras/lib/icu4*.jar + - contrib/analysis-extras/lucene-libs/lucene-analyzers-icu*.jar + +solr_startup_opts: '-Ddisable.configEdit=true' + +solr_set_gc_options: False +#solr_gc_tune: '-XX:NewRatio=3 -XX:SurvivorRatio=4' +solr_gc_tune: '' + +solr_multicore: False +solr_cores: + - collection1 + +solr_cloud_mode: True +# When we want to use an external zookeeper cluster, set this one to True +solr_zk_external_cluster: False +solr_zk_hosts: '127.0.0.1:2181' +solr_zk_timeout: 15000 + +solr_prometheus_exporter: True +solr_prometheus_port: 9983 +solr_prometheus_threads: 2 +solr_prometheus_bindir: '{{ solr_server_dir }}/contrib/prometheus-exporter/bin' +solr_prometheus_command: 'solr-exporter' +solr_prometheus_command_params: '-p {{ solr_prometheus_port }} -b {{ solr_zk_hosts }} -f {{ solr_prometheus_conf_file }} -n {{ solr_prometheus_threads }}' +solr_prometheus_data_dir: '{{ solr_base_dir }}/solr_prometheus_exporter' +solr_prometheus_conf_dir: '{{ solr_prometheus_data_dir }}/conf' +solr_prometheus_conf_file: '{{ solr_prometheus_conf_dir }}/solr-exporter-config.xml' +``` Dependencies ------------ -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. - -Example Playbook ----------------- - -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } +* openjdk License ------- @@ -35,4 +85,4 @@ EUPL-1.2 Author Information ------------------ -An optional section for the role authors to include contact information, or a website (HTML is not allowed). +Andrea Dell'Amico, diff --git a/defaults/main.yml b/defaults/main.yml index 95d3c70..200cb22 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,63 @@ --- -# defaults file for ansible-role-template \ No newline at end of file +# solr +solr_install: True +solr_version: 7.4.0 +solr_http_port: 8983 +solr_service: -solr +solr_config_name: hindex +solr_shards: 1 +solr_instance: '{{ solr_service }}' +solr_custom_log4j: False +solr_rotate_logs_on_start: 'true' +solr_log_dir: /var/log/solr +solr_log_level: ERROR +solr_http_port_1: '{{ solr_http_port }}' +solr_zoo_port: 9983 +solr_zoo_port_1: 9984 +solr_zoo_port_2: 9985 +solr_jmx_port_1: 8601 +solr_jmx_enabled: 'false' +solr_user: solr +solr_group: solr +# We need to define this one because we are using the tomcat multiple instances role +solr_base_dir: /opt +solr_server_dir: '{{ solr_base_dir }}/solr' +solr_data_dir: '{{ solr_server_dir }}/server/solr' +solr_conf_dir: '{{ solr_server_dir }}/conf' +solr_collections_base_dir: '{{ solr_data_dir }}/data/solr' +solr_pid_dir: '{{ solr_server_dir }}/bin' +solr_heap: 1024M +solr_mode: solrcloud +solr_download_dir: '{{ solr_base_dir }}/download' +solr_zookeeper_data_dir: '{{ solr_data_dir }}/zoo_data' +solr_install_collection1: False +solr_download_url: 'http://www-eu.apache.org/dist/lucene/solr/{{ solr_version }}/solr-{{ solr_version }}.tgz' +solr_jar_files: + - contrib/analysis-extras/lib/icu4*.jar + - contrib/analysis-extras/lucene-libs/lucene-analyzers-icu*.jar + +solr_startup_opts: '-Ddisable.configEdit=true' + +solr_set_gc_options: False +#solr_gc_tune: '-XX:NewRatio=3 -XX:SurvivorRatio=4' +solr_gc_tune: '' + +solr_multicore: False +solr_cores: + - collection1 + +solr_cloud_mode: True +# When we want to use an external zookeeper cluster, set this one to True +solr_zk_external_cluster: False +solr_zk_hosts: '127.0.0.1:2181' +solr_zk_timeout: 15000 + +solr_prometheus_exporter: True +solr_prometheus_port: 9983 +solr_prometheus_threads: 2 +solr_prometheus_bindir: '{{ solr_server_dir }}/contrib/prometheus-exporter/bin' +solr_prometheus_command: 'solr-exporter' +solr_prometheus_command_params: '-p {{ solr_prometheus_port }} -b {{ solr_zk_hosts }} -f {{ solr_prometheus_conf_file }} -n {{ solr_prometheus_threads }}' +solr_prometheus_data_dir: '{{ solr_base_dir }}/solr_prometheus_exporter' +solr_prometheus_conf_dir: '{{ solr_prometheus_data_dir }}/conf' +solr_prometheus_conf_file: '{{ solr_prometheus_conf_dir }}/solr-exporter-config.xml' diff --git a/handlers/main.yml b/handlers/main.yml index 27474e0..0d2eb9c 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,2 +1,6 @@ --- -# handlers file for ansible-role-template \ No newline at end of file +- name: solr restart + service: name=solr state=restarted + +- name: Restart Solr prometheus exporter + service: name=solr_prometheus_exporter state=restarted enabled=yes diff --git a/meta/main.yml b/meta/main.yml index 1126a5e..e0decd1 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,61 +1,29 @@ galaxy_info: - author: your name - description: your description + author: Andrea Dell'Amico + description: Systems Architect company: ISTI-CNR - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value issue_tracker_url: https://redmine-s2i2s.isti.cnr.it/projects/provisioning - # Some suggested licenses: - # - BSD (default) - # - MIT - # - GPLv2 - # - GPLv3 - # - Apache - # - CC-BY - license: EUPL-1.2 + license: EUPL 1.2+ min_ansible_version: 2.8 - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # Optionally specify the branch Galaxy will use when accessing the GitHub - # repo for this role. During role install, if no tags are available, - # Galaxy will use this branch. During import Galaxy will access files on - # this branch. If Travis integration is configured, only notifications for this - # branch will be accepted. Otherwise, in all cases, the repo's default branch - # (usually master) will be used. - #github_branch: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. # To view available platforms and versions (or releases), visit: # https://galaxy.ansible.com/api/v1/platforms/ # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 + platforms: + - name: Ubuntu + versions: + - bionic - galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. + galaxy_tags: + - solr + - lucene -dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. +dependencies: + - src: git+https://gitea-s2i2s.isti.cnr.it/ISTI-ansible-roles/ansible-role-openjdk.git + version: master + name: openjdk + state: latest diff --git a/tasks/main.yml b/tasks/main.yml index 53c6cae..00f62e2 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,2 +1,93 @@ --- -# tasks file for ansible-role-template \ No newline at end of file +- block: + - name: Create a solr user + user: name={{ solr_user }} home={{ solr_base_dir }} createhome=yes shell=/bin/bash + + - name: Create the downloads directory + file: dest={{ solr_download_dir }} state=directory + + - name: Download solr + get_url: url='{{ solr_download_url }}' dest={{ solr_download_dir }}/solr-{{ solr_version }}.tgz validate_certs=no + + - name: Unarchive solr release + unarchive: src={{ solr_download_dir }}/solr-{{ solr_version }}.tgz dest={{ solr_base_dir }} copy=no + args: + creates: '{{ solr_base_dir }}/bin/solr' + + - name: Link to the latest release + file: src={{ solr_base_dir }}/solr-{{ solr_version }} dest={{ solr_server_dir }} state=link + + - name: Create the solr service, download, data and logs directories + file: path={{ item }} state=directory owner={{ solr_user }} group={{ solr_user }} + with_items: + - '{{ solr_download_dir }}' + - '{{ solr_data_dir }}' + - '{{ solr_pid_dir }}' + - '{{ solr_log_dir }}' + + - name: Fix the permissions of the solr server directory + file: dest={{ solr_data_dir }} state=directory owner={{ solr_user }} group={{ solr_user }} recurse=yes + + - name: Create the solr lib directory + file: dest={{ solr_data_dir }}/lib state=directory + + - name: Create the solr conf directory + file: dest={{ solr_conf_dir }} state=directory + + - name: Install the zookeeper configuration + template: src={{ item }}.j2 dest={{ solr_data_dir }}/{{ item }} + with_items: + - solr.xml + - zoo.cfg + notify: solr restart + tags: [ 'solr', 'solr_default', 'solr_conf' ] + + - name: copy extra libraries + shell: cd {{ solr_server_dir }}; cp -u {{ item }} {{ solr_data_dir }}/lib + with_items: '{{ solr_jar_files }}' + + - name: install the solr init script + template: src=solr dest=/etc/init.d/solr mode=0755 owner=root group=root + + - name: Install the solr default + template: src=solr-default.j2 dest=/etc/default/solr.in.sh mode=0644 owner=root group=root + notify: solr restart + tags: [ 'solr', 'solr_default', 'solr_conf' ] + + - name: Start and enable the solr service + service: name=solr state=started enabled=yes + ignore_errors: True + + become: True + become_user: root + when: solr_install + tags: solr + +- block: + - name: Create the Solr prometheus exporter conf directory + file: dest={{ solr_prometheus_conf_dir }} state=directory mode=0755 + + - name: Install the Solr prometheus exporter config file + template: src=solr-exporter-config.xml dest={{ solr_prometheus_conf_file }} mode=0644 + notify: Restart Solr prometheus exporter + tags: [ 'solr', 'solr_prometheus', 'solr_prometheus_exporter', 'solr_prometheus_exporter_config' ] + + - name: Install the Solr prometheus exporter upstart script + template: src=solr_prometheus_exporter.upstart.j2 dest=/etc/init/solr_prometheus_exporter.conf mode=0644 owner=root group=root + when: ansible_service_mgr != 'systemd' + + - name: Install the Solr prometheus exporter systemd unit + template: src=solr_prometheus_exporter.systemd.j2 dest=/etc/systemd/system/solr_prometheus_exporter.service mode=0644 owner=root group=root + when: ansible_service_mgr == 'systemd' + notify: systemd reload + + - name: Ensure that Solr prometheus exporter is started and enabled + service: name=solr_prometheus_exporter state=started enabled=yes + + become: True + become_user: root + when: + - solr_install + - solr_prometheus_exporter + tags: [ 'solr', 'solr_prometheus', 'solr_prometheus_exporter' ] + diff --git a/templates/solr b/templates/solr new file mode 100755 index 0000000..c2bee7b --- /dev/null +++ b/templates/solr @@ -0,0 +1,78 @@ +#!/bin/sh +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +### BEGIN INIT INFO +# Provides: solr +# Required-Start: $remote_fs $syslog +# Required-Stop: $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Description: Controls Apache Solr as a Service +### END INIT INFO + +# Example of a very simple *nix init script that delegates commands to the bin/solr script +# Typical usage is to do: +# +# cp bin/init.d/solr /etc/init.d/solr +# chmod 755 /etc/init.d/solr +# chown root:root /etc/init.d/solr +# update-rc.d solr defaults +# update-rc.d solr enable + +# Where you extracted the Solr distribution bundle +SOLR_INSTALL_DIR="{{ solr_server_dir }}" + +if [ ! -d "$SOLR_INSTALL_DIR" ]; then + echo "$SOLR_INSTALL_DIR not found! Please check the SOLR_INSTALL_DIR setting in your $0 script." + exit 1 +fi + +# Path to an include file that defines environment specific settings to override default +# variables used by the bin/solr script. It's highly recommended to define this script so +# that you can keep the Solr binary files separated from live files (pid, logs, index data, etc) +# see bin/solr.in.sh for an example +SOLR_ENV="/etc/default/solr.in.sh" + +if [ ! -f "$SOLR_ENV" ]; then + echo "$SOLR_ENV not found! Please check the SOLR_ENV setting in your $0 script." + exit 1 +fi + +# Specify the user to run Solr as; if not set, then Solr will run as root. +# Running Solr as root is not recommended for production environments +RUNAS="solr" + +# verify the specified run as user exists +runas_uid="`id -u "$RUNAS"`" +if [ $? -ne 0 ]; then + echo "User $RUNAS not found! Please create the $RUNAS user before running this script." + exit 1 +fi + +case "$1" in + start|stop|restart|status) + SOLR_CMD="$1" + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit +esac + +if [ -n "$RUNAS" ]; then + su -c "SOLR_INCLUDE=\"$SOLR_ENV\" \"$SOLR_INSTALL_DIR/bin/solr\" $SOLR_CMD" - "$RUNAS" +else + SOLR_INCLUDE="$SOLR_ENV" "$SOLR_INSTALL_DIR/bin/solr" "$SOLR_CMD" +fi diff --git a/templates/solr-default.j2 b/templates/solr-default.j2 new file mode 100644 index 0000000..6835a30 --- /dev/null +++ b/templates/solr-default.j2 @@ -0,0 +1,159 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SOLR_INSTALL_DIR="{{ solr_data_dir }}" + +# By default the script will use JAVA_HOME to determine which java +# to use, but you can set a specific path for Solr to use without +# affecting other Java applications on your server/workstation. +#SOLR_JAVA_HOME="" + +# This controls the number of seconds that the solr script will wait for +# Solr to stop gracefully or Solr to start. If the graceful stop fails, +# the script will forcibly stop Solr. If the start fails, the script will +# give up waiting and display the last few lines of the logfile. +#SOLR_STOP_WAIT="180" + +# Increase Java Heap as needed to support your indexing / query needs +SOLR_HEAP="{{ solr_heap }}" + +# Expert: If you want finer control over memory options, specify them directly +# Comment out SOLR_HEAP if you are using this though, that takes precedence +#SOLR_JAVA_MEM="-Xms512m -Xmx512m" + +# Enable verbose GC logging... +# * If this is unset, various default options will be selected depending on which JVM version is in use +# * For java8 or lower: if this is set, additional params will be added to specify the log file & rotation +# * For java9 or higher: each included opt param that starts with '-Xlog:gc', but does not include an output +# specifier, will have a 'file' output specifier (as well as formatting & rollover options) appended, +# using the effective value of the SOLR_LOGS_DIR. +# +#GC_LOG_OPTS='-Xlog:gc*' # (java9) +#GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \ +# -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime" +{% if solr_set_gc_options %} +GC_LOG_OPTS="-verbose:gc -XX:+PrintHeapAtGC -XX:+PrintGCDetails \ + -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintTenuringDistribution -XX:+PrintGCApplicationStoppedTime" +{% endif %} + +# These GC settings have shown to work well for a number of common Solr workloads +GC_TUNE="{{ solr_gc_tune }}" + +# Set the ZooKeeper connection string if using an external ZooKeeper ensemble +# e.g. host1:2181,host2:2181/chroot +# Leave empty if not using SolrCloud +{% if solr_zk_external_cluster %} +ZK_HOST="{{ solr_zk_hosts }}" +{% endif %} + +# Set the ZooKeeper client timeout (for SolrCloud mode) +ZK_CLIENT_TIMEOUT="{{ solr_zk_timeout }}" + +# By default the start script uses "localhost"; override the hostname here +# for production SolrCloud environments to control the hostname exposed to cluster state +#SOLR_HOST="192.168.1.1" + +# By default the start script uses UTC; override the timezone if needed +#SOLR_TIMEZONE="UTC" + +# Set to true to activate the JMX RMI connector to allow remote JMX client applications +# to monitor the JVM hosting Solr; set to "false" to disable that behavior +# (false is recommended in production environments) +ENABLE_REMOTE_JMX_OPTS="{{ solr_jmx_enabled }}" + +# The script will use SOLR_PORT+10000 for the RMI_PORT or you can set it here +RMI_PORT={{ solr_jmx_port_1 }} + +# SOLR additional options +SOLR_OPTS="$SOLR_OPTS {{ solr_startup_opts }}" + +# Set the thread stack size +SOLR_OPTS="$SOLR_OPTS -Xss256k" + +{% if not solr_zk_external_cluster %} +export SOLR_MODE={{ solr_mode }} +{% endif %} + +# Anything you add to the SOLR_OPTS variable will be included in the java +# start command line as-is, in ADDITION to other options. If you specify the +# -a option on start script, those options will be appended as well. Examples: +#SOLR_OPTS="$SOLR_OPTS -Dsolr.autoSoftCommit.maxTime=3000" +#SOLR_OPTS="$SOLR_OPTS -Dsolr.autoCommit.maxTime=60000" +#SOLR_OPTS="$SOLR_OPTS -Dsolr.clustering.enabled=true" + +# Location where the bin/solr script will save PID files for running instances +# If not set, the script will create PID files in $SOLR_TIP/bin +SOLR_PID_DIR={{ solr_pid_dir }} + +# Path to a directory for Solr to store cores and their data. By default, Solr will use server/solr +# If solr.xml is not stored in ZooKeeper, this directory needs to contain solr.xml +SOLR_HOME={{ solr_data_dir }} + +{% if solr_custom_log4j %} +# Solr provides a default Log4J configuration properties file in server/resources +# however, you may want to customize the log settings and file appender location +# so you can point the script to use a different log4j.properties file +LOG4J_PROPS={{ solr_conf_dir }}/log4j.properties +{% endif %} + +# Changes the logging level. Valid values: ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Default is INFO +# This is an alternative to changing the rootLogger in log4j.properties +SOLR_LOG_LEVEL={{ solr_log_level }} + +# Location where Solr should write logs to; should agree with the file appender +# settings in server/resources/log4j.properties +SOLR_LOGS_DIR={{ solr_log_dir }} + +# Enables log rotation, cleanup, and archiving during start. Setting SOLR_LOG_PRESTART_ROTATION=false will skip start +# time rotation of logs, and the archiving of the last GC and console log files. It does not affect Log4j configuration. +# This pre-startup rotation may need to be disabled depending how much you customize the default logging setup. +SOLR_LOG_PRESTART_ROTATION={{ solr_rotate_logs_on_start }} + +# Sets the port Solr binds to, default is 8983 +SOLR_PORT={{ solr_http_port }} + +# Uncomment to set SSL-related system properties +# Be sure to update the paths to the correct keystore for your environment +#SOLR_SSL_KEY_STORE=/home/shalin/work/oss/shalin-lusolr/solr/server/etc/solr-ssl.keystore.jks +#SOLR_SSL_KEY_STORE_PASSWORD=secret +#SOLR_SSL_KEY_STORE_TYPE=JKS +#SOLR_SSL_TRUST_STORE=/home/shalin/work/oss/shalin-lusolr/solr/server/etc/solr-ssl.keystore.jks +#SOLR_SSL_TRUST_STORE_PASSWORD=secret +#SOLR_SSL_TRUST_STORE_TYPE=JKS +#SOLR_SSL_NEED_CLIENT_AUTH=false +#SOLR_SSL_WANT_CLIENT_AUTH=false + +# Uncomment if you want to override previously defined SSL values for HTTP client +# otherwise keep them commented and the above values will automatically be set for HTTP clients +#SOLR_SSL_CLIENT_KEY_STORE= +#SOLR_SSL_CLIENT_KEY_STORE_PASSWORD= +#SOLR_SSL_CLIENT_KEY_STORE_TYPE= +#SOLR_SSL_CLIENT_TRUST_STORE= +#SOLR_SSL_CLIENT_TRUST_STORE_PASSWORD= +#SOLR_SSL_CLIENT_TRUST_STORE_TYPE= + +# Settings for authentication +# Please configure only one of SOLR_AUTHENTICATION_CLIENT_CONFIGURER or SOLR_AUTH_TYPE parameters +#SOLR_AUTHENTICATION_CLIENT_CONFIGURER="org.apache.solr.client.solrj.impl.PreemptiveBasicAuthConfigurer" +#SOLR_AUTH_TYPE="basic" +#SOLR_AUTHENTICATION_OPTS="-Dbasicauth=solr:SolrRocks" + +# Settings for ZK ACL +#SOLR_ZK_CREDS_AND_ACLS="-DzkACLProvider=org.apache.solr.common.cloud.VMParamsAllAndReadonlyDigestZkACLProvider \ +# -DzkCredentialsProvider=org.apache.solr.common.cloud.VMParamsSingleSetCredentialsDigestZkCredentialsProvider \ +# -DzkDigestUsername=admin-user -DzkDigestPassword=CHANGEME-ADMIN-PASSWORD \ +# -DzkDigestReadonlyUsername=readonly-user -DzkDigestReadonlyPassword=CHANGEME-READONLY-PASSWORD" +#SOLR_OPTS="$SOLR_OPTS $SOLR_ZK_CREDS_AND_ACLS" + diff --git a/templates/solr-exporter-config.xml b/templates/solr-exporter-config.xml new file mode 100644 index 0000000..3840092 --- /dev/null +++ b/templates/solr-exporter-config.xml @@ -0,0 +1,2089 @@ + + + + + + + + + + + /admin/ping + + + + . as $object | $object | + (if $object.status == "OK" then 1.0 else 0.0 end) as $value | + { + name : "solr_ping", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/ping.html", + label_names : [], + label_values : [], + value : $value + } + + + + + + + + + /admin/metrics + + all + all + + + + + + + + .metrics["solr.jetty"] | to_entries | .[] | select(.key | startswith("org.eclipse.jetty.server.handler.DefaultHandler")) | select(.key | endswith("xx-responses")) as $object | + $object.key | split(".") | last | split("-") | first as $status | + $object.value.count as $value | + { + name : "solr_metrics_jetty_response_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["status"], + label_values : [$status], + value : $value + } + + + .metrics["solr.jetty"] | to_entries | .[] | select(.key | startswith("org.eclipse.jetty.server.handler.DefaultHandler.")) | select(.key | endswith("-requests")) | select (.value | type == "object") as $object | + $object.key | split(".") | last | split("-") | first as $method | + $object.value.count as $value | + { + name : "solr_metrics_jetty_requests_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["method"], + label_values : [$method], + value : $value + } + + + .metrics["solr.jetty"] | to_entries | .[] | select(.key == "org.eclipse.jetty.server.handler.DefaultHandler.dispatches") as $object | + $object.value.count as $value | + { + name : "solr_metrics_jetty_dispatches_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : [], + label_values : [], + value : $value + } + + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key | startswith("buffers.")) | select(.key | endswith(".Count")) as $object | + $object.key | split(".")[1] as $pool | + $object.value as $value | + { + name : "solr_metrics_jvm_buffers", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["pool"], + label_values : [$pool], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key | startswith("buffers.")) | select(.key | (endswith(".MemoryUsed") or endswith(".TotalCapacity"))) as $object | + $object.key | split(".")[1] as $pool | + $object.key | split(".") | last as $item | + $object.value as $value | + { + name : "solr_metrics_jvm_buffers_bytes", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["pool", "item"], + label_values : [$pool, $item], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key | startswith("gc.")) | select(.key | endswith(".count")) as $object | + $object.key | split(".")[1] as $item | + $object.value as $value | + { + name : "solr_metrics_jvm_gc_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : [$item], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key | startswith("gc.")) | select(.key | endswith(".time")) as $object | + $object.key | split(".")[1] as $item | + ($object.value / 1000) as $value | + { + name : "solr_metrics_jvm_gc_seconds_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : [$item], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key | startswith("memory.heap.")) | select(.key | endswith(".usage") | not) as $object | + $object.key | split(".") | last as $item | + $object.value as $value | + { + name : "solr_metrics_jvm_memory_heap_bytes", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : [$item], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key | startswith("memory.non-heap.")) | select(.key | endswith(".usage") | not) as $object | + $object.key | split(".") | last as $item | + $object.value as $value | + { + name : "solr_metrics_jvm_memory_non_heap_bytes", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : [$item], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key | startswith("memory.pools.")) | select(.key | endswith(".usage") | not) as $object | + $object.key | split(".")[2] as $space | + $object.key | split(".") | last as $item | + $object.value as $value | + { + name : "solr_metrics_jvm_memory_pools_bytes", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["space", "item"], + label_values : [$space, $item], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key | startswith("memory.total.")) as $object | + $object.key | split(".") | last as $item | + $object.value as $value | + { + name : "solr_metrics_jvm_memory_bytes", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : [$item], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key == "os.committedVirtualMemorySize" or .key == "os.freePhysicalMemorySize" or .key == "os.freeSwapSpaceSize" or .key =="os.totalPhysicalMemorySize" or .key == "os.totalSwapSpaceSize") as $object | + $object.key | split(".") | last as $item | + $object.value as $value | + { + name : "solr_metrics_jvm_os_memory_bytes", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : [$item], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key == "os.maxFileDescriptorCount" or .key == "os.openFileDescriptorCount") as $object | + $object.key | split(".") | last as $item | + $object.value as $value | + { + name : "solr_metrics_jvm_os_file_descriptors", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : [$item], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key == "os.processCpuLoad" or .key == "os.systemCpuLoad") as $object | + $object.key | split(".") | last as $item | + $object.value as $value | + { + name : "solr_metrics_jvm_os_cpu_load", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : [$item], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key == "os.processCpuTime") as $object | + ($object.value / 1000.0) as $value | + { + name : "solr_metrics_jvm_os_cpu_time_seconds", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : ["processCpuTime"], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key == "os.systemLoadAverage") as $object | + $object.value as $value | + { + name : "solr_metrics_jvm_os_load_average", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : ["systemLoadAverage"], + value : $value + } + + + .metrics["solr.jvm"] | to_entries | .[] | select(.key | startswith("threads.")) | select(.key | endswith(".count")) as $object | + $object.key | split(".")[1] as $item | + $object.value as $value | + { + name : "solr_metrics_jvm_threads", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["item"], + label_values : [$item], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | endswith(".clientErrors")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + { + name : "solr_metrics_node_client_errors_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "handler"], + label_values : [$category, $handler], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | endswith(".clientErrors")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + { + name : "solr_metrics_node_errors_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "handler"], + label_values : [$category, $handler], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | endswith(".requestTimes")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + { + name : "solr_metrics_node_requests_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "handler"], + label_values : [$category, $handler], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | endswith(".serverErrors")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + { + name : "solr_metrics_node_server_errors_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "handler"], + label_values : [$category, $handler], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | endswith(".timeouts")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + { + name : "solr_metrics_node_timeouts_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "handler"], + label_values : [$category, $handler], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | endswith(".totalTime")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + ($object.value / 1000) as $value | + { + name : "solr_metrics_node_time_seconds_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "handler"], + label_values : [$category, $handler], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | startswith("CONTAINER.cores.")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[2] as $item | + $object.value as $value | + { + name : "solr_metrics_node_cores", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "item"], + label_values : [$category, $item], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | startswith("CONTAINER.fs.coreRoot.")) | select(.key | endswith(".totalSpace") or endswith(".usableSpace")) as $object | + $object.key | split(".") as $key_items | + $key_items | length as $label_len | + $key_items[0] as $category | + $key_items[3] as $item | + $object.value as $value | + { + name : "solr_metrics_node_core_root_fs_bytes", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "item"], + label_values : [$category, $item], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | contains(".threadPool.")) | select(.key | endswith(".completed")) as $object | + $object.key | split(".") as $key_items | + $key_items | length as $label_len | + $key_items[0] as $category | + (if $label_len >= 5 then $key_items[1] else "" end) as $handler | + (if $label_len >= 5 then $key_items[3] else $key_items[2] end) as $executor | + $object.value.count as $value | + { + name : "solr_metrics_node_thread_pool_completed_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "handler", "executor"], + label_values : [$category, $handler, $executor], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | contains(".threadPool.")) | select(.key | endswith(".running")) as $object | + $object.key | split(".") as $key_items | + $key_items | length as $label_len | + $key_items[0] as $category | + (if $label_len >= 5 then $key_items[1] else "" end) as $handler | + (if $label_len >= 5 then $key_items[3] else $key_items[2] end) as $executor | + $object.value as $value | + { + name : "solr_metrics_node_thread_pool_running", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "handler", "executor"], + label_values : [$category, $handler, $executor], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | contains(".threadPool.")) | select(.key | endswith(".submitted")) as $object | + $object.key | split(".") as $key_items | + $key_items | length as $label_len | + $key_items[0] as $category | + (if $label_len >= 5 then $key_items[1] else "" end) as $handler | + (if $label_len >= 5 then $key_items[3] else $key_items[2] end) as $executor | + $object.value.count as $value | + { + name : "solr_metrics_node_thread_pool_submitted_total", + type : "COUNTER", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "handler", "executor"], + label_values : [$category, $handler, $executor], + value : $value + } + + + .metrics["solr.node"] | to_entries | .[] | select(.key | endswith("Connections")) as $object | + $object.key | split(".") as $key_items | + $key_items | length as $label_len | + $key_items[0] as $category | + $key_items[1] as $handler | + $key_items[2] as $item | + $object.value as $value | + { + name : "solr_metrics_node_connections", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names : ["category", "handler", "item"], + label_values : [$category, $handler, $item], + value : $value + } + + + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith(".clientErrors")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + select($handler | startswith("/")) | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_client_errors_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_client_errors_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith(".errors")) | select (.value | type == "object") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + select($handler | startswith("/")) | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_errors_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_errors_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith(".requestTimes")) | select (.value | type == "object") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + select($handler | startswith("/")) | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_requests_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_requests_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith(".serverErrors")) | select (.value | type == "object") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + select($handler | startswith("/")) | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_server_errors_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_server_errors_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith(".timeouts")) | select (.value | type == "object") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + select($handler | startswith("/")) | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_timeouts_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_timeouts_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith(".totalTime")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + select($handler | startswith("/")) | + ($object.value / 1000) as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_time_seconds_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_time_seconds_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select (.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "CACHE.core.fieldCache") as $object | + $object.key | split(".")[0] as $category | + $object.value.entries_count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_field_cache_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core"], + label_values: [$category, $core], + value: $value + } + else + { + name: "solr_metrics_core_field_cache_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "collection", "shard", "replica"], + label_values: [$category, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | startswith("CACHE.searcher.")) | select (.key | endswith("documentCache") or endswith("fieldValueCache") or endswith("filterCache") or endswith("perSegFilter") or endswith("queryResultCache")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[2] as $type | + $object.value | to_entries | .[] | select(.key == "lookups" or .key == "hits" or .key == "size" or .key == "evictions" or .key == "inserts") as $target | + $target.key as $item | + $target.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_searcher_cache", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "type", "item"], + label_values: [$category, $core, $type, $item], + value: $value + } + else + { + name: "solr_metrics_core_searcher_cache", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "collection", "shard", "replica", "type", "item"], + label_values: [$category, $core, $collection, $shard, $replica, $type, $item], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | startswith("CACHE.searcher.")) | select (.key | endswith("documentCache") or endswith("fieldValueCache") or endswith("filterCache") or endswith("perSegFilter") or endswith("queryResultCache")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[2] as $type | + $object.value | to_entries | .[] | select(.key == "hitratio") as $target | + $target.key as $item | + $target.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_searcher_cache_ratio", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "type", "item"], + label_values: [$category, $core, $type, $item], + value: $value + } + else + { + name: "solr_metrics_core_searcher_cache_ratio", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "collection", "shard", "replica", "type", "item"], + label_values: [$category, $core, $collection, $shard, $replica, $type, $item], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | startswith("CACHE.searcher.")) | select (.key | endswith("documentCache") or endswith("fieldValueCache") or endswith("filterCache") or endswith("perSegFilter") or endswith("queryResultCache")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[2] as $type | + $object.value | to_entries | .[] | select(.key == "warmupTime") as $target | + $target.key as $item | + ($target.value / 1000) as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_searcher_warmup_time_seconds", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "type", "item"], + label_values: [$category, $core, $type, $item], + value: $value + } + else + { + name: "solr_metrics_core_searcher_warmup_time_seconds", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "collection", "shard", "replica", "type", "item"], + label_values: [$category, $core, $collection, $shard, $replica, $type, $item], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | startswith("CACHE.searcher.")) | select (.key | endswith("documentCache") or endswith("fieldValueCache") or endswith("filterCache") or endswith("perSegFilter") or endswith("queryResultCache")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[2] as $type | + $object.value | to_entries | .[] | select(.key == "cumulative_lookups" or .key == "cumulative_hits" or .key == "cumulative_evictions" or .key == "cumulative_inserts") as $target | + $target.key as $item | + $target.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_searcher_cumulative_cache_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "type", "item"], + label_values: [$category, $core, $type, $item], + value: $value + } + else + { + name: "solr_metrics_core_searcher_cumulative_cache_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "collection", "shard", "replica", "type", "item"], + label_values: [$category, $core, $collection, $shard, $replica, $type, $item], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | startswith("CACHE.searcher.")) | select (.key | endswith("documentCache") or endswith("fieldValueCache") or endswith("filterCache") or endswith("perSegFilter") or endswith("queryResultCache")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[2] as $type | + $object.value | to_entries | .[] | select(.key == "cumulative_hitratio") as $target | + $target.key as $item | + $target.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_searcher_cumulative_cache_ratio", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "type", "item"], + label_values: [$category, $core, $type, $item], + value: $value + } + else + { + name: "solr_metrics_core_searcher_cumulative_cache_ratio", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "collection", "shard", "replica", "type", "item"], + label_values: [$category, $core, $collection, $shard, $replica, $type, $item], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | startswith("CORE.fs.")) | select (.key | endswith(".totalSpace") or endswith(".usableSpace")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[2] as $item | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_fs_bytes", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "item"], + label_values: [$category, $core, $item], + value: $value + } + else + { + name: "solr_metrics_core_fs_bytes", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "collection", "shard", "replica", "item"], + label_values: [$category, $core, $collection, $shard, $replica, $item], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | startswith("HIGHLIGHTER.")) | select (.key | endswith(".requests")) as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $name | + $object.key | split(".")[2] as $item | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_highlighter_request_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "name", "item"], + label_values: [$category, $core, $name, $item], + value: $value + } + else + { + name: "solr_metrics_core_highlighter_request_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "collection", "shard", "replica", "name", "item"], + label_values: [$category, $core, $collection, $shard, $replica, $name, $item], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "INDEX.sizeInBytes") as $object | + $object.key | split(".")[0] as $category | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_index_size_bytes", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core"], + label_values: [$category, $core], + value: $value + } + else + { + name: "solr_metrics_core_index_size_bytes", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "collection", "shard", "replica"], + label_values: [$category, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "REPLICATION./replication.isMaster") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + (if $object.value == true then 1.0 else 0.0 end) as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_replication_master", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_replication_master", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "REPLICATION./replication.isSlave") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + (if $object.value == true then 1.0 else 0.0 end) as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_replication_slave", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_replication_slave", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "SEARCHER.searcher.deletedDocs" or .key == "SEARCHER.searcher.maxDoc" or .key == "SEARCHER.searcher.numDocs") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[2] as $item | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_searcher_documents", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "item"], + label_values: [$category, $core, $item], + value: $value + } + else + { + name: "solr_metrics_core_searcher_documents", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "core", "collection", "shard", "replica", "item"], + label_values: [$category, $core, $collection, $shard, $replica, $item], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.adds") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_adds", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_adds", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.autoCommits") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_auto_commits_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_auto_commits_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.commits") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_commits_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_commits_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.cumulativeAdds") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_adds_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_adds_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.cumulativeDeletesById") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_deletes_by_id_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_deletes_by_id_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.cumulativeDeletesByQuery") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_deletes_by_query_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_deletes_by_query_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.cumulativeErrors") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_errors_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_errors_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.deletesById") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_deletes_by_id", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_deletes_by_id", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.deletesByQuery") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_deletes_by_query", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_deletes_by_query", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.docsPending") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_pending_docs", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_pending_docs", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.errors") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_errors", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_errors", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.expungeDeletes") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_expunge_deletes_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_expunge_deletes_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.merges") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_merges_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_merges_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.optimizes") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_optimizes_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_optimizes_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.rollbacks") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_rollbacks_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_rollbacks_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.softAutoCommits") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_soft_auto_commits_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_soft_auto_commits_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key == "UPDATE.updateHandler.splits") as $object | + $object.key | split(".")[0] as $category | + $object.key | split(".")[1] as $handler | + $object.value.count as $value | + if $parent_key_item_len == 3 then + { + name: "solr_metrics_core_update_handler_splits_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core"], + label_values: [$category, $handler, $core], + value: $value + } + else + { + name: "solr_metrics_core_update_handler_splits_total", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["category", "handler", "core", "collection", "shard", "replica"], + label_values: [$category, $handler, $core, $collection, $shard, $replica], + value: $value + } + end + + + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.count) as $value | + { + name: "solr_metrics_core_query_count", + type: "COUNTER", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.meanRate) as $value | + { + name: "solr_metrics_core_query_meanrate", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value."1minRate") as $value | + { + name: "solr_metrics_core_query_1minrate", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value."5minRate") as $value | + { + name: "solr_metrics_core_query_5minrate", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value."15minRate") as $value | + { + name: "solr_metrics_core_query_15minrate", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.min_ms) as $value | + { + name: "solr_metrics_core_query_min_ms", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.max_ms) as $value | + { + name: "solr_metrics_core_query_max_ms", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.mean_ms) as $value | + { + name: "solr_metrics_core_query_mean_ms", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.median_ms) as $value | + { + name: "solr_metrics_core_query_median_ms", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.stddev_ms) as $value | + { + name: "solr_metrics_core_query_stddev_ms", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.p75_ms) as $value | + { + name: "solr_metrics_core_query_p75_ms", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.p95_ms) as $value | + { + name: "solr_metrics_core_query_p95_ms", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.p99_ms) as $value | + { + name: "solr_metrics_core_query_p99_ms", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + .metrics | to_entries | .[] | select(.key | startswith("solr.core.")) as $parent | + $parent.key | split(".") as $parent_key_items | + $parent_key_items | length as $parent_key_item_len | + (if $parent_key_item_len == 3 then $parent_key_items[2] else "" end) as $core | + (if $parent_key_item_len == 5 then $parent_key_items[2] else "" end) as $collection | + (if $parent_key_item_len == 5 then $parent_key_items[3] else "" end) as $shard | + (if $parent_key_item_len == 5 then $parent_key_items[4] else "" end) as $replica | + (if $parent_key_item_len == 5 then ($collection + "_" + $shard + "_" + $replica) else $core end) as $core | + $parent.value | to_entries | .[] | select(.key | endswith("select.requestTimes")) as $object | + ($object.value.p999_ms) as $value | + { + name: "solr_metrics_core_query_p999_ms", + type: "GAUGE", + help: "See following URL: https://lucene.apache.org/solr/guide/metrics-reporting.html", + label_names: ["core", "collection", "shard", "replica"], + label_values: [$core, $collection, $shard, $replica], + value: $value + } + + + + + + + + + + /admin/collections + + CLUSTERSTATUS + + + + + .cluster.live_nodes | length as $value| + { + name : "solr_collections_live_nodes", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/collections-api.html#clusterstatus", + label_names : [], + label_values : [], + value : $value + } + + + .cluster.collections | to_entries | .[] | . as $object | + $object.key as $collection | + $object.value.pullReplicas | tonumber as $value | + { + name : "solr_collections_pull_replicas", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/collections-api.html#clusterstatus", + label_names : ["collection"], + label_values : [$collection], + value : $value + } + + + .cluster.collections | to_entries | .[] | . as $object | + $object.key as $collection | + $object.value.nrtReplicas | tonumber as $value | + { + name : "solr_collections_nrt_replicas", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/collections-api.html#clusterstatus", + label_names : ["collection"], + label_values : [$collection], + value : $value + } + + + .cluster.collections | to_entries | .[] | . as $object | + $object.key as $collection | + $object.value.tlogReplicas | tonumber as $value | + { + name : "solr_collections_tlog_replicas", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/collections-api.html#clusterstatus", + label_names : ["collection"], + label_values : [$collection], + value : $value + } + + + .cluster.collections | to_entries | .[] | . as $object | + $object.key as $collection | + $object.value.shards | to_entries | .[] | . as $shard_obj | + $shard_obj.key as $shard | + (if $shard_obj.value.state == "active" then 1.0 else 0.0 end) as $value | + { + name : "solr_collections_shard_state", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/collections-api.html#clusterstatus", + label_names : ["collection","shard"], + label_values : [$collection,$shard], + value : $value + } + + + .cluster.collections | to_entries | .[] | . as $object | + $object.key as $collection | + $object.value.shards | to_entries | .[] | . as $shard_obj | + $shard_obj.key as $shard | + $shard_obj.value.replicas | to_entries | .[] | . as $replica_obj | + $replica_obj.key as $replica_name | + $replica_obj.value.core as $core | + $core[$collection + "_" + $shard + "_" | length:] as $replica | + $replica_obj.value.base_url as $base_url | + $replica_obj.value.node_name as $node_name | + $replica_obj.value.type as $type | + (if $replica_obj.value.state == "active" then 1.0 else 0.0 end) as $value | + { + name : "solr_collections_replica_state", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/collections-api.html#clusterstatus", + label_names : ["collection", "shard", "replica", "replica_name", "core", "base_url", "node_name", "type"], + label_values : [$collection, $shard, $replica, $replica_name, $core, $base_url, $node_name, $type], + value : $value + } + + + .cluster.collections | to_entries | .[] | . as $object | + $object.key as $collection | + $object.value.shards | to_entries | .[] | . as $shard_obj | + $shard_obj.key as $shard | + $shard_obj.value.replicas | to_entries | .[] | . as $replica_obj | + $replica_obj.key as $replica_name | + $replica_obj.value.core as $core | + $core[$collection + "_" + $shard + "_" | length:] as $replica | + $replica_obj.value.base_url as $base_url | + $replica_obj.value.node_name as $node_name | + $replica_obj.value.type as $type | + (if $replica_obj.value.leader == "true" then 1.0 else 0.0 end) as $value | + { + name : "solr_collections_shard_leader", + type : "GAUGE", + help : "See following URL: https://lucene.apache.org/solr/guide/collections-api.html#clusterstatus", + label_names : ["collection", "shard", "replica", "replica_name", "core", "base_url", "node_name", "type"], + label_values : [$collection, $shard, $replica, $replica_name, $core, $base_url, $node_name, $type], + value : $value + } + + + + + + + + + + diff --git a/templates/solr.xml.j2 b/templates/solr.xml.j2 new file mode 100644 index 0000000..dbcb9e5 --- /dev/null +++ b/templates/solr.xml.j2 @@ -0,0 +1,62 @@ + + + + + + + + + {% if not solr_multicore %} + {{ ansible_fqdn }} + {{ solr_http_port_1 }} + ${hostContext:solr} + {{ solr_zk_timeout }} + ${genericCoreNodeNames:true} + {% if solr_zk_external_cluster %} + {{ solr_zk_hosts }} + {% endif %} + {% endif %} + + + + ${socketTimeout:0} + ${connTimeout:0} + + + {% if solr_multicore %} + + {% for core in solr_cores %} + + + + + + {% endfor %} + + {% endif %} + + + diff --git a/templates/solr_prometheus_exporter.systemd.j2 b/templates/solr_prometheus_exporter.systemd.j2 new file mode 100644 index 0000000..e587e10 --- /dev/null +++ b/templates/solr_prometheus_exporter.systemd.j2 @@ -0,0 +1,11 @@ +[Unit] +Description=solr_prometheus_exporter - Prometheus exporter for Solr metrics. +After=network.target + +[Service] +Type=simple +User={{ solr_user }} +Group={{ solr_group }} +ExecStart={{ solr_prometheus_bindir }}/{{ solr_prometheus_command }} {{ solr_prometheus_command_params }} +Restart=on-failure + diff --git a/templates/solr_prometheus_exporter.upstart.j2 b/templates/solr_prometheus_exporter.upstart.j2 new file mode 100644 index 0000000..8b0d056 --- /dev/null +++ b/templates/solr_prometheus_exporter.upstart.j2 @@ -0,0 +1,12 @@ +description "Solr exporter for Prometheus" +start on (local-filesystems and net-device-up IFACE!=lo) +stop on runlevel [016] + +respawn +respawn limit 10 5 +setuid {{ solr_user }} +setgid {{ solr_group }} + +script + exec {{ solr_prometheus_bindir }}/{{ solr_prometheus_command }} {{ solr_prometheus_command_params }} +end script diff --git a/templates/zoo.cfg.j2 b/templates/zoo.cfg.j2 new file mode 100644 index 0000000..321156f --- /dev/null +++ b/templates/zoo.cfg.j2 @@ -0,0 +1,17 @@ +# The number of milliseconds of each tick +tickTime=2000 +# The number of ticks that the initial +# synchronization phase can take +initLimit=10 +# The number of ticks that can pass between +# sending a request and getting an acknowledgement +syncLimit=5 + +# the directory where the snapshot is stored. +dataDir={{ solr_zookeeper_data_dir }} +# NOTE: Solr defaults the dataDir to /zoo_data + +# the port at which the clients will connect +clientPort={{ solr_zoo_port }} +# NOTE: Solr sets this based on zkRun / zkHost params +