manuel321
Goto Top

Wie kann ich Nagios auch übers Webinterface navigieren

Hi Leute,

ich habe folgendes Problem, ich hab Nagios soweit super eingerichtet, kann auch Dienste verwalten etc., aber ich möchte dies auch
übers Webinterface tun, ich hab mich soweit in das Problem eingelesen das ich die nötigen User und Rechte für den Ordner
/usr/local/nagios/var/rw/ in der die datei nagios.cmd liegt gemacht habe. Des weiteren habe ich auch daran gedacht check_external_commands= von 0 auf 1 zu setzen, sodass es überhaupt erlaubt ist. Aber ich bekomme immer diesen Fehler hier
Error: Could not open command file '/usr/local/nagios/var/rw/nagios.cmd' for update!. Wenn jemand ne Idee hat was ich vergessen haben könnte,warum es nicht funktioniert oder wenn ihr mehr infos benötigt bin ich euch sehr dankbar, ich komm nämlich hier nicht weiter =(


mfg manu

Content-Key: 45272

Url: https://administrator.de/contentid/45272

Ausgedruckt am: 29.03.2024 um 01:03 Uhr

Mitglied: gnarff
gnarff 24.11.2006 um 18:25:11 Uhr
Goto Top
hallo manuel!

-bist so vorgegangen, wie in dem external command file permissions-doc auf sourceforge?
http://nagios.sourceforge.net/docs/2_0/commandfile.html


Answer:
[...]will work if your web server is part of the
nagios group. Is it? Have you restarted your web server since adding it
to that group? If not, you should read the documentation on External
Commands, specifically the page about setting proper permissions.
There's nothing magical about it and it follows standard unix file
permission logic.

Make sure the sticky bit is on /usr/local/nagios/var/rw directory. Also, make sure that the webserver which may be called 'wwwrun' is part of the same group as nagios. Then, it should work with no problems.

(quelle: nagiosexchange.org -forum)

saludos
gnarff
Mitglied: manuel321
manuel321 28.11.2006 um 16:40:49 Uhr
Goto Top
ja danke das geht damit jetzt. Ich hab jetzt nen anderes Problem und zwar will ich ja übers Web auch Befehle absenden, das klappt auch soweit, aber wenn ich den Server neu starte dann schreibt er die nagios.cmd neu und nimmt die Rechte die ich ihm zuvor gegeben habe wieder weg. Kann man das irgendwie verhindern?
Mitglied: gnarff
gnarff 28.11.2006 um 22:10:05 Uhr
Goto Top
muesste ich jetzt orakeln....

ist in der cgi.cfg dein benutzername an die Zeile
authorized_for_system_commands angehaengt?

kannst du mir mal ansonsten die komplette fehlermeldung posten?

saludos
gnarff
Mitglied: manuel321
manuel321 29.11.2006 um 08:46:39 Uhr
Goto Top
also in der cgi.cfg stehts drin und es funktioniert auch solange ich nicht neustarte. Wenn ich das tue nimmt der die Rechte wieder weg.

Error: Could not open command file '/usr/local/nagios/var/rw/nagios.cmd' for update!


The permissions on the external command file and/or directory may be incorrect. Read the FAQs on how to setup proper permissions.


An error occurred while attempting to commit your command for processing.
Mitglied: gnarff
gnarff 01.12.2006 um 13:15:20 Uhr
Goto Top
1.External Command File
Format: command_file=<file_name>
Example: command_file=/usr/local/nagios/var/rw/nagios.cmd

This is the file that Nagios will check for external commands to process. The command CGI writes commands to this file. Other third party programs can write to this file if proper file permissions have been granted as outline in here. The external command file is implemented as a named pipe (FIFO), which is created when Nagios starts and removed when it shuts down. If the file exists when Nagios starts, the Nagios process will terminate with an error message.
-Da die nagios.cmd eine Pipe ist, wird die Datei beim Starten von Nagios angelegt.

2. Enabling External Commands

By default, Nagios does not check for or process any external commands. If you want to enable external command processing, you'll have to do the following...

          • Enable external command checking with the check_external_commands option [1]
          • Set the frequency of command checks with the command_check_interval option [2]
          • Specify the location of the command file with the command_file option ]siehe oben unter Punkt 1.]
Its best to put the external command file in its own directory (i.e. /usr/local/nagios/var/rw).
          • Setup proper permissions on the directory containing the external command file. Details on how to do this can be found [3]

          [1]
          External Command Check Option

          Format: check_external_commands=<0/1>
          Example: check_external_commands=1

          This option determines whether or not Nagios will check the command file for commands that should be executed. This option must be enabled if you plan on using the command CGI to issue commands via the web interface. Third party programs can also issue commands to Nagios by writing to the command file, provided proper rights to the file have been granted [...]

                • 0 = Don't check external commands (default)
                  • 1 = Check external commands

          [2]External Command Check Interval

          Format: command_check_interval=<xxx>[s]
          Example: command_check_interval=1

          If you specify a number with an "s" appended to it (i.e. 30s), this is the number of seconds to wait between external command checks. If you leave off the "s", this is the number of "time units" to wait between external command checks. Unless you've changed the interval_length value (as defined below) from the default value of 60, this number will mean minutes.

          Note: By setting this value to -1, Nagios will check for external commands as often as possible. Each time Nagios checks for external commands it will read and process all commands present in the command file before continuing on with its other duties.


          Als du nagios compiliert hast, hast du beim ./configure die Berechtigungen für diese Datei angegeben.

          Ohne Optionen darf der User nagios und die Gruppe nagios in die Pipe scheiben.
          Das heist das du Nagios beim compilieren gesagt hast mit welchen rechten die Datei angelegt werden soll.
          Du solltest auch ueberpruefen als "wer" du dich an einer Webseite anmeldest sondern unter welchem Benutzer der Dienst läuft, der dir diese Webseite anzeigt

          [3]
          Users and Groups

          First, find the user that your web server process is running as. On many systems this is the user nobody, although it will vary depending on what OS/distribution you are running. You'll also need to know what user Nagios is effectively running as - this is specified with the nagios_user variable in the main config file.

          Next we're going to create a new group whose members include the user the web server is running as and the user Nagios is running as. Let's say we call this new group 'nagiocmd' (you can name it differently if you wish). On RedHat Linux you can use the following command to add a new group (other systems may differ):

          /usr/sbin/groupadd nagiocmd

          Next, add the web server user (nobody or apache, etc) and the Nagios user (nagios) to the newly created group with the following commands:

          /usr/sbin/usermod -G nagiocmd nagios
          /usr/sbin/usermod -G nagiocmd nobody

          Setting directory permissions

          Next, change the ownership of the directory that will be used to hold the command file...

          chown nagios.nagiocmd /usr/local/nagios/var/rw

          Make sure the Nagios user has full permissions on the directory...

          chmod u+rwx /usr/local/nagios/var/rw

          Make sure the group we created has full permissions on the directory.

          chmod g+rwx /usr/local/nagios/var/rw

          In order to force newly created files in the directory to inherit the group permissions from the directory, we need to enable the group sticky bit on the directory...

          chmod g+s /usr/local/nagios/var/rw

          If you supplied the --with-command-grp=somegroup option when running the configure script, you can create the directory to hold the command file and set the proper permissions automatically by running 'make install-commandmode'.

          saludos
          gnarff
Mitglied: manuel321
manuel321 05.12.2006 um 14:36:23 Uhr
Goto Top
danke ich hab das Problem gelöst, ich musste noch den user wwwrun in der Gruppe nagiocmd aktivieren