-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Learning Nagios 4
By :
The Nagios query handler provides the @core service, which can be used to get and set information about the Nagios process.
For all commands handled by the @core service, the result is a text that ends with the \0 character—to read a response, all we need to do is continue reading until we receive \0, which indicates the end of the response.
It allows you to query information about the queue of scheduled jobs, such as the next active check or background operation to be performed. The command name is squeuestats and the full command to be sent is as follows:
@core squeuestats\0
The result is a string with multiple statistics information in the form of name=value, separated by semicolons—name1=value1;name2=value2;....
For example, to print all information, we can simply use the following code:
#!/usr/bin/env python
import socket, sys, os
nagios_qh = "/var/nagios/rw/nagios.qh"
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(nagios_qh)
s.sendall("@core...
Change the font size
Change margin width
Change background colour