PHP code example of quazardous / munin-solr-metrics
1. Go to this page and download the library: Download quazardous/munin-solr-metrics library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
quazardous / munin-solr-metrics example snippets
return [
// First level elements are profiles.
// Each profile will produce a multigraph plugin.
'default' => [
// You have to define the SolR Metrics API query
'solr_metrics_query' => 'http://localhost:8983/solr/admin/metrics',
// You can use any query parameters. Be aware that some parameters can change the response structure and affect the metric definitions below.
// 'solr_metrics_query' => 'http://localhost:8983/solr/admin/metrics?group=core',
//'solr_auth' => 'user:password', // the plugin can handle basic auth
'graphs' => [
// each graph element will produce a munin graph entry.
'graph1' => [
'fields' => [
'2xx' => [
// You can target any existing metric
// Use `|` (pipe) to create a metric path.
'metric' => 'solr.jetty|org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses|count',
// Any othe attribute will be added as field attribute to the munin graph config.
'draw' => 'LINE', // will produce `_2xx.draw LINE`
],
'2xx.1minRate' => [
'metric' => 'solr.jetty|org.eclipse.jetty.server.handler.DefaultHandler.2xx-responses|1minRate',
],
'error' => [
'metric' => [
// if metric is an array, metrics will be aggregated
'solr.jetty|org.eclipse.jetty.server.handler.DefaultHandler.4xx-responses|count',
'solr.jetty|org.eclipse.jetty.server.handler.DefaultHandler.5xx-responses|count',
],
// by default metrics are added together but you can specify your own function, metrics are passed by arg in order
// 'metric_aggregate' => function ($metric1, $metric2) { return $metric1 + $metric2; },
],
],
// Any other attributes will be added to the munin graph config.
'graph_category' => 'solr',
'graph_info' => 'Something meaningful',
],
]
],
];