The Control module includes classes to control the Nagios service and the Command submodule wraps Nagios commands.
Bases: object
Control the nagios daemon through python
>>> from pynag.Control import daemon
>>>
>>> d = daemon()
>>> d.restart()
Reloads Nagios.
Returns: | Return code of the reload command ran by pynag.Utils.runCommand() |
---|---|
Return type: | int |
Restarts Nagios via it’s init script.
Returns: | Return code of the restart command ran by pynag.Utils.runCommand() |
---|---|
Return type: | int |
Checks if the daemon is running
Returns: | Whether or not the daemon is running |
---|---|
Return type: | bool |
Start the Nagios service.
Returns: | Return code of the start command ran by pynag.Utils.runCommand() |
---|---|
Return type: | int |
Obtain the status of the Nagios service.
Returns: | Return code of the status command ran by pynag.Utils.runCommand() |
---|---|
Return type: | int |
Stop the Nagios service.
Returns: | Return code of the stop command ran by pynag.Utils.runCommand() |
---|---|
Return type: | int |
Run nagios -v config_file to verify that the conf is working
Returns: | True – if pynag.Utils.runCommand() returns 0, else None |
---|