Nagios configuration file generation
HTPASSWD/ETC/NAGIOS/PASSWD Nagiosadmin
Identity Asset Unique Number
chmod 444/etc/assetid
Interface to write robust interface to determine whether the value is comprehensive
Batch build IP, hostname, other items are consistent
Pip install ' ipython<2.0 '
Curr_dir=os.path.abspath (Os.path.dirname (__file__)) The directory where the file name is currently located, the absolute path
Host_conf_dir=os.path.join (Curr_dir, ' hosts ')
Cache_file=/var/tmp/api-cache.json
Host_tmp% h string formatting
Nagios-plugins Nagios Plugin
The CMDB API generates a configuration file that the shell synchronizes to the Nagios configuration file directory
/etc/yum.conf has keepcache=1 inside.
/var/cache/yum/x86_64/6/base/packages, there's a RPM package cached locally.
VCs version control system (git svn CVS)
Configuration of the generated host from the CMDB API call sent into the Svn/git sent to puppet inside, thrown into Nagios
How to write the Nagios plugin plugins
1.exit status
0.ok
1.warning
2.critical
3.unknown
[-f/e xxx]&& exit 0 | | Exit 1
/var/log/message rsyslog (software name) write Syslog is protocol
Log format time host name Process name Program name
Log time stamp
Delta = Datetime.timedelta (minutes=3)
now = Datetime.datetime.now ()
Now-delta
Nagios message can only be in one row
\w Word +
\d Digital
() All
[] to part
Performance optimization
1. The algorithm changed
2. Multiple invocations changed to one call
Uppercase Global Variables
This article is from the "Muzinan Technology blog" blog, make sure to keep this source http://muzinan110.blog.51cto.com/684213/1439043