Saltstack Source Installation Nrpe

Source: Internet
Author: User
Tags saltstack

Recently get addicted to Saltstack, and today got the Saltstack source installation Nrpe, install Nrpe before installing Nagios-plugins, the first is Top.sls file:

[email protected] salt]# cat Top.sls

Base

‘*‘:

-Nagios

[Email protected] salt]# tree Nagios #目录结构

Nagios

├──conf.sls

├──files

│?? ├──conf.sh

│?? ├──nagios-plugins-1.5.tar.gz

│?? ├──nrpe-2.12.tar.gz

│?? └──nrpe.cfg

├──init.sls

├──install.sls

└──top.sls

[email protected] nagios]# cat Init.sls #sls文件引用

Include

-Nagios.conf

-Nagios.install

[email protected] nagios]# cat Install.sls #安装nagios-plugins

Nagios_users: #创建用户

User.present:

-Name:nagios

-uid:5556

-Gid_from_name:true

-Createhome:false

-Shell:/sbin/nologin

Nagios_source:

File.managed:

-Name:/usr/local/src/nagios-plugins-1.5.tar.gz

-Source:salt://nagios/files/nagios-plugins-1.5.tar.gz

-User:root

-Group:root

-mode:644

-Unless:test-f/usr/local/src/nagios-plugins-1.5.tar.gz

Extract_nagios-plugins:

Cmd.run:

-CWD:/USR/LOCAL/SRC

-Name:tar XF nagios-plugins-1.5.tar.gz

-Require:

-File:nagios_source

Nagios_pkginstall:

Pkg.installed:

-pkgs:

-GCC

-Gcc-c++

-Autoconf

-Automake

-OpenSSL

-Openssl-devel

-Zlib

-Zlib-devel

-GLIBC

-Glibc-common

Nagios_commpile:

Cmd.run:

-name:cd/usr/local/src/nagios-plugins-1.5 &&/configure--enable-redhat-pthread-workaround && make && make Install

-Require:

-Cmd:extract_nagios-plugins

-Pkg:nagios_pkginstall

[email protected] nagios]# cat Conf.sls #nrpe安装配置

Include

-Nagios.install

Nrpe_source:

File.managed:

-Name:/usr/local/src/nrpe-2.12.tar.gz

-Source:salt://nagios/files/nrpe-2.12.tar.gz

-User:root

-Group:root

-mode:755

-Unless:test-f/usr/local/src/nrpe-2.12.tar.gz

Cmd.run:

-Name:cd/usr/local/src && Tar XF nrpe-2.12.tar.gz && cd nrpe-2.12 &&./configure--enable-comma Nd-args && make all && make Install-plugin && make Install-daemon && make Install-daemon-c Onfig

-Require:

-File:nrpe_source

/usr/local/nagios/etc/nrpe.cfg:

File.managed:

-Name:/usr/local/nagios/etc/nrpe.cfg

-Source:salt://nagios/files/nrpe.cfg

-User:nagios

-Group:nagios

-mode:644

Salt://nagios/files/conf.sh:

Cmd.script:

-ENV:

-BATCH: ' Yes '

-Require:

-Cmd:nrpe_source

-Pkg:nagios_pkginstall

[email protected] files]# cat conf.sh #执行nrpe启动脚本

#!/bin/bash

#

/bin/chown-r Nagios.nagios/usr/local/nagios &&/usr/local/nagios/bin/nrpe-c/usr/local/nagios/etc/nrpe.cfg -D

Finally, the master side executes:

Salt ' Minions ' state.highstate can

It is worth noting that: This is the source code installation Nrpe,nagios/libexec may not have our custom use of scripts and other binaries, if the source has been configured Nrpe, packaged into RPM package, it may be more convenient to manage; Unfortunately, we don't make RPM packages!



This article from "LawLer" blog, declined reprint!

Saltstack Source Installation Nrpe

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.