mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
@@ -124,6 +124,7 @@ by following the steps under the `SNMP Extend` heading.
|
||||
1. [Puppet Agent](#puppet_agent) - SNMP extend
|
||||
1. [PureFTPd](#pureftpd) - SNMP extend
|
||||
1. [Raspberry PI](#raspberry-pi) - SNMP extend
|
||||
1. [Redis](#redis) - SNMP extend
|
||||
1. [SDFS info](#sdfs-info) - SNMP extend
|
||||
1. [Seafile](#seafile) - SNMP extend
|
||||
1. [SMART](#smart) - SNMP extend
|
||||
@@ -1575,6 +1576,24 @@ the user snmpd is using with `ps aux | grep snmpd`
|
||||
|
||||
5: Restart snmpd on PI host
|
||||
|
||||
# Redis
|
||||
|
||||
SNMP extend script to monitor your Redis Server
|
||||
|
||||
## SNMP Extend
|
||||
|
||||
1: Download the script onto the desired host. `wget
|
||||
https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/redis.py
|
||||
-O /etc/snmp/redis.py`
|
||||
|
||||
2: Make the script executable: `chmod +x /etc/snmp/redis.py`
|
||||
|
||||
3: Edit your snmpd.conf file (usually `/etc/snmp/snmpd.conf`) and add:
|
||||
|
||||
```
|
||||
extend redis /etc/snmp/redis.py
|
||||
```
|
||||
|
||||
# Seafile
|
||||
|
||||
SNMP extend script to monitor your Seafile Server
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Clients';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$array = array(
|
||||
'connected' => 'Connected',
|
||||
'blocked' => 'Blocked',
|
||||
);
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'clients'));
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Commands';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'commands'));
|
||||
|
||||
$array = array(
|
||||
'processed' => 'Processed',
|
||||
);
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Connections';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'connections'));
|
||||
|
||||
$array = array(
|
||||
'received' => 'Received',
|
||||
'rejected' => 'Rejected',
|
||||
);
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Defrag';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'defrag'));
|
||||
|
||||
$array = array(
|
||||
'hits' => 'Hits',
|
||||
'misses' => 'Misses',
|
||||
'key_hits' => 'Key Hits',
|
||||
'key_misses' => 'Key Misses',
|
||||
);
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Fragmentation';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'fragmentation'));
|
||||
|
||||
$array = array(
|
||||
'bytes' => 'Bytes',
|
||||
);
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Keyspace';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'keyspace'));
|
||||
|
||||
$array = array(
|
||||
'hits' => 'Hits',
|
||||
'misses' => 'Misses',
|
||||
);
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Memory';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'memory'));
|
||||
|
||||
$array = array(
|
||||
'active' => 'Active',
|
||||
'allocated' => 'Allocated',
|
||||
'resident' => 'Resident',
|
||||
'frag_bytes' => 'Frag Bytes',
|
||||
'rss_bytes' => 'RSS Bytes',
|
||||
);
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Net';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'net'));
|
||||
|
||||
$array = array(
|
||||
'input_bytes' => 'Input',
|
||||
'output_bytes' => 'Output',
|
||||
);
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Objects';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'objects'));
|
||||
|
||||
$array = array(
|
||||
'pending' => 'Pending',
|
||||
);
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Sync';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'sync'));
|
||||
|
||||
$array = array(
|
||||
'full' => 'Full',
|
||||
'ok' => 'OK',
|
||||
'err' => 'Error',
|
||||
);
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
require 'includes/html/graphs/common.inc.php';
|
||||
|
||||
$scale_min = 0;
|
||||
$nototal = 1;
|
||||
$unit_text = 'Usage';
|
||||
$unitlen = 15;
|
||||
$bigdescrlen = 20;
|
||||
$smalldescrlen = 15;
|
||||
$colours = 'mixed';
|
||||
|
||||
$rrd_filename = rrd_name($device['hostname'], array('app', 'redis', $app['app_id'], 'usage'));
|
||||
|
||||
$array = array(
|
||||
'allocated' => 'Allocated',
|
||||
'dataset' => 'Dataset',
|
||||
'lua' => 'LUA',
|
||||
'overhead' => 'Overhead',
|
||||
'peak' => 'Peak',
|
||||
'rss' => 'RSS',
|
||||
'scripts' => 'Scripts',
|
||||
'startup' => 'Startup',
|
||||
);
|
||||
|
||||
$rrd_list = array();
|
||||
if (rrdtool_check_rrd_exists($rrd_filename)) {
|
||||
$i = 0;
|
||||
foreach ($array as $ds => $descr) {
|
||||
$rrd_list[$i]['filename'] = $rrd_filename;
|
||||
$rrd_list[$i]['descr'] = $descr;
|
||||
$rrd_list[$i]['ds'] = $ds;
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
echo "file missing: $rrd_filename";
|
||||
}
|
||||
|
||||
require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php';
|
||||
@@ -27,6 +27,18 @@ $graphs['memcached'] = array(
|
||||
'data',
|
||||
'items',
|
||||
);
|
||||
$graphs['redis'] = array(
|
||||
'clients',
|
||||
'objects',
|
||||
'fragmentation',
|
||||
'usage',
|
||||
'defrag',
|
||||
'keyspace',
|
||||
'sync',
|
||||
'commands',
|
||||
'connections',
|
||||
'net',
|
||||
);
|
||||
$graphs['nginx'] = array(
|
||||
'connections',
|
||||
'req',
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
$graphs = array(
|
||||
'redis_clients' => 'Clients',
|
||||
'redis_memory' => 'Memory',
|
||||
'redis_commands' => 'Commands',
|
||||
'redis_connections' => 'Connections',
|
||||
'redis_defrag' => 'Defrag',
|
||||
'redis_fragmentation' => 'Fragmentation',
|
||||
'redis_keyspace' => 'Keyspace',
|
||||
'redis_net' => 'Net',
|
||||
'redis_objects' => 'Objects',
|
||||
'redis_sync' => 'Sync',
|
||||
'redis_usage' => 'Usage',
|
||||
);
|
||||
|
||||
foreach ($graphs as $key => $text) {
|
||||
$graph_type = $key;
|
||||
$graph_array['height'] = '100';
|
||||
$graph_array['width'] = '215';
|
||||
$graph_array['to'] = time();
|
||||
$graph_array['id'] = $app['app_id'];
|
||||
$graph_array['type'] = 'application_'.$key;
|
||||
echo '<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">'.$text.'</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">';
|
||||
include 'includes/html/print-graphrow.inc.php';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
echo '</div>';
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
use LibreNMS\Exceptions\JsonAppMissingKeysException;
|
||||
use LibreNMS\Exceptions\JsonAppException;
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
|
||||
$name = 'redis';
|
||||
$app_id = $app['app_id'];
|
||||
$output = 'OK';
|
||||
|
||||
try {
|
||||
$redis_data = json_app_get($device, $name, 1)['data'];
|
||||
} catch (JsonAppMissingKeysException $e) {
|
||||
$redis_data = $e->getParsedJson();
|
||||
} catch (JsonAppException $e) {
|
||||
echo PHP_EOL . $name . ':' .$e->getCode().':'. $e->getMessage() . PHP_EOL;
|
||||
update_application($app, $e->getCode().':'.$e->getMessage(), []); // Set empty metrics and error message
|
||||
return;
|
||||
}
|
||||
|
||||
$client_data = $redis_data['Clients'];
|
||||
$memory_data = $redis_data['Memory'];
|
||||
$stats_data = $redis_data['Stats'];
|
||||
|
||||
$metrics = array();
|
||||
|
||||
$category = 'clients';
|
||||
$fields = array(
|
||||
'connected' => $client_data['connected_clients'],
|
||||
'blocked' => $client_data['blocked_clients'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('connected', 'GAUGE', 0)
|
||||
->addDataset('blocked', 'GAUGE', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
|
||||
$category = 'memory';
|
||||
$fields = array(
|
||||
'active' => $memory_data['allocator'],
|
||||
'allocated' => $memory_data['allocator_allocated'],
|
||||
'resident' => $memory_data['allocator_resident'],
|
||||
'frag_bytes' => $memory_data['allocator_frag_bytes'],
|
||||
'rss_bytes' => $memory_data['allocator_rss_bytes'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('active', 'GAUGE', 0)
|
||||
->addDataset('allocated', 'GAUGE', 0)
|
||||
->addDataset('resident', 'GAUGE', 0)
|
||||
->addDataset('frag_bytes', 'GAUGE', 0)
|
||||
->addDataset('rss_bytes', 'GAUGE', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
|
||||
$category = 'objects';
|
||||
$fields = array(
|
||||
'pending' => $memory_data['lazyfree_pending_objects'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('pending', 'GAUGE', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
|
||||
$category = 'fragmentation';
|
||||
$fields = array(
|
||||
'bytes' => $memory_data['mem_fragmentation_bytes'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('bytes', 'GAUGE', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
|
||||
$category = 'usage';
|
||||
$fields = array(
|
||||
'allocated' => $memory_data['used_memory'],
|
||||
'dataset' => $memory_data['used_memory_dataset'],
|
||||
'lua' => $memory_data['used_memory_lua'],
|
||||
'overhead' => $memory_data['used_memory_overhead'],
|
||||
'peak' => $memory_data['used_memory_peak'],
|
||||
'rss' => $memory_data['used_memory_rss'],
|
||||
'scripts' => $memory_data['used_memory_scripts'],
|
||||
'startup' => $memory_data['used_memory_startup'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('allocated', 'COUNTER', 0)
|
||||
->addDataset('dataset', 'GAUGE', 0)
|
||||
->addDataset('lua', 'GAUGE', 0)
|
||||
->addDataset('overhead', 'GAUGE', 0)
|
||||
->addDataset('peak', 'GAUGE', 0)
|
||||
->addDataset('rss', 'GAUGE', 0)
|
||||
->addDataset('scripts', 'GAUGE', 0)
|
||||
->addDataset('startup', 'GAUGE', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
|
||||
$category = 'defrag';
|
||||
$fields = array(
|
||||
'hits' => $stats_data['active_defrag_hits'],
|
||||
'misses' => $stats_data['active_defrag_misses'],
|
||||
'key_hits' => $stats_data['active_defrag_key_hits'],
|
||||
'key_misses' => $stats_data['active_defrag_key_misses'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('hits', 'GAUGE', 0)
|
||||
->addDataset('misses', 'GAUGE', 0)
|
||||
->addDataset('key_hits', 'GAUGE', 0)
|
||||
->addDataset('key_misses', 'GAUGE', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
|
||||
$category = 'keyspace';
|
||||
$fields = array(
|
||||
'hits' => $stats_data['keyspace_hits'],
|
||||
'misses' => $stats_data['keyspace_misses'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('hits', 'COUNTER', 0)
|
||||
->addDataset('misses', 'COUNTER', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
|
||||
$category = 'sync';
|
||||
$fields = array(
|
||||
'full' => $stats_data['sync_full'],
|
||||
'ok' => $stats_data['sync_partial_ok'],
|
||||
'err' => $stats_data['sync_partial_err'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('full', 'GAUGE', 0)
|
||||
->addDataset('ok', 'GAUGE', 0)
|
||||
->addDataset('err', 'GAUGE', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
|
||||
$category = 'commands';
|
||||
$fields = array(
|
||||
'processed' => $stats_data['total_commands_processed'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('processed', 'COUNTER', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
|
||||
$category = 'connections';
|
||||
$fields = array(
|
||||
'received' => $stats_data['total_connections_received'],
|
||||
'rejected' => $stats_data['rejected_connections'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('received', 'COUNTER', 0)
|
||||
->addDataset('rejected', 'COUNTER', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
|
||||
$category = 'net';
|
||||
$fields = array(
|
||||
'input_bytes' => $stats_data['total_net_input_bytes'],
|
||||
'output_bytes' => $stats_data['total_net_output_bytes'],
|
||||
);
|
||||
$rrd_def = RrdDefinition::make()
|
||||
->addDataset('input_bytes', 'COUNTER', 0)
|
||||
->addDataset('output_bytes', 'COUNTER', 0);
|
||||
$rrd_name = array('app', $name, $app_id, $category);
|
||||
|
||||
$metrics[$category] = $fields;
|
||||
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
||||
data_update($device, 'app', $tags, $fields);
|
||||
|
||||
update_application($app, $output, $metrics);
|
||||
Reference in New Issue
Block a user