Home Directory Addons Components ModGearman XI Manager

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

ModGearman XI Manager

Current Version
1.0.2
Last Release Date
2017-03-13
Compatible With
  • Nagios XI
Owner
License
GPL
Hits
5189
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
This is a component used to manage a variety of ModGearman Servers/Workers, possibly running different versions of ModGearman, from a central location - within the Nagios XI interface.

Updated for systemd by MyCatHasEyes (Thanks Steve!) https://github.com/hedenface/ModGearmanXIManager/commits/master?author=MyCatHasEyes

Update to fix some PHP log errors and SSH (Thanks again Steve! ;) )
https://github.com/hedenface/ModGearmanXIManager/commit/1b28af16ff2058a521a9f3a4e24ed0a5eb07269b
Fork of: https://exchange.nagios.org/directory/Addons/Components/ModGearman-Manager/details

* Improved codebase
* Accounts for more significant worker variables [username to connect as, configuration file location, service control script]
* Tests and prints meaningful output as to the state of gearman worker processes on remote servers

How to Use
1) Download the ZIP file (http://heden.consulting/nagios/modgearmanxi.zip)
2) Upload it to your Nagios XI instance (Admin -> Manage Components -> Upload)
3) Run the included setup.sh file, which sets up necessary permissions on the workers
4) Update the $gearmanxi_cfg array in modgearmanxi.php to reflect your environment
5) Click on Admin -> ModGearman XI Manager and enjoy managing your ModGearman instances!
Reviews (2)
Hi.
I have tried to test the component but when loading it to Nagios XI (version 5.4.4), it displays the message "Component installation failed. Uploaded file is not a component."
Very nice software, it gives the ability to change worker options and check status of each, but it doesn't support systemctl yet, only initd.
The best thing to do IMO would be to add to the cfg array in modgearmanxi.config.inc.php a key like 'bootmgr' with values 'initd' or 'systemctl' to handle this.

for now, to enable it for systemctl i did the following:

---------------------
On the worker server:
Added the following to /etc/sudoers with command "visudo" (at the bottom of the file):
myuser ALL = NOPASSWD: /usr/bin/systemctl start mod-gearman2-worker
myuser ALL = NOPASSWD: /usr/bin/systemctl stop mod-gearman2-worker
myuser ALL = NOPASSWD: /usr/bin/systemctl restart mod-gearman2-worker

NOTE: change "myuser" to whatever user you configured on setup.sh
This enables remote ssh to sudo the command on the worker without asking for a pw.

---------------------
On the XI Server:

cd /usr/local/nagiosxi/html/includes/components/modgearmanxi/

Changed modgearmanxi.config.inc.php:
in each entry in the array i put the following:
'initd' => 'mod-gearman2-worker.service'

Changed modgearmanxi.php:
1) replaced function service_status with the following:
function service_status($user, $host, $script, &$return_output) {
exec_ssh_command($user, $host, "systemctl status $script", $output, $return_var);
$output = $output[2];
if ($return_var == 0) {
$return_output = $output;
if (strpos($output, "Active: active") !== false)
return true;
} else {
if (strpos($output, "Active: inactive") !== false)
$return_output = $output;
else
$return_output = "Unknown error running service control script";
}
return false;
}


2) replaced function control_worker with the following:
function control_worker($action) {

global $gearmanxi_cfg;
global $errors;
$worker_id = base64_decode(grab_request_var("worker_id", ""));
if ($worker_id === false) {
$errors[] = "Attempted to control worker with no worker specified";
return false;
}

// make sure user input sane
if ($action !== "start" && $action !== "restart" && $action !== "stop") {
$errors[] = "Available options for service control: start/restart/stop";
return false;
}

$worker = $gearmanxi_cfg["worker"][$worker_id];
exec_ssh_command($worker["user"], $worker["ip"], "sudo systemctl $action " . $worker["initd"], $output, $return_var);
if ($return_var == 0)
return true;

return false;
}

Andrea.
Owner's reply

This has been updated in the most recent version. Thanks!