Added Seafile Server Monitoring (#10465)

* Seafile Monitoring

* generalized function for application with multiple similar entries

* adding snmprec file

* Create linux_seafile-v1.json

* Update linux_seafile-v1.snmprec

Updated linux_seafile-v1.snmprec to use 4x for encoding json data response

* Update Applications.md
This commit is contained in:
SourceDoctor
2019-10-22 00:28:21 +02:00
committed by Neil Lathwood
parent d3994b3671
commit 8f1c77545d
16 changed files with 588 additions and 31 deletions

View File

@@ -1290,31 +1290,65 @@ function get_postgres_databases($device_id)
return array();
}
/**
* Get all application data from the collected
* rrd files.
*
* @param array $device device for which we get the rrd's
* @param int $app_id application id on the device
* @param string $category which category of seafile graphs are searched
* @return array list of entry data
*/
function get_arrays_with_application($device, $app_id, $app_name, $category = null)
{
$entries = array();
if ($category) {
$pattern = sprintf('%s/%s-%s-%s-%s-*.rrd', get_rrd_dir($device['hostname']), 'app', $app_name, $app_id, $category);
} else {
$pattern = sprintf('%s/%s-%s-%s-*.rrd', get_rrd_dir($device['hostname']), 'app', $app_name, $app_id);
}
foreach (glob($pattern) as $rrd) {
$filename = basename($rrd, '.rrd');
list(,,, $entry) = explode("-", $filename, 4);
if ($entry) {
array_push($entries, $entry);
}
}
return $entries;
}
/**
* Get all seafile data from the collected
* rrd files.
*
* @param array $device device for which we get the rrd's
* @param int $app_id application id on the device
* @param string $category which category of seafile graphs are searched
* @return array list of seafile data
*/
function get_arrays_with_seafile($device, $app_id, $category)
{
$app_name = 'seafile';
return get_arrays_with_application($device, $app_id, $app_name, $category);
}
/**
* Get all mdadm arrays from the collected
* rrd files.
*
* @param array $device device for which we get the rrd's
* @param int $app_id application id on the device
* @return array list of disks
* @return array list of raid-arrays
*/
function get_arrays_with_mdadm($device, $app_id)
{
$arrays = array();
$pattern = sprintf('%s/%s-%s-%s-*.rrd', get_rrd_dir($device['hostname']), 'app', 'mdadm', $app_id);
foreach (glob($pattern) as $rrd) {
$filename = basename($rrd, '.rrd');
list(,,, $array_name) = explode("-", $filename, 4);
if ($array_name) {
array_push($arrays, $array_name);
}
}
return $arrays;
$app_name = 'mdadm';
return get_arrays_with_application($device, $app_id, $app_name);
}
/**
@@ -1327,21 +1361,8 @@ function get_arrays_with_mdadm($device, $app_id)
*/
function get_disks_with_smart($device, $app_id)
{
$disks = array();
$pattern = sprintf('%s/%s-%s-%s-*.rrd', get_rrd_dir($device['hostname']), 'app', 'smart', $app_id);
foreach (glob($pattern) as $rrd) {
$filename = basename($rrd, '.rrd');
list(,,, $disk) = explode("-", $filename, 4);
if ($disk) {
array_push($disks, $disk);
}
}
return $disks;
$app_name = 'smart';
return get_arrays_with_application($device, $app_id, $app_name);
}
/**