feature: Added opengridscheduler job tracker application (#6419)

* opengridscheduler job tracker

* wrong copy of file

* applied laf's review. Thx laf!

* now including the modified files; thx laf for the review!

* Update Applications.md
This commit is contained in:
Svennd
2017-04-24 15:19:36 +02:00
committed by Neil Lathwood
parent 43914fbc7f
commit b2e6d8abef
6 changed files with 166 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ Different applications support a variety of ways collect data: by direct connect
1. [NTP Client](#ntp-client) - SNMP extend
1. [NTP Server](#ntp-server) - SNMP extend
1. [Nvidia GPU](#nvidia-gpu) - SNMP extend
1. [Open Grid Scheduler](#opengridscheduler) - SNMP extend
1. [OS Updates](#os-updates) - SNMP extend
1. [PHP-FPM](#php-fpm) - SNMP extend
1. [Postfix](#postfix) - SNMP extend
@@ -389,6 +390,22 @@ The GPU numbering on the graphs will correspond to how the nvidia-smi sees them
For questions about what the various values are/mean, please see the nvidia-smi man file under the section covering dmon.
### Open Grid Scheduler
Shell script to track the OGS/GE jobs running on clusters.
#### SNMP Extend
1. Download the script onto the desired host (the host must be added to LibreNMS devices)
```
wget https://raw.githubusercontent.com/librenms/librenms-agent/master/agent-local/rocks.sh -O /etc/snmp/rocks.sh
```
2. Make the script executable (chmod +x /etc/snmp/rocks.sh)
3. Edit your snmpd.conf file (usually /etc/snmp/snmpd.conf) and add:
```
extend ogs /etc/snmp/rocks.sh
```
### OS Updates
A small shell script that checks your system package manager for any available updates. Supports apt-get/pacman/yum/zypper package managers).

View File

@@ -112,6 +112,9 @@ function nicecase($item)
case 'php-fpm':
return 'PHP-FPM';
case 'opengridscheduler':
return 'Open Grid Scheduler';
default:
return ucfirst($item);
}

View File

@@ -0,0 +1,50 @@
<?php
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*
* @package LibreNMS
* @subpackage opengridscheduler
* @link http://librenms.org
* @copyright 2017 LibreNMS
* @author SvennD <svennd@svennd.be>
*/
require 'includes/graphs/common.inc.php';
$scale_min = 0;
$colours = 'mixed';
$unit_text = 'Jobs';
$unitlen = 15;
$bigdescrlen = 15;
$smalldescrlen = 15;
$dostack = 0;
$printtotal = 0;
$addarea = 1;
$transparency = 33;
$rrd_filename = rrd_name($device['hostname'], array('app', 'ogs', $app['app_id']));
$array = array(
'running_jobs' => array('descr' => 'running'),
'pending_jobs' => array('descr' => 'pending'),
'suspend_jobs' => array('descr' => 'suspend'),
// 'zombie_jobs' => array('descr' => 'zombie') // this is a bad naming, zombies in sge are cached finished jobs
);
$i = 0;
if (rrdtool_check_rrd_exists($rrd_filename)) {
foreach ($array as $ds => $var) {
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $var['descr'];
$rrd_list[$i]['ds'] = $ds;
$rrd_list[$i]['colour'] = $config['graph_colours'][$colours][$i];
$i++;
}
} else {
echo "file missing: $rrd_filename";
}
require 'includes/graphs/generic_v3_multiline.inc.php';

View File

@@ -194,6 +194,10 @@ $graphs['squid'] = array(
'cputime',
);
$graphs['opengridscheduler'] = array(
'ogs'
);
$graphs['fbsd-nfs-server'] = array(
'stats',
'cache',

View File

@@ -0,0 +1,40 @@
<?php
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*
* @package LibreNMS
* @subpackage opengridscheduler
* @link http://librenms.org
* @copyright 2017 LibreNMS
* @author SvennD <svennd@svennd.be>
*/
global $config;
$graphs = array(
'opengridscheduler_ogs' => 'Open Grid Scheduler Job Queue',
);
foreach ($graphs as $key => $text) {
$graph_type = $key;
$graph_array['height'] = '100';
$graph_array['width'] = '215';
$graph_array['to'] = $config['time']['now'];
$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/print-graphrow.inc.php';
echo '</div>';
echo '</div>';
echo '</div>';
}

View File

@@ -0,0 +1,52 @@
<?php
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*
* @package LibreNMS
* @subpackage opengridscheduler
* @link http://librenms.org
* @copyright 2017 LibreNMS
* @author SvennD <svennd@svennd.be>
*/
use LibreNMS\RRD\RrdDefinition;
$name = 'ogs';
$app_id = $app['app_id'];
$oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.3.111.103.115';
echo ' ' . $name;
// get data through snmp
$ogs_data = snmp_get($device, $oid, '-Oqv');
// let librenms know that we got good data
update_application($app, $ogs_data);
// define the rrd
$rrd_name = array('app', $name, $app_id);
$rrd_def = RrdDefinition::make()
->addDataset('running_jobs', 'GAUGE', 0)
->addDataset('pending_jobs', 'GAUGE', 0)
->addDataset('suspend_jobs', 'GAUGE', 0)
->addDataset('zombie_jobs', 'GAUGE', 0);
// parse the data from the script
$data = explode("\n", $ogs_data);
$fields = array(
'running_jobs' => $data[0],
'pending_jobs' => $data[1],
'suspend_jobs' => $data[2],
'zombie_jobs' => $data[3],
);
// push the data in an array and into the rrd
$tags = compact('name', 'app_id', 'rrd_name', 'rrd_def');
data_update($device, 'app', $tags, $fields);
// cleanup
unset($ogs_data, $rrd_name, $rrd_def, $data, $fields, $tags);