Saltstack Source Installation Zabbix_agent Client

Source: Internet
Author: User
Tags saltstack

Saltstack Source Installation Zabbix_agent Client


Installation and environment brief, directly on the topic:

First, the tree-like chart.

[Email protected] salt]# pwd

/srv/salt

[Email protected] salt]# tree

. ├──init│└──init.sls├──top.sls└──zabbix├──conf.sls├──files│├──zabbix_agentd│├──zabbix_age NTD.CONF│└──ZABBIX.TAR.GZ├──INIT.SLS└──INSTALL.SLS3 directories, 8 files


Second, initialize the system first

Here is just to tell the client to install vim-enhanced, Lrzsz these 2 software, according to the actual situation of self-installing dependent software, pkg installation module currently supports APT and Yum.

[email protected] salt]# cat Init/init.sls

Pkgs:pkg.installed:-Names:-Vim-enhanced-lrzsz


Three, entry file Top.sls

The SLS (representing the salt state file) is the core of the salt State system. SLS describes the target state of the system, which is composed of simple data formats. This is often referred to as configuration management, where the Top.sls file is the portal file for configuration management, and everything starts here, on the master host, and is stored by default in the/srv/salt/directory. Top.sls.

There are 2 configuration items, one is the system initialization, and the other is the Zabbix client installation.

[email protected] salt]# cat Top.sls

Base: ' * '-init.init ' * ':-zabbix.init


Iv. the Init.sls of the Zabbinx catalogue

Sequential execution of Conf.sls under the Install.sls and Zabbix directories in the Zabbix directory

[email protected] salt]# cat Zabbix/init.sls

Include:-zabbix.install-zabbix.conf


Five, specific installation configuration

Install.sls Specific actions are:

1, the zabbix/files/zabbix.tar.gz file sent to the client/tmp directory, my zabbix.tar.gz here is compiled Zabbix client package files, the default decompression can be used;

2, extracted from/tmp/zabbix.tar.gz to the/usr/local directory;

3, add Zabbix user


[email protected] salt]# cat Zabbix/install.sls

Zabbix_source:file.managed:-Name:/tmp/zabbix.tar.gz-source:salt://zabbix/files/zabbix.tar.gz-user:root -Group:root-mode:644extract_zabbix:cmd.run:-CWD:/tmp-names:-Tar zxvf zabbix.tar.gz-c/US R/local-require:-file:zabbix_sourcezabbix_user:user.present:-Name:zabbix-createhome:false- Gid_from_name:true-shell:/sbin/nologin


Six, modify the configuration file boot

1, first put the configuration file to/usr/local/zabbix/etc/zabbix_agentd.conf, note that zabbix_agentd.conf has a configuration hostname={{hostname}}, This can be changed to a different IP than the client IP.

2, issued the automatic start Zabbix_agentd service script

3, add to boot boot list

4, Start Zabbix_agentd service


[email protected] salt]# cat Zabbix/conf.sls

Zabbix_conf:  file.managed:    - name: /usr/local/zabbix/etc/zabbix_ agentd.conf    - source: salt://zabbix/files/zabbix_agentd.conf     - template: jinja    - defaults:       hostname: {{ grains[' ip_interfaces ' [' eth1 '][0] }}zabbix_service:  file.managed :    - name: /etc/init.d/zabbix_agentd    - user:  root    - mode: 755    - source: salt://zabbix/ files/zabbix_agentd  cmd.run:    - names:       - /sbin/chkconfig --add zabbix_agentd      - /sbin/ chkconfig zabbix_agentd on  service.running:    - name:  zabbix_agentd    - enable: true    - watch:          - file: /usr/local/zabbix/etc/zabbix_agentd.conf


Seven, test verification

1,salt ' * ' state.highstate test=true This is a test of two SLS functions

2,salt-call State.highstate-l Debug This is the debug

3,salt ' * ' State.sls init.init respectively issued each SLS function

4, the concrete results are as follows:

[[email protected] salt]# Salt ' * ' State.sls zabbix.init

Saltmaster:

----------

Id:zabbix_source

Function:file.managed

Name:/tmp/zabbix.tar.gz

Result:true

Comment:file/tmp/zabbix.tar.gz is in the correct state

started:15:24:20.158243

duration:12.659 ms

Changes:

----------

Id:extract_zabbix

Function:cmd.run

Name:tar ZXVF zabbix.tar.gz-c/usr/local

Result:true

Comment:command "Tar zxvf zabbix.tar.gz-c/usr/local" Run

started:15:24:20.171608

duration:42.115 ms

Changes:

----------

Pid:

30427

Retcode

0

StdErr

StdOut

zabbix/

zabbix/bin/

Zabbix/bin/zabbix_sender

Zabbix/bin/zabbix_get

zabbix/lib/

zabbix/sbin/

Zabbix/sbin/zabbix_agent

Zabbix/sbin/zabbix_agentd

zabbix/etc/

zabbix/etc/zabbix_agent.conf.d/

Zabbix/etc/zabbix_agent.conf

zabbix/etc/zabbix_agentd.conf.d/

Zabbix/share/

zabbix/share/man/

zabbix/share/man/man1/

Zabbix/share/man/man1/zabbix_get.1

Zabbix/share/man/man1/zabbix_sender.1

zabbix/share/man/man8/

Zabbix/share/man/man8/zabbix_agentd.8

----------

Id:zabbix_user

Function:user.present

Name:zabbix

Result:true

Comment:user Zabbix is present and up to date

started:15:24:20.215402

duration:14.994 ms

Changes:

----------

Id:zabbix_conf

Function:file.managed

Name:/usr/local/zabbix/etc/zabbix_agentd.conf

Result:true

Comment:file/usr/local/zabbix/etc/zabbix_agentd.conf is in the correct state

started:15:24:20.230479

duration:13.879 ms

Changes:

----------

Id:zabbix_service

Function:file.managed

Name:/etc/init.d/zabbix_agentd

Result:true

Comment:file/etc/init.d/zabbix_agentd is in the correct state

started:15:24:20.244543

duration:3.243 ms

Changes:

----------

Id:zabbix_service

Function:cmd.run

Name:/sbin/chkconfig zabbix_agentd on

Result:true

Comment:command "/sbin/chkconfig zabbix_agentd on" run

started:15:24:20.247961

duration:17.828 ms

Changes:

----------

Pid:

30429

Retcode

0

StdErr

StdOut

----------

Id:zabbix_service

Function:cmd.run

Name:/sbin/chkconfig--add zabbix_agentd

Result:true

Comment:command "/sbin/chkconfig--add zabbix_agentd" Run

started:15:24:20.266112

duration:25.019 ms

Changes:

----------

Pid:

30430

Retcode

0

StdErr

StdOut

----------

Id:zabbix_service

Function:service.running

Name:zabbix_agentd

Result:true

Comment:service Zabbix_agentd is already enabled, and are in the desired state

started:15:24:20.296152

duration:113.405 ms

Changes:


Summary

------------

Succeeded:8 (changed=3)

failed:0

------------

Total states Run:8


This article is from the "jerrymin" blog, make sure to keep this source http://jerrymin.blog.51cto.com/3002256/1811170

Saltstack Source Installation Zabbix_agent Client

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.