Overview I was looking for something I couldn't do from the command line because it's a hassle to manipulate and view Nagios settings from the web, but I found something called pynag. Obviously python by name. I haven't touched python so far, but it's a good idea to take this opportunity to remember it, and since the command line alone seems to work well in the first place, I'll try using it.
How to install Even Cent5 was included in epel, so after putting in epel repo it's done with yum install
# yum install epel-release # yum install pynag
How to use Let's use it on the command line for the time being. Looking at the contents of the command, it seems to go looking for / etc / nagios by default. If you include it in nagios.cfg, it will search the include file as well. Even if you install it in / usr / local / nagios etc., you should just paste it in / etc / nagios with a symlink.
774 examples['config'] = ''' 775 # %prog config --set process_perfdata=1 776 # %prog config --append cfg_dir=/etc/nagios/conf.d 777 # %prog config --remove cfg_dir --old_value=/etc/nagios/conf.d 778 # %prog config --get object_cache_file
list If you hit it as follows, the item will be pulled from the place such as define host. See here to see what items you can get.
$ pynag list host_name address where object_type=host
How to use in python programs
Tips
Recommended Posts