[PYTHON] Try using pynag to configure Nagios

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

Try using pynag to configure Nagios
Try to get statistics using e-Stat
Try to detect fusion movement using AnyMotion
Try to operate Excel using Python (Xlwings)
Try to download Youtube videos using Pytube
Try using Tkinter
Try using docker-py
Try using cookiecutter
Try using PDFMiner
Try using geopandas
Try using Selenium
Try using scipy
Try using pandas.DataFrame
Try using django-swiftbrowser
Try using matplotlib
Try using tf.metrics
Try using PyODE
Try to create an HTTP server using Node.js
(Python) Try to develop a web application using Django
Try using virtualenv (virtualenvwrapper)
Try to make RESTful API with MVC using Flask 1.0.2
[Azure] Try using Azure Functions
Try to implement yolact
Try using virtualenv now
Try to delete tweets in bulk using Twitter API
Try using W & B
Try using Django templates.html
[Kaggle] Try using LGBM
Try using Python's feedparser.
Try using Python's Tkinter
Try to extract high frequency words using NLTK (python)
[Machine learning] Try to detect objects using Selective Search
Try using Tweepy [Python2.7]
Try to solve Sudoku at explosive speed using numpy
Try using Pytorch's collate_fn
Try to make it using GUI and PyQt in Python
Try to make PC setting change software using TKinter (beginner)
Try to operate an Excel file using Python (Pandas / XlsxWriter) ①
Try to determine food photos using Google Cloud Vision API
Try to model a multimodal distribution using the EM algorithm
Try to implement linear regression using Pytorch with Google Colaboratory
Try to factorial with recursion
[Python] Try using Tkinter's canvas
Try using Jupyter's Docker image
Try using scikit-learn (1) --K-means clustering
Try to analyze Twitter trends
Try function optimization using Hyperopt
Try using matplotlib with PyCharm
Try using Azure Logic Apps
Try to understand Python self
Try using Kubernetes Client -Python-
[Kaggle] Try using xg boost
Try using OpenCV on Windows
Try using Jupyter Notebook dynamically
Post to Twitter using Python
Start to Selenium using python
Try using AWS SageMaker Studio
Try tweeting automatically using Selenium.
Try using SQLAlchemy + MySQL (Part 1)
Try using the Twitter API
Try using SQLAlchemy + MySQL (Part 2)