Share

Fruity : A Nagios Configuration Tool

Tracker: Bugs

5 Use "reload" instead of "stop/start" - ID: 1639736
Last Update: Comment added ( nkadelgarcia )

Hi,

not really a bug, just a suggestion: Why does the export script stops and
starts nagios again instead of just reloading the configuration
(/etc/init.d/nagios reload)?

Problem is that "/etc/init.d/nagios stop" requires the user which runs the
apache to have the "kill" permission. Of course, this can be "sudo"ed, but
it would be easier to use the reload command.

I introduced a new configuration item "nagios_reload" and adjusted the
export.php script slightly to:

<?php
$output = array();
exec($sys_config['nagios_reload'], $output, $rv);
foreach($output as $line) {
print($line . "<br />");
}
if($rv) {
if($rv == 126) {
?>
Unable to execute the Nagios Reload Command. Check
permissions to run '<?=$sys_config['nagios_reload'];?>' and try again...<br
/>
<?php
}
else {
?>
Reloading Nagios Failed via
'<?=$sys_config['nagios_reload'];?>'. Check the command and try
again...<br />
<?php
}
}
else
{
print("Nagios reloaded with exported configuration.<br /><br />");
}
?>

instead of the stop and start commands.

Tobias.


Nobody/Anonymous ( nobody ) - 2007-01-19 17:54

5

Open

None

Taylor

Export

None

Public


Comments ( 7 )




Date: 2008-04-27 12:44
Sender: nkadelgarcia


And oh, yes, in case you didn't, know, Fruity is dead. It's been forked
and renamed, to 'Lilac', and development is proceeding over at
http://sourceforge.net/projects/lilac/.


Date: 2008-04-27 12:41
Sender: nkadelgarcia


Tobias, this was an issue in Fruity, too.

sudo actually has some problems in recent configurations, such as RHEL 5,
where it won't run these commands without a tty. This disables it running
from Apache. And the Nagios reload command is, historically, not reliable
when the configurations have changed a lot: I never succeeded in tracking
down what it tripped over, but it's not reliable.

There were problems in Fruity because the checks would not detect 'sudo
command' as a binary, and block it. So I personally wound up writing little
root-owned scripts to hide the sudo command inside, but this seems painful.
Perhaps a pair of limited suid tools that would *only* stop and start
Nagios are the way to go?




Date: 2008-02-14 19:45
Sender: matthewjackson


This pointed me in the right direction and just like the last comment I
ended up giving sudo permissions to the apache user to allow the correct
stop and start of the nagios process. In the future I'll look at doing the
reload code because that makes more sense.


Date: 2007-06-22 21:59
Sender: tdondichProject AdminAccepting Donations


Sounds good. I'll be implementing this in the new export manager setup.


Date: 2007-06-06 11:09
Sender: nkadelgarcia


Would you please publish your modifications as a new patch file? The
Nagios restart commands really clutter up my service logs, and I'd like to
avoid them.


Date: 2007-03-05 15:52
Sender: nobody

Logged In: NO

This is an unfortunate problem if your previous nagios was not running or
failed to start, especially when starting out with fruity and having
permissions issues. It's more reliable to either check the status of the
init script, which some systems do not support well, or do a complete
restart.




Date: 2007-01-28 21:53
Sender: nobody

Logged In: NO

Thanks for the post...that pointed me in the right direction. I ended up
using your script with a sudo nagios restart, used visudo to add the rights
to user daemon and then replace the restart sequence with you above code.
Thanks.


Log in to comment.




Attached File

No Files Currently Attached

Change ( 1 )

Field Old Value Date By
assigned_to nobody 2007-06-22 21:59 tdondich