├── README.rst ├── pillar ├── salt │ └── minion.sls ├── top.sls └── zabbix │ ├── agent.sls │ └── api.sls ├── salt ├── _grains │ └── roles.py ├── apache │ └── init.sls ├── base │ ├── epel.sls │ ├── files │ │ └── epel-release-6-8.noarch.rpm │ ├── hosts.sls │ └── init.sls ├── memcached │ ├── files │ │ └── etc │ │ │ └── zabbix │ │ │ ├── ExternalScripts │ │ │ └── zabbix_memcached_check.sh │ │ │ └── zabbix_agentd.conf.d │ │ │ └── memcached.conf │ ├── init.sls │ ├── install.sls │ └── monitor.sls ├── mysql │ ├── files │ │ └── etc │ │ │ └── salt │ │ │ └── minion.d │ │ │ └── mysql.conf │ └── server.sls ├── php │ ├── files │ │ └── etc │ │ │ └── php.ini │ └── init.sls ├── salt │ ├── files │ │ └── etc │ │ │ └── salt │ │ │ └── minion │ ├── master.sls │ └── minion.sls ├── top.sls └── zabbix │ ├── agent.sls │ ├── api.sls │ ├── files │ ├── etc │ │ ├── zabbix │ │ │ ├── api │ │ │ │ ├── add_monitors.py │ │ │ │ ├── config.yaml │ │ │ │ ├── monitors │ │ │ │ │ └── minion │ │ │ │ └── templates │ │ │ │ │ └── Template_memacached.xml │ │ │ └── web │ │ │ │ └── zabbix.conf.php │ │ ├── zabbix_agentd.conf │ │ └── zabbix_server.conf │ └── usr │ │ └── lib │ │ └── python2.6 │ │ └── site-packages │ │ └── zabbix │ │ ├── __init__.py │ │ └── zapi.py │ ├── server.sls │ └── web.sls └── 记saltstack和zabbix的一次联姻--绿肥.pdf /README.rst: -------------------------------------------------------------------------------- 1 | SaltStack结合Zabbix完成服务自动部署及监控 2 | ################################################# 3 | 4 | 5 | 环境说明 6 | ******************************** 7 | 8 | 基于`SaltStack`_ ,结合`Zabbix`_ 完成服务自动化部署及监控 9 | 10 | 本次测试的服务为`Memcached`_ 服务,监控模板采用`zbl/zabbix模板 `_ , Zabbix API采用`zapi `_ 11 | 12 | **测试环境**: 13 | 14 | ===== ============= =============== =================== ========================================= ================ 15 | 序号 主机名 IP OS版本 角色 salt版本 16 | ===== ============= =============== =================== ========================================= ================ 17 | 1 salt-test-01 172.16.0.111 CentOS 6.4 X86_64 salt master/minion & zabbix server& web 0.15.1 18 | 2 salt-test-02 172.16.0.112 CentOS 6.4 X86_64 salt minion & zabbix api操作机 0.15.1 19 | 3 salt-test-03 172.16.0.113 CentOS 6.4 X86_64 salt minion & zabbix agent & memcached 0.15.1 20 | ===== ============= =============== =================== ========================================= ================ 21 | 22 | **salt**: salt state 23 | 24 | **pillar**: salt pillar 25 | 26 | salt-test-01主机之前安装有 `MySQL-python `_ 软件包, 以保证mysql的相关state模块可以使用 27 | 28 | 执行过程 29 | ********************************* 30 | 31 | # salt '*' saltutil.sync_all 32 | 33 | # salt '*' state.highstate 34 | 35 | # salt 'salt-test-02' state.highstate 36 | 37 | 38 | 当前问题 39 | ********************************* 40 | 1. 当前采用的Zabbix API为1.8 API,不支持2.0中的模板自动导入功能,因此在部署完zabbix server后,安装memcached服务前,需要登录zabbix web导入监控模板 41 | 2. 由于采用salt mine进行角色传递,传递给zabbix api操作机,因此需要执行两次state.highstate,第一次会将角色信息以mine方式传递给salt master,第二次会将角色信息传递给zabbix api操作机 42 | 43 | 44 | 45 | 46 | 47 | .. _Salt: http://saltstack.org/ 48 | 49 | .. _SaltStack: http://saltstack.org/ 50 | 51 | .. _Zabbix: http://www.zabbix.com/ 52 | 53 | .. _Memcached: http://memcached.org/ 54 | -------------------------------------------------------------------------------- /pillar/salt/minion.sls: -------------------------------------------------------------------------------- 1 | mine_functions: 2 | test.ping: [] 3 | grains.item: [id, roles, ipv4] 4 | -------------------------------------------------------------------------------- /pillar/top.sls: -------------------------------------------------------------------------------- 1 | base: 2 | '*': 3 | - salt.minion 4 | - zabbix.agent 5 | 'salt-test-02': 6 | - zabbix.api 7 | -------------------------------------------------------------------------------- /pillar/zabbix/agent.sls: -------------------------------------------------------------------------------- 1 | zabbix-agent: 2 | Zabbix_Server: salt-test-01 3 | -------------------------------------------------------------------------------- /pillar/zabbix/api.sls: -------------------------------------------------------------------------------- 1 | zabbix-api: 2 | Zabbix_URL: http://salt-test-01/zabbix 3 | Zabbix_User: admin 4 | Zabbix_Pass: zabbix 5 | Hostgroup: Salt-Discovery 6 | Monitors_DIR: /etc/zabbix/api/monitors/ 7 | Templates_DIR: /etc/zabbix/api/templates/ 8 | 9 | zabbix-templates: 10 | memcached: Template_Memcached 11 | -------------------------------------------------------------------------------- /salt/_grains/roles.py: -------------------------------------------------------------------------------- 1 | import os.path 2 | 3 | def roles(): 4 | '''define host roles''' 5 | 6 | roles_file = "/etc/salt/roles" 7 | roles_list = [] 8 | 9 | if os.path.isfile(roles_file): 10 | roles_fd = open(roles_file, "r") 11 | for eachroles in roles_fd: 12 | roles_list.append(eachroles[:-1]) 13 | return {'roles': roles_list} 14 | 15 | 16 | if __name__ == "__main__": 17 | print roles() 18 | -------------------------------------------------------------------------------- /salt/apache/init.sls: -------------------------------------------------------------------------------- 1 | apache: 2 | pkg.installed: 3 | - name: httpd 4 | file.managed: 5 | - name: /etc/httpd/conf/httpd.conf 6 | - require: 7 | - pkg: apache 8 | service.running: 9 | - name: httpd 10 | - enable: True 11 | - watch: 12 | - pkg: apache 13 | - file: apache 14 | 15 | httpd-conf.d: 16 | file.directory: 17 | - name: /etc/httpd/conf.d/ 18 | - watch_in: 19 | - service: apache 20 | -------------------------------------------------------------------------------- /salt/base/epel.sls: -------------------------------------------------------------------------------- 1 | epel-repo: 2 | pkg.installed: 3 | - sources: 4 | - epel-release: salt://base/files/epel-release-6-8.noarch.rpm 5 | - order: 1 6 | 7 | -------------------------------------------------------------------------------- /salt/base/files/epel-release-6-8.noarch.rpm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyao/salt-zabbix/cb4cf2f3fb0c146b510b687b3b5a2d4a3bdfb4f8/salt/base/files/epel-release-6-8.noarch.rpm -------------------------------------------------------------------------------- /salt/base/hosts.sls: -------------------------------------------------------------------------------- 1 | host-salt-test-01: 2 | host.present: 3 | - ip: 172.16.0.111 4 | - order: 1 5 | - names: 6 | - salt-test-01 7 | 8 | host-salt-test-02: 9 | host.present: 10 | - ip: 172.16.0.112 11 | - order: 1 12 | - names: 13 | - salt-test-02 14 | 15 | host-salt-test-03: 16 | host.present: 17 | - ip: 172.16.0.113 18 | - order: 1 19 | - names: 20 | - salt-test-03 21 | 22 | -------------------------------------------------------------------------------- /salt/base/init.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - base.hosts 3 | - base.epel 4 | -------------------------------------------------------------------------------- /salt/memcached/files/etc/zabbix/ExternalScripts/zabbix_memcached_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ################################## 3 | # Zabbix monitoring script 4 | # 5 | # memcached: 6 | # - anything available via memcached-tool stats 7 | # 8 | # Allowed parameters combinaisons: 9 | # - param 10 | # - param + listening IP 11 | # - param + listening IP + port 12 | ################################## 13 | # Contact: 14 | # vincent.viallet@gmail.com 15 | ################################## 16 | # ChangeLog: 17 | # 20100922 VV initial creation 18 | ################################## 19 | 20 | # Zabbix requested parameter 21 | ZBX_REQ_DATA="$1" 22 | ZBX_REQ_DATA_HOST="$2" 23 | ZBX_REQ_DATA_PORT="$3" 24 | 25 | # Memcached defaults 26 | MEMCACHED_DEFAULT_HOST="127.0.0.1" 27 | MEMCACHED_DEFAULT_PORT="11211" 28 | MEMCACHED_TOOL_BIN="/usr/bin/memcached-tool" 29 | 30 | # 31 | # Error handling: 32 | # - need to be displayable in Zabbix (avoid NOT_SUPPORTED) 33 | # - items need to be of type "float" (allow negative + float) 34 | # 35 | ERROR_NO_ACCESS_FILE="-0.9900" 36 | ERROR_NO_ACCESS="-0.9901" 37 | ERROR_WRONG_PARAM="-0.9902" 38 | ERROR_DATA="-0.9903" # either can not connect / bad host / bad port 39 | 40 | # Handle host and port if non-default 41 | # Allowed parameters combinaisons: 42 | # - param 43 | # - param + listening IP 44 | # - param + listening IP + port 45 | if [ ! -z "$ZBX_REQ_DATA_HOST" ]; then 46 | HOST="$ZBX_REQ_DATA_HOST" 47 | if [ ! -z "$ZBX_REQ_DATA_PORT" ]; then 48 | PORT="$ZBX_REQ_DATA_PORT" 49 | else 50 | PORT="$MEMCACHED_DEFAULT_PORT" 51 | fi 52 | else 53 | HOST="$MEMCACHED_DEFAULT_HOST" 54 | PORT="$MEMCACHED_DEFAULT_PORT" 55 | fi 56 | 57 | # save the memcached stats in a variable for future parsing 58 | MEMCACHED_STATS=$($MEMCACHED_TOOL_BIN $HOST:$PORT stats 2> /dev/null ) 59 | 60 | # error during retrieve 61 | if [ $? -ne 0 ]; then 62 | echo $ERROR_DATA 63 | exit 1 64 | fi 65 | 66 | # 67 | # Extract data from memcached stats 68 | # 69 | MEMCACHED_VALUE=$(echo "$MEMCACHED_STATS" | grep -E "^ .* $ZBX_REQ_DATA " | awk '{print $2}') 70 | 71 | if [ ! -z "$MEMCACHED_VALUE" ]; then 72 | echo $MEMCACHED_VALUE 73 | else 74 | echo $ERROR_WRONG_PARAM 75 | exit 1 76 | fi 77 | 78 | exit 0 79 | -------------------------------------------------------------------------------- /salt/memcached/files/etc/zabbix/zabbix_agentd.conf.d/memcached.conf: -------------------------------------------------------------------------------- 1 | ##Memcached status monitor 2 | UserParameter=memcached[*], /etc/zabbix/ExternalScripts/zabbix_memcached_check.sh $1 $2 $3 3 | -------------------------------------------------------------------------------- /salt/memcached/init.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - memcached.install 3 | - memcached.monitor 4 | -------------------------------------------------------------------------------- /salt/memcached/install.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - zabbix.agent 3 | - salt.minion 4 | 5 | memcached: 6 | pkg.installed: 7 | - name: memcached 8 | service.running: 9 | - name: memcached 10 | - enable: True 11 | - watch: 12 | - pkg: memcached 13 | 14 | memcached-role: 15 | file.append: 16 | - name: /etc/salt/roles 17 | - text: 18 | - 'memcached' 19 | - require: 20 | - file: roles 21 | - service: memcached 22 | - service: salt-minion 23 | - watch_in: 24 | - module: sync_grains 25 | -------------------------------------------------------------------------------- /salt/memcached/monitor.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - zabbix.agent 3 | - memcached.install 4 | 5 | memcached-monitor-script: 6 | file.managed: 7 | - name: /etc/zabbix/ExternalScripts/zabbix_memcached_check.sh 8 | - source: salt://memcached/files/etc/zabbix/ExternalScripts/zabbix_memcached_check.sh 9 | - user: root 10 | - group: root 11 | - mode: 755 12 | - require: 13 | - service: memcached 14 | 15 | memcached-monitor-config: 16 | file.managed: 17 | - name: /etc/zabbix/zabbix_agentd.conf.d/memcached.conf 18 | - source: salt://memcached/files/etc/zabbix/zabbix_agentd.conf.d/memcached.conf 19 | - require: 20 | - file: memcached-monitor-script 21 | - watch_in: 22 | - service: zabbix-agent 23 | -------------------------------------------------------------------------------- /salt/mysql/files/etc/salt/minion.d/mysql.conf: -------------------------------------------------------------------------------- 1 | mysql.host: 'localhost' 2 | mysql.port: 3306 3 | mysql.user: 'root' 4 | mysql.pass: '' 5 | mysql.unix_socket: '/var/lib/mysql/mysql.sock' 6 | -------------------------------------------------------------------------------- /salt/mysql/server.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - salt.minion 3 | 4 | mysql-server: 5 | pkg: 6 | - installed 7 | file.managed: 8 | - name: /etc/my.cnf 9 | - require: 10 | - pkg: mysql-server 11 | service.running: 12 | - name: mysqld 13 | - enable: True 14 | - require: 15 | - pkg: mysql-server 16 | - watch: 17 | - file: mysql-server 18 | 19 | mysql-server-config-minion: 20 | file.managed: 21 | - name: /etc/salt/minion.d/mysql.conf 22 | - source: salt://mysql/files/etc/salt/minion.d/mysql.conf 23 | - makedirs: True 24 | - require: 25 | - service: salt-minion 26 | 27 | -------------------------------------------------------------------------------- /salt/php/files/etc/php.ini: -------------------------------------------------------------------------------- 1 | [PHP] 2 | 3 | ;;;;;;;;;;;;;;;;;;; 4 | ; About php.ini ; 5 | ;;;;;;;;;;;;;;;;;;; 6 | ; PHP's initialization file, generally called php.ini, is responsible for 7 | ; configuring many of the aspects of PHP's behavior. 8 | 9 | ; PHP attempts to find and load this configuration from a number of locations. 10 | ; The following is a summary of its search order: 11 | ; 1. SAPI module specific location. 12 | ; 2. The PHPRC environment variable. (As of PHP 5.2.0) 13 | ; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) 14 | ; 4. Current working directory (except CLI) 15 | ; 5. The web server's directory (for SAPI modules), or directory of PHP 16 | ; (otherwise in Windows) 17 | ; 6. The directory from the --with-config-file-path compile time option, or the 18 | ; Windows directory (C:\windows or C:\winnt) 19 | ; See the PHP docs for more specific information. 20 | ; http://www.php.net/manual/en/configuration.file.php 21 | 22 | ; The syntax of the file is extremely simple. Whitespace and Lines 23 | ; beginning with a semicolon are silently ignored (as you probably guessed). 24 | ; Section headers (e.g. [Foo]) are also silently ignored, even though 25 | ; they might mean something in the future. 26 | 27 | ; Directives following the section heading [PATH=/www/mysite] only 28 | ; apply to PHP files in the /www/mysite directory. Directives 29 | ; following the section heading [HOST=www.example.com] only apply to 30 | ; PHP files served from www.example.com. Directives set in these 31 | ; special sections cannot be overridden by user-defined INI files or 32 | ; at runtime. Currently, [PATH=] and [HOST=] sections only work under 33 | ; CGI/FastCGI. 34 | ; http://www.php.net/manual/en/ini.sections.php 35 | 36 | ; Directives are specified using the following syntax: 37 | ; directive = value 38 | ; Directive names are *case sensitive* - foo=bar is different from FOO=bar. 39 | ; Directives are variables used to configure PHP or PHP extensions. 40 | ; There is no name validation. If PHP can't find an expected 41 | ; directive because it is not set or is mistyped, a default value will be used. 42 | 43 | ; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one 44 | ; of the INI constants (On, Off, True, False, Yes, No and None) or an expression 45 | ; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a 46 | ; previously set variable or directive (e.g. ${foo}) 47 | 48 | ; Expressions in the INI file are limited to bitwise operators and parentheses: 49 | ; | bitwise OR 50 | ; ^ bitwise XOR 51 | ; & bitwise AND 52 | ; ~ bitwise NOT 53 | ; ! boolean NOT 54 | 55 | ; Boolean flags can be turned on using the values 1, On, True or Yes. 56 | ; They can be turned off using the values 0, Off, False or No. 57 | 58 | ; An empty string can be denoted by simply not writing anything after the equal 59 | ; sign, or by using the None keyword: 60 | 61 | ; foo = ; sets foo to an empty string 62 | ; foo = None ; sets foo to an empty string 63 | ; foo = "None" ; sets foo to the string 'None' 64 | 65 | ; If you use constants in your value, and these constants belong to a 66 | ; dynamically loaded extension (either a PHP extension or a Zend extension), 67 | ; you may only use these constants *after* the line that loads the extension. 68 | 69 | ;;;;;;;;;;;;;;;;;;; 70 | ; About this file ; 71 | ;;;;;;;;;;;;;;;;;;; 72 | ; PHP comes packaged with two INI files. One that is recommended to be used 73 | ; in production environments and one that is recommended to be used in 74 | ; development environments. 75 | 76 | ; php.ini-production contains settings which hold security, performance and 77 | ; best practices at its core. But please be aware, these settings may break 78 | ; compatibility with older or less security conscience applications. We 79 | ; recommending using the production ini in production and testing environments. 80 | 81 | ; php.ini-development is very similar to its production variant, except it's 82 | ; much more verbose when it comes to errors. We recommending using the 83 | ; development version only in development environments as errors shown to 84 | ; application users can inadvertently leak otherwise secure information. 85 | 86 | ; This 2 files are provided, by RPM, in /usr/share/doc/php-common-*/ 87 | ; File used by RPM (the /etc/php.ini) is mainly the php.ini-production 88 | 89 | ;;;;;;;;;;;;;;;;;;; 90 | ; Quick Reference ; 91 | ;;;;;;;;;;;;;;;;;;; 92 | ; The following are all the settings which are different in either the production 93 | ; or development versions of the INIs with respect to PHP's default behavior. 94 | ; Please see the actual settings later in the document for more details as to why 95 | ; we recommend these changes in PHP's behavior. 96 | 97 | ; allow_call_time_pass_reference 98 | ; Default Value: On 99 | ; Development Value: Off 100 | ; Production Value: Off 101 | 102 | ; display_errors 103 | ; Default Value: On 104 | ; Development Value: On 105 | ; Production Value: Off 106 | 107 | ; display_startup_errors 108 | ; Default Value: Off 109 | ; Development Value: On 110 | ; Production Value: Off 111 | 112 | ; error_reporting 113 | ; Default Value: E_ALL & ~E_NOTICE 114 | ; Development Value: E_ALL | E_STRICT 115 | ; Production Value: E_ALL & ~E_DEPRECATED 116 | 117 | ; html_errors 118 | ; Default Value: On 119 | ; Development Value: On 120 | ; Production value: Off 121 | 122 | ; log_errors 123 | ; Default Value: Off 124 | ; Development Value: On 125 | ; Production Value: On 126 | 127 | ; magic_quotes_gpc 128 | ; Default Value: On 129 | ; Development Value: Off 130 | ; Production Value: Off 131 | 132 | ; max_input_time 133 | ; Default Value: -1 (Unlimited) 134 | ; Development Value: 60 (60 seconds) 135 | ; Production Value: 60 (60 seconds) 136 | 137 | ; output_buffering 138 | ; Default Value: Off 139 | ; Development Value: 4096 140 | ; Production Value: 4096 141 | 142 | ; register_argc_argv 143 | ; Default Value: On 144 | ; Development Value: Off 145 | ; Production Value: Off 146 | 147 | ; register_long_arrays 148 | ; Default Value: On 149 | ; Development Value: Off 150 | ; Production Value: Off 151 | 152 | ; request_order 153 | ; Default Value: None 154 | ; Development Value: "GP" 155 | ; Production Value: "GP" 156 | 157 | ; session.bug_compat_42 158 | ; Default Value: On 159 | ; Development Value: On 160 | ; Production Value: Off 161 | 162 | ; session.bug_compat_warn 163 | ; Default Value: On 164 | ; Development Value: On 165 | ; Production Value: Off 166 | 167 | ; session.gc_divisor 168 | ; Default Value: 100 169 | ; Development Value: 1000 170 | ; Production Value: 1000 171 | 172 | ; session.hash_bits_per_character 173 | ; Default Value: 4 174 | ; Development Value: 5 175 | ; Production Value: 5 176 | 177 | ; short_open_tag 178 | ; Default Value: On 179 | ; Development Value: Off 180 | ; Production Value: Off 181 | 182 | ; track_errors 183 | ; Default Value: Off 184 | ; Development Value: On 185 | ; Production Value: Off 186 | 187 | ; url_rewriter.tags 188 | ; Default Value: "a=href,area=href,frame=src,form=,fieldset=" 189 | ; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" 190 | ; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry" 191 | 192 | ; variables_order 193 | ; Default Value: "EGPCS" 194 | ; Development Value: "GPCS" 195 | ; Production Value: "GPCS" 196 | 197 | ;;;;;;;;;;;;;;;;;;;; 198 | ; php.ini Options ; 199 | ;;;;;;;;;;;;;;;;;;;; 200 | ; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" 201 | ;user_ini.filename = ".user.ini" 202 | 203 | ; To disable this feature set this option to empty value 204 | ;user_ini.filename = 205 | 206 | ; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) 207 | ;user_ini.cache_ttl = 300 208 | 209 | ;;;;;;;;;;;;;;;;;;;; 210 | ; Language Options ; 211 | ;;;;;;;;;;;;;;;;;;;; 212 | 213 | ; Enable the PHP scripting language engine under Apache. 214 | ; http://www.php.net/manual/en/apache.configuration.php#ini.engine 215 | engine = On 216 | 217 | ; This directive determines whether or not PHP will recognize code between 218 | ; tags as PHP source which should be processed as such. It's been 219 | ; recommended for several years that you not use the short tag "short cut" and 220 | ; instead to use the full tag combination. With the wide spread use 221 | ; of XML and use of these tags by other languages, the server can become easily 222 | ; confused and end up parsing the wrong code in the wrong context. But because 223 | ; this short cut has been a feature for such a long time, it's currently still 224 | ; supported for backwards compatibility, but we recommend you don't use them. 225 | ; Default Value: On 226 | ; Development Value: Off 227 | ; Production Value: Off 228 | ; http://www.php.net/manual/en/ini.core.php#ini.short-open-tag 229 | short_open_tag = Off 230 | 231 | ; Allow ASP-style <% %> tags. 232 | ; http://www.php.net/manual/en/ini.core.php#ini.asp-tags 233 | asp_tags = Off 234 | 235 | ; The number of significant digits displayed in floating point numbers. 236 | ; http://www.php.net/manual/en/ini.core.php#ini.precision 237 | precision = 14 238 | 239 | ; Enforce year 2000 compliance (will cause problems with non-compliant browsers) 240 | ; http://www.php.net/manual/en/ini.core.php#ini.y2k-compliance 241 | y2k_compliance = On 242 | 243 | ; Output buffering is a mechanism for controlling how much output data 244 | ; (excluding headers and cookies) PHP should keep internally before pushing that 245 | ; data to the client. If your application's output exceeds this setting, PHP 246 | ; will send that data in chunks of roughly the size you specify. 247 | ; Turning on this setting and managing its maximum buffer size can yield some 248 | ; interesting side-effects depending on your application and web server. 249 | ; You may be able to send headers and cookies after you've already sent output 250 | ; through print or echo. You also may see performance benefits if your server is 251 | ; emitting less packets due to buffered output versus PHP streaming the output 252 | ; as it gets it. On production servers, 4096 bytes is a good setting for performance 253 | ; reasons. 254 | ; Note: Output buffering can also be controlled via Output Buffering Control 255 | ; functions. 256 | ; Possible Values: 257 | ; On = Enabled and buffer is unlimited. (Use with caution) 258 | ; Off = Disabled 259 | ; Integer = Enables the buffer and sets its maximum size in bytes. 260 | ; Default Value: Off 261 | ; Development Value: 4096 262 | ; Production Value: 4096 263 | ; http://www.php.net/manual/en/outcontrol.configuration.php#ini.output-buffering 264 | output_buffering = 4096 265 | 266 | ; You can redirect all of the output of your scripts to a function. For 267 | ; example, if you set output_handler to "mb_output_handler", character 268 | ; encoding will be transparently converted to the specified encoding. 269 | ; Setting any output handler automatically turns on output buffering. 270 | ; Note: People who wrote portable scripts should not depend on this ini 271 | ; directive. Instead, explicitly set the output handler using ob_start(). 272 | ; Using this ini directive may cause problems unless you know what script 273 | ; is doing. 274 | ; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler" 275 | ; and you cannot use both "ob_gzhandler" and "zlib.output_compression". 276 | ; Note: output_handler must be empty if this is set 'On' !!!! 277 | ; Instead you must use zlib.output_handler. 278 | ; http://www.php.net/manual/en/outcontrol.configuration.php#ini.output-handler 279 | ;output_handler = 280 | 281 | ; Transparent output compression using the zlib library 282 | ; Valid values for this option are 'off', 'on', or a specific buffer size 283 | ; to be used for compression (default is 4KB) 284 | ; Note: Resulting chunk size may vary due to nature of compression. PHP 285 | ; outputs chunks that are few hundreds bytes each as a result of 286 | ; compression. If you prefer a larger chunk size for better 287 | ; performance, enable output_buffering in addition. 288 | ; Note: You need to use zlib.output_handler instead of the standard 289 | ; output_handler, or otherwise the output will be corrupted. 290 | ; http://www.php.net/manual/en/zlib.configuration.php#ini.zlib.output-compression 291 | zlib.output_compression = Off 292 | 293 | ; http://www.php.net/manual/en/zlib.configuration.php#ini.zlib.output-compression-level 294 | ;zlib.output_compression_level = -1 295 | 296 | ; You cannot specify additional output handlers if zlib.output_compression 297 | ; is activated here. This setting does the same as output_handler but in 298 | ; a different order. 299 | ; http://www.php.net/manual/en/zlib.configuration.php#ini.zlib.output-handler 300 | ;zlib.output_handler = 301 | 302 | ; Implicit flush tells PHP to tell the output layer to flush itself 303 | ; automatically after every output block. This is equivalent to calling the 304 | ; PHP function flush() after each and every call to print() or echo() and each 305 | ; and every HTML block. Turning this option on has serious performance 306 | ; implications and is generally recommended for debugging purposes only. 307 | ; http://www.php.net/manual/en/outcontrol.configuration.php#ini.implicit-flush 308 | implicit_flush = Off 309 | 310 | ; The unserialize callback function will be called (with the undefined class' 311 | ; name as parameter), if the unserializer finds an undefined class 312 | ; which should be instantiated. A warning appears if the specified function is 313 | ; not defined, or if the function doesn't include/implement the missing class. 314 | ; So only set this entry, if you really want to implement such a 315 | ; callback-function. 316 | unserialize_callback_func = 317 | 318 | ; When floats & doubles are serialized store serialize_precision significant 319 | ; digits after the floating point. The default value ensures that when floats 320 | ; are decoded with unserialize, the data will remain the same. 321 | serialize_precision = 100 322 | 323 | ; This directive allows you to enable and disable warnings which PHP will issue 324 | ; if you pass a value by reference at function call time. Passing values by 325 | ; reference at function call time is a deprecated feature which will be removed 326 | ; from PHP at some point in the near future. The acceptable method for passing a 327 | ; value by reference to a function is by declaring the reference in the functions 328 | ; definition, not at call time. This directive does not disable this feature, it 329 | ; only determines whether PHP will warn you about it or not. These warnings 330 | ; should enabled in development environments only. 331 | ; Default Value: On (Suppress warnings) 332 | ; Development Value: Off (Issue warnings) 333 | ; Production Value: Off (Issue warnings) 334 | ; http://www.php.net/manual/en/ini.core.php#ini.allow-call-time-pass-reference 335 | allow_call_time_pass_reference = Off 336 | 337 | ; Safe Mode 338 | ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode 339 | safe_mode = Off 340 | 341 | ; By default, Safe Mode does a UID compare check when 342 | ; opening files. If you want to relax this to a GID compare, 343 | ; then turn on safe_mode_gid. 344 | ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-gid 345 | safe_mode_gid = Off 346 | 347 | ; When safe_mode is on, UID/GID checks are bypassed when 348 | ; including files from this directory and its subdirectories. 349 | ; (directory must also be in include_path or full path must 350 | ; be used when including) 351 | ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-include-dir 352 | safe_mode_include_dir = 353 | 354 | ; When safe_mode is on, only executables located in the safe_mode_exec_dir 355 | ; will be allowed to be executed via the exec family of functions. 356 | ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-exec-dir 357 | safe_mode_exec_dir = 358 | 359 | ; Setting certain environment variables may be a potential security breach. 360 | ; This directive contains a comma-delimited list of prefixes. In Safe Mode, 361 | ; the user may only alter environment variables whose names begin with the 362 | ; prefixes supplied here. By default, users will only be able to set 363 | ; environment variables that begin with PHP_ (e.g. PHP_FOO=BAR). 364 | ; Note: If this directive is empty, PHP will let the user modify ANY 365 | ; environment variable! 366 | ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-allowed-env-vars 367 | safe_mode_allowed_env_vars = PHP_ 368 | 369 | ; This directive contains a comma-delimited list of environment variables that 370 | ; the end user won't be able to change using putenv(). These variables will be 371 | ; protected even if safe_mode_allowed_env_vars is set to allow to change them. 372 | ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode-protected-env-vars 373 | safe_mode_protected_env_vars = LD_LIBRARY_PATH 374 | 375 | ; open_basedir, if set, limits all file operations to the defined directory 376 | ; and below. This directive makes most sense if used in a per-directory 377 | ; or per-virtualhost web server configuration file. This directive is 378 | ; *NOT* affected by whether Safe Mode is turned On or Off. 379 | ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.open-basedir 380 | ;open_basedir = 381 | 382 | ; This directive allows you to disable certain functions for security reasons. 383 | ; It receives a comma-delimited list of function names. This directive is 384 | ; *NOT* affected by whether Safe Mode is turned On or Off. 385 | ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.disable-functions 386 | disable_functions = 387 | 388 | ; This directive allows you to disable certain classes for security reasons. 389 | ; It receives a comma-delimited list of class names. This directive is 390 | ; *NOT* affected by whether Safe Mode is turned On or Off. 391 | ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.disable-classes 392 | disable_classes = 393 | 394 | ; Colors for Syntax Highlighting mode. Anything that's acceptable in 395 | ; would work. 396 | ; http://www.php.net/manual/en/misc.configuration.php#ini.syntax-highlighting 397 | ;highlight.string = #DD0000 398 | ;highlight.comment = #FF9900 399 | ;highlight.keyword = #007700 400 | ;highlight.bg = #FFFFFF 401 | ;highlight.default = #0000BB 402 | ;highlight.html = #000000 403 | 404 | ; If enabled, the request will be allowed to complete even if the user aborts 405 | ; the request. Consider enabling it if executing long requests, which may end up 406 | ; being interrupted by the user or a browser timing out. PHP's default behavior 407 | ; is to disable this feature. 408 | ; http://www.php.net/manual/en/misc.configuration.php#ini.ignore-user-abort 409 | ;ignore_user_abort = On 410 | 411 | ; Determines the size of the realpath cache to be used by PHP. This value should 412 | ; be increased on systems where PHP opens many files to reflect the quantity of 413 | ; the file operations performed. 414 | ; http://www.php.net/manual/en/ini.core.php#ini.realpath-cache-size 415 | ;realpath_cache_size = 16k 416 | 417 | ; Duration of time, in seconds for which to cache realpath information for a given 418 | ; file or directory. For systems with rarely changing files, consider increasing this 419 | ; value. 420 | ; http://www.php.net/manual/en/ini.core.php#ini.realpath-cache-ttl 421 | ;realpath_cache_ttl = 120 422 | 423 | ;;;;;;;;;;;;;;;;; 424 | ; Miscellaneous ; 425 | ;;;;;;;;;;;;;;;;; 426 | 427 | ; Decides whether PHP may expose the fact that it is installed on the server 428 | ; (e.g. by adding its signature to the Web server header). It is no security 429 | ; threat in any way, but it makes it possible to determine whether you use PHP 430 | ; on your server or not. 431 | ; http://www.php.net/manual/en/ini.core.php#ini.expose-php 432 | expose_php = On 433 | 434 | ;;;;;;;;;;;;;;;;;;; 435 | ; Resource Limits ; 436 | ;;;;;;;;;;;;;;;;;;; 437 | 438 | ; Maximum execution time of each script, in seconds 439 | ; http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time 440 | max_execution_time = 300 441 | 442 | ; Maximum amount of time each script may spend parsing request data. It's a good 443 | ; idea to limit this time on productions servers in order to eliminate unexpectedly 444 | ; long running scripts. 445 | ; Default Value: -1 (Unlimited) 446 | ; Development Value: 60 (60 seconds) 447 | ; Production Value: 60 (60 seconds) 448 | ; http://www.php.net/manual/en/info.configuration.php#ini.max-input-time 449 | max_input_time = 300 450 | 451 | ; Maximum input variable nesting level 452 | ; http://www.php.net/manual/en/info.configuration.php#ini.max-input-nesting-level 453 | ;max_input_nesting_level = 64 454 | 455 | ; Maximum amount of memory a script may consume (128MB) 456 | ; http://www.php.net/manual/en/ini.core.php#ini.memory-limit 457 | memory_limit = 128M 458 | 459 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 460 | ; Error handling and logging ; 461 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 462 | 463 | ; This directive informs PHP of which errors, warnings and notices you would like 464 | ; it to take action for. The recommended way of setting values for this 465 | ; directive is through the use of the error level constants and bitwise 466 | ; operators. The error level constants are below here for convenience as well as 467 | ; some common settings and their meanings. 468 | ; By default, PHP is set to take action on all errors, notices and warnings EXCEPT 469 | ; those related to E_NOTICE and E_STRICT, which together cover best practices and 470 | ; recommended coding standards in PHP. For performance reasons, this is the 471 | ; recommend error reporting setting. Your production server shouldn't be wasting 472 | ; resources complaining about best practices and coding standards. That's what 473 | ; development servers and development settings are for. 474 | ; Note: The php.ini-development file has this setting as E_ALL | E_STRICT. This 475 | ; means it pretty much reports everything which is exactly what you want during 476 | ; development and early testing. 477 | ; 478 | ; Error Level Constants: 479 | ; E_ALL - All errors and warnings (includes E_STRICT as of PHP 6.0.0) 480 | ; E_ERROR - fatal run-time errors 481 | ; E_RECOVERABLE_ERROR - almost fatal run-time errors 482 | ; E_WARNING - run-time warnings (non-fatal errors) 483 | ; E_PARSE - compile-time parse errors 484 | ; E_NOTICE - run-time notices (these are warnings which often result 485 | ; from a bug in your code, but it's possible that it was 486 | ; intentional (e.g., using an uninitialized variable and 487 | ; relying on the fact it's automatically initialized to an 488 | ; empty string) 489 | ; E_STRICT - run-time notices, enable to have PHP suggest changes 490 | ; to your code which will ensure the best interoperability 491 | ; and forward compatibility of your code 492 | ; E_CORE_ERROR - fatal errors that occur during PHP's initial startup 493 | ; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's 494 | ; initial startup 495 | ; E_COMPILE_ERROR - fatal compile-time errors 496 | ; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) 497 | ; E_USER_ERROR - user-generated error message 498 | ; E_USER_WARNING - user-generated warning message 499 | ; E_USER_NOTICE - user-generated notice message 500 | ; E_DEPRECATED - warn about code that will not work in future versions 501 | ; of PHP 502 | ; E_USER_DEPRECATED - user-generated deprecation warnings 503 | ; 504 | ; Common Values: 505 | ; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.) 506 | ; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices) 507 | ; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) 508 | ; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.) 509 | ; Default Value: E_ALL & ~E_NOTICE 510 | ; Development Value: E_ALL | E_STRICT 511 | ; Production Value: E_ALL & ~E_DEPRECATED 512 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting 513 | error_reporting = E_ALL & ~E_DEPRECATED 514 | 515 | ; This directive controls whether or not and where PHP will output errors, 516 | ; notices and warnings too. Error output is very useful during development, but 517 | ; it could be very dangerous in production environments. Depending on the code 518 | ; which is triggering the error, sensitive information could potentially leak 519 | ; out of your application such as database usernames and passwords or worse. 520 | ; It's recommended that errors be logged on production servers rather than 521 | ; having the errors sent to STDOUT. 522 | ; Possible Values: 523 | ; Off = Do not display any errors 524 | ; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) 525 | ; On or stdout = Display errors to STDOUT 526 | ; Default Value: On 527 | ; Development Value: On 528 | ; Production Value: Off 529 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-errors 530 | display_errors = Off 531 | 532 | ; The display of errors which occur during PHP's startup sequence are handled 533 | ; separately from display_errors. PHP's default behavior is to suppress those 534 | ; errors from clients. Turning the display of startup errors on can be useful in 535 | ; debugging configuration problems. But, it's strongly recommended that you 536 | ; leave this setting off on production servers. 537 | ; Default Value: Off 538 | ; Development Value: On 539 | ; Production Value: Off 540 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.display-startup-errors 541 | display_startup_errors = Off 542 | 543 | ; Besides displaying errors, PHP can also log errors to locations such as a 544 | ; server-specific log, STDERR, or a location specified by the error_log 545 | ; directive found below. While errors should not be displayed on productions 546 | ; servers they should still be monitored and logging is a great way to do that. 547 | ; Default Value: Off 548 | ; Development Value: On 549 | ; Production Value: On 550 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.log-errors 551 | log_errors = On 552 | 553 | ; Set maximum length of log_errors. In error_log information about the source is 554 | ; added. The default is 1024 and 0 allows to not apply any maximum length at all. 555 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.log-errors-max-len 556 | log_errors_max_len = 1024 557 | 558 | ; Do not log repeated messages. Repeated errors must occur in same file on same 559 | ; line unless ignore_repeated_source is set true. 560 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.ignore-repeated-errors 561 | ignore_repeated_errors = Off 562 | 563 | ; Ignore source of message when ignoring repeated messages. When this setting 564 | ; is On you will not log errors with repeated messages from different files or 565 | ; source lines. 566 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.ignore-repeated-source 567 | ignore_repeated_source = Off 568 | 569 | ; If this parameter is set to Off, then memory leaks will not be shown (on 570 | ; stdout or in the log). This has only effect in a debug compile, and if 571 | ; error reporting includes E_WARNING in the allowed list 572 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.report-memleaks 573 | report_memleaks = On 574 | 575 | ; This setting is on by default. 576 | ;report_zend_debug = 0 577 | 578 | ; Store the last error/warning message in $php_errormsg (boolean). Setting this value 579 | ; to On can assist in debugging and is appropriate for development servers. It should 580 | ; however be disabled on production servers. 581 | ; Default Value: Off 582 | ; Development Value: On 583 | ; Production Value: Off 584 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.track-errors 585 | track_errors = Off 586 | 587 | ; Turn off normal error reporting and emit XML-RPC error XML 588 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.xmlrpc-errors 589 | ;xmlrpc_errors = 0 590 | 591 | ; An XML-RPC faultCode 592 | ;xmlrpc_error_number = 0 593 | 594 | ; When PHP displays or logs an error, it has the capability of inserting html 595 | ; links to documentation related to that error. This directive controls whether 596 | ; those HTML links appear in error messages or not. For performance and security 597 | ; reasons, it's recommended you disable this on production servers. 598 | ; Default Value: On 599 | ; Development Value: On 600 | ; Production value: Off 601 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.html-errors 602 | html_errors = Off 603 | 604 | ; If html_errors is set On PHP produces clickable error messages that direct 605 | ; to a page describing the error or function causing the error in detail. 606 | ; You can download a copy of the PHP manual from http://www.php.net/docs.php 607 | ; and change docref_root to the base URL of your local copy including the 608 | ; leading '/'. You must also specify the file extension being used including 609 | ; the dot. PHP's default behavior is to leave these settings empty. 610 | ; Note: Never use this feature for production boxes. 611 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.docref-root 612 | ; Examples 613 | ;docref_root = "/phpmanual/" 614 | 615 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.docref-ext 616 | ;docref_ext = .html 617 | 618 | ; String to output before an error message. PHP's default behavior is to leave 619 | ; this setting blank. 620 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-prepend-string 621 | ; Example: 622 | ;error_prepend_string = "" 623 | 624 | ; String to output after an error message. PHP's default behavior is to leave 625 | ; this setting blank. 626 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-append-string 627 | ; Example: 628 | ;error_append_string = "" 629 | 630 | ; Log errors to specified file. PHP's default behavior is to leave this value 631 | ; empty. 632 | ; http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-log 633 | ; Example: 634 | ;error_log = php_errors.log 635 | ; Log errors to syslog (Event Log on NT, not valid in Windows 95). 636 | ;error_log = syslog 637 | 638 | ;;;;;;;;;;;;;;;;; 639 | ; Data Handling ; 640 | ;;;;;;;;;;;;;;;;; 641 | 642 | ; Note - track_vars is ALWAYS enabled as of PHP 4.0.3 643 | 644 | ; The separator used in PHP generated URLs to separate arguments. 645 | ; PHP's default setting is "&". 646 | ; http://www.php.net/manual/en/ini.core.php#ini.arg-separator.output 647 | ; Example: 648 | ;arg_separator.output = "&" 649 | 650 | ; List of separator(s) used by PHP to parse input URLs into variables. 651 | ; PHP's default setting is "&". 652 | ; NOTE: Every character in this directive is considered as separator! 653 | ; http://www.php.net/manual/en/ini.core.php#ini.arg-separator.input 654 | ; Example: 655 | ;arg_separator.input = ";&" 656 | 657 | ; This directive determines which super global arrays are registered when PHP 658 | ; starts up. If the register_globals directive is enabled, it also determines 659 | ; what order variables are populated into the global space. G,P,C,E & S are 660 | ; abbreviations for the following respective super globals: GET, POST, COOKIE, 661 | ; ENV and SERVER. There is a performance penalty paid for the registration of 662 | ; these arrays and because ENV is not as commonly used as the others, ENV is 663 | ; is not recommended on productions servers. You can still get access to 664 | ; the environment variables through getenv() should you need to. 665 | ; Default Value: "EGPCS" 666 | ; Development Value: "GPCS" 667 | ; Production Value: "GPCS"; 668 | ; http://www.php.net/manual/en/ini.core.php#ini.variables-order 669 | variables_order = "GPCS" 670 | 671 | ; This directive determines which super global data (G,P,C,E & S) should 672 | ; be registered into the super global array REQUEST. If so, it also determines 673 | ; the order in which that data is registered. The values for this directive are 674 | ; specified in the same manner as the variables_order directive, EXCEPT one. 675 | ; Leaving this value empty will cause PHP to use the value set in the 676 | ; variables_order directive. It does not mean it will leave the super globals 677 | ; array REQUEST empty. 678 | ; Default Value: None 679 | ; Development Value: "GP" 680 | ; Production Value: "GP" 681 | ; http://www.php.net/manual/en/ini.core.php#ini.request-order 682 | request_order = "GP" 683 | 684 | ; Whether or not to register the EGPCS variables as global variables. You may 685 | ; want to turn this off if you don't want to clutter your scripts' global scope 686 | ; with user data. This makes most sense when coupled with track_vars - in which 687 | ; case you can access all of the GPC variables through the $HTTP_*_VARS[], 688 | ; variables. 689 | ; You should do your best to write your scripts so that they do not require 690 | ; register_globals to be on; Using form variables as globals can easily lead 691 | ; to possible security problems, if the code is not very well thought of. 692 | ; http://www.php.net/manual/en/ini.core.php#ini.register-globals 693 | register_globals = Off 694 | 695 | ; Determines whether the deprecated long $HTTP_*_VARS type predefined variables 696 | ; are registered by PHP or not. As they are deprecated, we obviously don't 697 | ; recommend you use them. They are on by default for compatibility reasons but 698 | ; they are not recommended on production servers. 699 | ; Default Value: On 700 | ; Development Value: Off 701 | ; Production Value: Off 702 | ; http://www.php.net/manual/en/ini.core.php#ini.register-long-arrays 703 | register_long_arrays = Off 704 | 705 | ; This directive determines whether PHP registers $argv & $argc each time it 706 | ; runs. $argv contains an array of all the arguments passed to PHP when a script 707 | ; is invoked. $argc contains an integer representing the number of arguments 708 | ; that were passed when the script was invoked. These arrays are extremely 709 | ; useful when running scripts from the command line. When this directive is 710 | ; enabled, registering these variables consumes CPU cycles and memory each time 711 | ; a script is executed. For performance reasons, this feature should be disabled 712 | ; on production servers. 713 | ; Default Value: On 714 | ; Development Value: Off 715 | ; Production Value: Off 716 | ; http://www.php.net/manual/en/ini.core.php#ini.register-argc-argv 717 | register_argc_argv = Off 718 | 719 | ; When enabled, the SERVER and ENV variables are created when they're first 720 | ; used (Just In Time) instead of when the script starts. If these variables 721 | ; are not used within a script, having this directive on will result in a 722 | ; performance gain. The PHP directives register_globals, register_long_arrays, 723 | ; and register_argc_argv must be disabled for this directive to have any affect. 724 | ; http://www.php.net/manual/en/ini.core.php#ini.auto-globals-jit 725 | auto_globals_jit = On 726 | 727 | ; Maximum size of POST data that PHP will accept. 728 | ; http://www.php.net/manual/en/ini.core.php#ini.post-max-size 729 | post_max_size = 16M 730 | 731 | ; Magic quotes are a preprocessing feature of PHP where PHP will attempt to 732 | ; escape any character sequences in GET, POST, COOKIE and ENV data which might 733 | ; otherwise corrupt data being placed in resources such as databases before 734 | ; making that data available to you. Because of character encoding issues and 735 | ; non-standard SQL implementations across many databases, it's not currently 736 | ; possible for this feature to be 100% accurate. PHP's default behavior is to 737 | ; enable the feature. We strongly recommend you use the escaping mechanisms 738 | ; designed specifically for the database your using instead of relying on this 739 | ; feature. Also note, this feature has been deprecated as of PHP 5.3.0 and is 740 | ; scheduled for removal in PHP 6. 741 | ; Default Value: On 742 | ; Development Value: Off 743 | ; Production Value: Off 744 | ; http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc 745 | magic_quotes_gpc = Off 746 | 747 | ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. 748 | ; http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-runtime 749 | magic_quotes_runtime = Off 750 | 751 | ; Use Sybase-style magic quotes (escape ' with '' instead of \'). 752 | ; http://www.php.net/manual/en/sybase.configuration.php#ini.magic-quotes-sybase 753 | magic_quotes_sybase = Off 754 | 755 | ; Automatically add files before PHP document. 756 | ; http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file 757 | auto_prepend_file = 758 | 759 | ; Automatically add files after PHP document. 760 | ; http://www.php.net/manual/en/ini.core.php#ini.auto-append-file 761 | auto_append_file = 762 | 763 | ; As of 4.0b4, PHP always outputs a character encoding by default in 764 | ; the Content-type: header. To disable sending of the charset, simply 765 | ; set it to be empty. 766 | ; 767 | ; PHP's built-in default is text/html 768 | ; http://www.php.net/manual/en/ini.core.php#ini.default-mimetype 769 | default_mimetype = "text/html" 770 | 771 | ; PHP's default character set is set to empty. 772 | ; http://www.php.net/manual/en/ini.core.php#ini.default-charset 773 | ;default_charset = "iso-8859-1" 774 | 775 | ; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is 776 | ; to disable this feature. 777 | ; http://www.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data 778 | ;always_populate_raw_post_data = On 779 | 780 | ;;;;;;;;;;;;;;;;;;;;;;;;; 781 | ; Paths and Directories ; 782 | ;;;;;;;;;;;;;;;;;;;;;;;;; 783 | 784 | ; UNIX: "/path1:/path2" 785 | ;include_path = ".:/php/includes" 786 | ; 787 | ; Windows: "\path1;\path2" 788 | ;include_path = ".;c:\php\includes" 789 | ; 790 | ; PHP's default setting for include_path is ".;/path/to/php/pear" 791 | ; http://www.php.net/manual/en/ini.core.php#ini.include-path 792 | 793 | ; The root of the PHP pages, used only if nonempty. 794 | ; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root 795 | ; if you are running php as a CGI under any web server (other than IIS) 796 | ; see documentation for security issues. The alternate is to use the 797 | ; cgi.force_redirect configuration below 798 | ; http://www.php.net/manual/en/ini.core.php#ini.doc-root 799 | doc_root = 800 | 801 | ; The directory under which PHP opens the script using /~username used only 802 | ; if nonempty. 803 | ; http://www.php.net/manual/en/ini.core.php#ini.user-dir 804 | user_dir = 805 | 806 | ; Directory in which the loadable extensions (modules) reside. 807 | ; http://www.php.net/manual/en/ini.core.php#ini.extension-dir 808 | ; extension_dir = "./" 809 | 810 | ; Whether or not to enable the dl() function. The dl() function does NOT work 811 | ; properly in multithreaded servers, such as IIS or Zeus, and is automatically 812 | ; disabled on them. 813 | ; http://www.php.net/manual/en/info.configuration.php#ini.enable-dl 814 | enable_dl = Off 815 | 816 | ; cgi.force_redirect is necessary to provide security running PHP as a CGI under 817 | ; most web servers. Left undefined, PHP turns this on by default. You can 818 | ; turn it off here AT YOUR OWN RISK 819 | ; **You CAN safely turn this off for IIS, in fact, you MUST.** 820 | ; http://www.php.net/manual/en/ini.core.php#ini.cgi.force-redirect 821 | ;cgi.force_redirect = 1 822 | 823 | ; if cgi.nph is enabled it will force cgi to always sent Status: 200 with 824 | ; every request. PHP's default behavior is to disable this feature. 825 | ;cgi.nph = 1 826 | 827 | ; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape 828 | ; (iPlanet) web servers, you MAY need to set an environment variable name that PHP 829 | ; will look for to know it is OK to continue execution. Setting this variable MAY 830 | ; cause security issues, KNOW WHAT YOU ARE DOING FIRST. 831 | ; http://www.php.net/manual/en/ini.core.php#ini.cgi.redirect-status-env 832 | ;cgi.redirect_status_env = ; 833 | 834 | ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's 835 | ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok 836 | ; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting 837 | ; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting 838 | ; of zero causes PHP to behave as before. Default is 1. You should fix your scripts 839 | ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. 840 | ; http://www.php.net/manual/en/ini.core.php#ini.cgi.fix-pathinfo 841 | ;cgi.fix_pathinfo=1 842 | 843 | ; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate 844 | ; security tokens of the calling client. This allows IIS to define the 845 | ; security context that the request runs under. mod_fastcgi under Apache 846 | ; does not currently support this feature (03/17/2002) 847 | ; Set to 1 if running under IIS. Default is zero. 848 | ; http://www.php.net/manual/en/ini.core.php#ini.fastcgi.impersonate 849 | ;fastcgi.impersonate = 1; 850 | 851 | ; Disable logging through FastCGI connection. PHP's default behavior is to enable 852 | ; this feature. 853 | ;fastcgi.logging = 0 854 | 855 | ; cgi.rfc2616_headers configuration option tells PHP what type of headers to 856 | ; use when sending HTTP response code. If it's set 0 PHP sends Status: header that 857 | ; is supported by Apache. When this option is set to 1 PHP will send 858 | ; RFC2616 compliant header. 859 | ; Default is zero. 860 | ; http://www.php.net/manual/en/ini.core.php#ini.cgi.rfc2616-headers 861 | ;cgi.rfc2616_headers = 0 862 | 863 | ;;;;;;;;;;;;;;;; 864 | ; File Uploads ; 865 | ;;;;;;;;;;;;;;;; 866 | 867 | ; Whether to allow HTTP file uploads. 868 | ; http://www.php.net/manual/en/ini.core.php#ini.file-uploads 869 | file_uploads = On 870 | 871 | ; Temporary directory for HTTP uploaded files (will use system default if not 872 | ; specified). 873 | ; http://www.php.net/manual/en/ini.core.php#ini.upload-tmp-dir 874 | ;upload_tmp_dir = 875 | 876 | ; Maximum allowed size for uploaded files. 877 | ; http://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize 878 | upload_max_filesize = 2M 879 | 880 | ;;;;;;;;;;;;;;;;;; 881 | ; Fopen wrappers ; 882 | ;;;;;;;;;;;;;;;;;; 883 | 884 | ; Whether to allow the treatment of URLs (like http:// or ftp://) as files. 885 | ; http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen 886 | allow_url_fopen = On 887 | 888 | ; Whether to allow include/require to open URLs (like http:// or ftp://) as files. 889 | ; http://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-include 890 | allow_url_include = Off 891 | 892 | ; Define the anonymous ftp password (your email address). PHP's default setting 893 | ; for this is empty. 894 | ; http://www.php.net/manual/en/filesystem.configuration.php#ini.from 895 | ;from="john@doe.com" 896 | 897 | ; Define the User-Agent string. PHP's default setting for this is empty. 898 | ; http://www.php.net/manual/en/filesystem.configuration.php#ini.user-agent 899 | ;user_agent="PHP" 900 | 901 | ; Default timeout for socket based streams (seconds) 902 | ; http://www.php.net/manual/en/filesystem.configuration.php#ini.default-socket-timeout 903 | default_socket_timeout = 60 904 | 905 | ; If your scripts have to deal with files from Macintosh systems, 906 | ; or you are running on a Mac and need to deal with files from 907 | ; unix or win32 systems, setting this flag will cause PHP to 908 | ; automatically detect the EOL character in those files so that 909 | ; fgets() and file() will work regardless of the source of the file. 910 | ; http://www.php.net/manual/en/filesystem.configuration.php#ini.auto-detect-line-endings 911 | ;auto_detect_line_endings = Off 912 | 913 | ;;;;;;;;;;;;;;;;;;;;;; 914 | ; Dynamic Extensions ; 915 | ;;;;;;;;;;;;;;;;;;;;;; 916 | 917 | ; If you wish to have an extension loaded automatically, use the following 918 | ; syntax: 919 | ; 920 | ; extension=modulename.extension 921 | ; 922 | ; For example 923 | ; 924 | ; extension=msql.so 925 | ; 926 | ; ... or with a path: 927 | ; 928 | ; extension=/path/to/extension/msql.so 929 | ; 930 | ; If you only provide the name of the extension, PHP will look for it in its 931 | ; default extension directory. 932 | 933 | ;;;; 934 | ; Note: packaged extension modules are now loaded via the .ini files 935 | ; found in the directory /etc/php.d; these are loaded by default. 936 | ;;;; 937 | 938 | 939 | ;;;;;;;;;;;;;;;;;;; 940 | ; Module Settings ; 941 | ;;;;;;;;;;;;;;;;;;; 942 | 943 | [Date] 944 | ; Defines the default timezone used by the date functions 945 | ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone 946 | date.timezone = Asia/Chongqing 947 | 948 | ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.default-latitude 949 | ;date.default_latitude = 31.7667 950 | 951 | ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.default-longitude 952 | ;date.default_longitude = 35.2333 953 | 954 | ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.sunrise-zenith 955 | ;date.sunrise_zenith = 90.583333 956 | 957 | ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.sunset-zenith 958 | ;date.sunset_zenith = 90.583333 959 | 960 | [filter] 961 | ; http://www.php.net/manual/en/filter.configuration.php#ini.filter.default 962 | ;filter.default = unsafe_raw 963 | 964 | ; http://www.php.net/manual/en/filter.configuration.php#ini.filter.default-flags 965 | ;filter.default_flags = 966 | 967 | [iconv] 968 | ;iconv.input_encoding = ISO-8859-1 969 | ;iconv.internal_encoding = ISO-8859-1 970 | ;iconv.output_encoding = ISO-8859-1 971 | 972 | [intl] 973 | ;intl.default_locale = 974 | 975 | [sqlite] 976 | ; http://www.php.net/manual/en/sqlite.configuration.php#ini.sqlite.assoc-case 977 | ;sqlite.assoc_case = 0 978 | 979 | [sqlite3] 980 | ;sqlite3.extension_dir = 981 | 982 | [Pcre] 983 | ;PCRE library backtracking limit. 984 | ; http://www.php.net/manual/en/pcre.configuration.php#ini.pcre.backtrack-limit 985 | ;pcre.backtrack_limit=100000 986 | 987 | ;PCRE library recursion limit. 988 | ;Please note that if you set this value to a high number you may consume all 989 | ;the available process stack and eventually crash PHP (due to reaching the 990 | ;stack size limit imposed by the Operating System). 991 | ; http://www.php.net/manual/en/pcre.configuration.php#ini.pcre.recursion-limit 992 | ;pcre.recursion_limit=100000 993 | 994 | [Pdo] 995 | ; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" 996 | ; http://www.php.net/manual/en/ref.pdo-odbc.php#ini.pdo-odbc.connection-pooling 997 | ;pdo_odbc.connection_pooling=strict 998 | 999 | [Phar] 1000 | ; http://www.php.net/manual/en/phar.configuration.php#ini.phar.readonly 1001 | ;phar.readonly = On 1002 | 1003 | ; http://www.php.net/manual/en/phar.configuration.php#ini.phar.require-hash 1004 | ;phar.require_hash = On 1005 | 1006 | ;phar.cache_list = 1007 | 1008 | [Syslog] 1009 | ; Whether or not to define the various syslog variables (e.g. $LOG_PID, 1010 | ; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In 1011 | ; runtime, you can define these variables by calling define_syslog_variables(). 1012 | ; http://www.php.net/manual/en/network.configuration.php#ini.define-syslog-variables 1013 | define_syslog_variables = Off 1014 | 1015 | [mail function] 1016 | ; For Win32 only. 1017 | ; http://www.php.net/manual/en/mail.configuration.php#ini.smtp 1018 | SMTP = localhost 1019 | ; http://www.php.net/manual/en/mail.configuration.php#ini.smtp-port 1020 | smtp_port = 25 1021 | 1022 | ; For Win32 only. 1023 | ; http://www.php.net/manual/en/mail.configuration.php#ini.sendmail-from 1024 | ;sendmail_from = me@example.com 1025 | 1026 | ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). 1027 | ; http://www.php.net/manual/en/mail.configuration.php#ini.sendmail-path 1028 | sendmail_path = /usr/sbin/sendmail -t -i 1029 | 1030 | ; Force the addition of the specified parameters to be passed as extra parameters 1031 | ; to the sendmail binary. These parameters will always replace the value of 1032 | ; the 5th parameter to mail(), even in safe mode. 1033 | ;mail.force_extra_parameters = 1034 | 1035 | ; Add X-PHP-Originaiting-Script: that will include uid of the script followed by the filename 1036 | mail.add_x_header = On 1037 | 1038 | ; Log all mail() calls including the full path of the script, line #, to address and headers 1039 | ;mail.log = 1040 | 1041 | [SQL] 1042 | ; http://www.php.net/manual/en/ini.core.php#ini.sql.safe-mode 1043 | sql.safe_mode = Off 1044 | 1045 | [ODBC] 1046 | ; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.default-db 1047 | ;odbc.default_db = Not yet implemented 1048 | 1049 | ; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.default-user 1050 | ;odbc.default_user = Not yet implemented 1051 | 1052 | ; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.default-pw 1053 | ;odbc.default_pw = Not yet implemented 1054 | 1055 | ; Allow or prevent persistent links. 1056 | ; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.allow-persistent 1057 | odbc.allow_persistent = On 1058 | 1059 | ; Check that a connection is still valid before reuse. 1060 | ; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.check-persistent 1061 | odbc.check_persistent = On 1062 | 1063 | ; Maximum number of persistent links. -1 means no limit. 1064 | ; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.max-persistent 1065 | odbc.max_persistent = -1 1066 | 1067 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 1068 | ; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.max-links 1069 | odbc.max_links = -1 1070 | 1071 | ; Handling of LONG fields. Returns number of bytes to variables. 0 means 1072 | ; passthru. 1073 | ; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.defaultlrl 1074 | odbc.defaultlrl = 4096 1075 | 1076 | ; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. 1077 | ; See the documentation on odbc_binmode and odbc_longreadlen for an explanation 1078 | ; of uodbc.defaultlrl and uodbc.defaultbinmode 1079 | ; http://www.php.net/manual/en/odbc.configuration.php#ini.uodbc.defaultbinmode 1080 | odbc.defaultbinmode = 1 1081 | 1082 | ;birdstep.max_links = -1 1083 | 1084 | [MySQL] 1085 | ; Allow or prevent persistent links. 1086 | ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.allow-persistent 1087 | mysql.allow_persistent = On 1088 | 1089 | ; Maximum number of persistent links. -1 means no limit. 1090 | ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.max-persistent 1091 | mysql.max_persistent = -1 1092 | 1093 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 1094 | ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.max-links 1095 | mysql.max_links = -1 1096 | 1097 | ; Default port number for mysql_connect(). If unset, mysql_connect() will use 1098 | ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the 1099 | ; compile-time value defined MYSQL_PORT (in that order). Win32 will only look 1100 | ; at MYSQL_PORT. 1101 | ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-port 1102 | mysql.default_port = 1103 | 1104 | ; Default socket name for local MySQL connects. If empty, uses the built-in 1105 | ; MySQL defaults. 1106 | ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-socket 1107 | mysql.default_socket = 1108 | 1109 | ; Default host for mysql_connect() (doesn't apply in safe mode). 1110 | ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-host 1111 | mysql.default_host = 1112 | 1113 | ; Default user for mysql_connect() (doesn't apply in safe mode). 1114 | ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-user 1115 | mysql.default_user = 1116 | 1117 | ; Default password for mysql_connect() (doesn't apply in safe mode). 1118 | ; Note that this is generally a *bad* idea to store passwords in this file. 1119 | ; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password") 1120 | ; and reveal this password! And of course, any users with read access to this 1121 | ; file will be able to reveal the password as well. 1122 | ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.default-password 1123 | mysql.default_password = 1124 | 1125 | ; Maximum time (in seconds) for connect timeout. -1 means no limit 1126 | ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.connect-timeout 1127 | mysql.connect_timeout = 60 1128 | 1129 | ; Trace mode. When trace_mode is active (=On), warnings for table/index scans and 1130 | ; SQL-Errors will be displayed. 1131 | ; http://www.php.net/manual/en/mysql.configuration.php#ini.mysql.trace-mode 1132 | mysql.trace_mode = Off 1133 | 1134 | [MySQLi] 1135 | 1136 | ; Maximum number of links. -1 means no limit. 1137 | ; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.max-links 1138 | mysqli.max_links = -1 1139 | 1140 | ; Default port number for mysqli_connect(). If unset, mysqli_connect() will use 1141 | ; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the 1142 | ; compile-time value defined MYSQL_PORT (in that order). Win32 will only look 1143 | ; at MYSQL_PORT. 1144 | ; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-port 1145 | mysqli.default_port = 3306 1146 | 1147 | ; Default socket name for local MySQL connects. If empty, uses the built-in 1148 | ; MySQL defaults. 1149 | ; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-socket 1150 | mysqli.default_socket = 1151 | 1152 | ; Default host for mysql_connect() (doesn't apply in safe mode). 1153 | ; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-host 1154 | mysqli.default_host = 1155 | 1156 | ; Default user for mysql_connect() (doesn't apply in safe mode). 1157 | ; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-user 1158 | mysqli.default_user = 1159 | 1160 | ; Default password for mysqli_connect() (doesn't apply in safe mode). 1161 | ; Note that this is generally a *bad* idea to store passwords in this file. 1162 | ; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") 1163 | ; and reveal this password! And of course, any users with read access to this 1164 | ; file will be able to reveal the password as well. 1165 | ; http://www.php.net/manual/en/mysqli.configuration.php#ini.mysqli.default-pw 1166 | mysqli.default_pw = 1167 | 1168 | ; Allow or prevent reconnect 1169 | mysqli.reconnect = Off 1170 | 1171 | [PostgresSQL] 1172 | ; Allow or prevent persistent links. 1173 | ; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.allow-persistent 1174 | pgsql.allow_persistent = On 1175 | 1176 | ; Detect broken persistent links always with pg_pconnect(). 1177 | ; Auto reset feature requires a little overheads. 1178 | ; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.auto-reset-persistent 1179 | pgsql.auto_reset_persistent = Off 1180 | 1181 | ; Maximum number of persistent links. -1 means no limit. 1182 | ; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.max-persistent 1183 | pgsql.max_persistent = -1 1184 | 1185 | ; Maximum number of links (persistent+non persistent). -1 means no limit. 1186 | ; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.max-links 1187 | pgsql.max_links = -1 1188 | 1189 | ; Ignore PostgreSQL backends Notice message or not. 1190 | ; Notice message logging require a little overheads. 1191 | ; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.ignore-notice 1192 | pgsql.ignore_notice = 0 1193 | 1194 | ; Log PostgreSQL backends Noitce message or not. 1195 | ; Unless pgsql.ignore_notice=0, module cannot log notice message. 1196 | ; http://www.php.net/manual/en/pgsql.configuration.php#ini.pgsql.log-notice 1197 | pgsql.log_notice = 0 1198 | 1199 | [Sybase-CT] 1200 | ; Allow or prevent persistent links. 1201 | ; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.allow-persistent 1202 | sybct.allow_persistent = On 1203 | 1204 | ; Maximum number of persistent links. -1 means no limit. 1205 | ; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.max-persistent 1206 | sybct.max_persistent = -1 1207 | 1208 | ; Maximum number of links (persistent + non-persistent). -1 means no limit. 1209 | ; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.max-links 1210 | sybct.max_links = -1 1211 | 1212 | ; Minimum server message severity to display. 1213 | ; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.min-server-severity 1214 | sybct.min_server_severity = 10 1215 | 1216 | ; Minimum client message severity to display. 1217 | ; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.min-client-severity 1218 | sybct.min_client_severity = 10 1219 | 1220 | ; Set per-context timeout 1221 | ; http://www.php.net/manual/en/sybase.configuration.php#ini.sybct.timeout 1222 | ;sybct.timeout= 1223 | 1224 | ;sybct.packet_size 1225 | 1226 | [bcmath] 1227 | ; Number of decimal digits for all bcmath functions. 1228 | ; http://www.php.net/manual/en/bc.configuration.php#ini.bcmath.scale 1229 | bcmath.scale = 0 1230 | 1231 | [browscap] 1232 | ; http://www.php.net/manual/en/misc.configuration.php#ini.browscap 1233 | ;browscap = extra/browscap.ini 1234 | 1235 | [Session] 1236 | ; Handler used to store/retrieve data. 1237 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.save-handler 1238 | session.save_handler = files 1239 | 1240 | ; Argument passed to save_handler. In the case of files, this is the path 1241 | ; where data files are stored. Note: Windows users have to change this 1242 | ; variable in order to use PHP's session functions. 1243 | ; 1244 | ; As of PHP 4.0.1, you can define the path as: 1245 | ; 1246 | ; session.save_path = "N;/path" 1247 | ; 1248 | ; where N is an integer. Instead of storing all the session files in 1249 | ; /path, what this will do is use subdirectories N-levels deep, and 1250 | ; store the session data in those directories. This is useful if you 1251 | ; or your OS have problems with lots of files in one directory, and is 1252 | ; a more efficient layout for servers that handle lots of sessions. 1253 | ; 1254 | ; NOTE 1: PHP will not create this directory structure automatically. 1255 | ; You can use the script in the ext/session dir for that purpose. 1256 | ; NOTE 2: See the section on garbage collection below if you choose to 1257 | ; use subdirectories for session storage 1258 | ; 1259 | ; The file storage module creates files using mode 600 by default. 1260 | ; You can change that by using 1261 | ; 1262 | ; session.save_path = "N;MODE;/path" 1263 | ; 1264 | ; where MODE is the octal representation of the mode. Note that this 1265 | ; does not overwrite the process's umask. 1266 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.save-path 1267 | session.save_path = "/var/lib/php/session" 1268 | 1269 | ; Whether to use cookies. 1270 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.use-cookies 1271 | session.use_cookies = 1 1272 | 1273 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure 1274 | ;session.cookie_secure = 1275 | 1276 | ; This option forces PHP to fetch and use a cookie for storing and maintaining 1277 | ; the session id. We encourage this operation as it's very helpful in combatting 1278 | ; session hijacking when not specifying and managing your own session id. It is 1279 | ; not the end all be all of session hijacking defense, but it's a good start. 1280 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.use-only-cookies 1281 | session.use_only_cookies = 1 1282 | 1283 | ; Name of the session (used as cookie name). 1284 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.name 1285 | session.name = PHPSESSID 1286 | 1287 | ; Initialize session on request startup. 1288 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.auto-start 1289 | session.auto_start = 0 1290 | 1291 | ; Lifetime in seconds of cookie or, if 0, until browser is restarted. 1292 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime 1293 | session.cookie_lifetime = 0 1294 | 1295 | ; The path for which the cookie is valid. 1296 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-path 1297 | session.cookie_path = / 1298 | 1299 | ; The domain for which the cookie is valid. 1300 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain 1301 | session.cookie_domain = 1302 | 1303 | ; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript. 1304 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-httponly 1305 | session.cookie_httponly = 1306 | 1307 | ; Handler used to serialize data. php is the standard serializer of PHP. 1308 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.serialize-handler 1309 | session.serialize_handler = php 1310 | 1311 | ; Defines the probability that the 'garbage collection' process is started 1312 | ; on every session initialization. The probability is calculated by using 1313 | ; gc_probability/gc_divisor. Where session.gc_probability is the numerator 1314 | ; and gc_divisor is the denominator in the equation. Setting this value to 1 1315 | ; when the session.gc_divisor value is 100 will give you approximately a 1% chance 1316 | ; the gc will run on any give request. 1317 | ; Default Value: 1 1318 | ; Development Value: 1 1319 | ; Production Value: 1 1320 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.gc-probability 1321 | session.gc_probability = 1 1322 | 1323 | ; Defines the probability that the 'garbage collection' process is started on every 1324 | ; session initialization. The probability is calculated by using the following equation: 1325 | ; gc_probability/gc_divisor. Where session.gc_probability is the numerator and 1326 | ; session.gc_divisor is the denominator in the equation. Setting this value to 1 1327 | ; when the session.gc_divisor value is 100 will give you approximately a 1% chance 1328 | ; the gc will run on any give request. Increasing this value to 1000 will give you 1329 | ; a 0.1% chance the gc will run on any give request. For high volume production servers, 1330 | ; this is a more efficient approach. 1331 | ; Default Value: 100 1332 | ; Development Value: 1000 1333 | ; Production Value: 1000 1334 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.gc-divisor 1335 | session.gc_divisor = 1000 1336 | 1337 | ; After this number of seconds, stored data will be seen as 'garbage' and 1338 | ; cleaned up by the garbage collection process. 1339 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime 1340 | session.gc_maxlifetime = 1440 1341 | 1342 | ; NOTE: If you are using the subdirectory option for storing session files 1343 | ; (see session.save_path above), then garbage collection does *not* 1344 | ; happen automatically. You will need to do your own garbage 1345 | ; collection through a shell script, cron entry, or some other method. 1346 | ; For example, the following script would is the equivalent of 1347 | ; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): 1348 | ; cd /path/to/sessions; find -cmin +24 | xargs rm 1349 | 1350 | ; PHP 4.2 and less have an undocumented feature/bug that allows you to 1351 | ; to initialize a session variable in the global scope, even when register_globals 1352 | ; is disabled. PHP 4.3 and later will warn you, if this feature is used. 1353 | ; You can disable the feature and the warning separately. At this time, 1354 | ; the warning is only displayed, if bug_compat_42 is enabled. This feature 1355 | ; introduces some serious security problems if not handled correctly. It's 1356 | ; recommended that you do not use this feature on production servers. But you 1357 | ; should enable this on development servers and enable the warning as well. If you 1358 | ; do not enable the feature on development servers, you won't be warned when it's 1359 | ; used and debugging errors caused by this can be difficult to track down. 1360 | ; Default Value: On 1361 | ; Development Value: On 1362 | ; Production Value: Off 1363 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.bug-compat-42 1364 | session.bug_compat_42 = Off 1365 | 1366 | ; This setting controls whether or not you are warned by PHP when initializing a 1367 | ; session value into the global space. session.bug_compat_42 must be enabled before 1368 | ; these warnings can be issued by PHP. See the directive above for more information. 1369 | ; Default Value: On 1370 | ; Development Value: On 1371 | ; Production Value: Off 1372 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.bug-compat-warn 1373 | session.bug_compat_warn = Off 1374 | 1375 | ; Check HTTP Referer to invalidate externally stored URLs containing ids. 1376 | ; HTTP_REFERER has to contain this substring for the session to be 1377 | ; considered as valid. 1378 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.referer-check 1379 | session.referer_check = 1380 | 1381 | ; How many bytes to read from the file. 1382 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.entropy-length 1383 | session.entropy_length = 0 1384 | 1385 | ; Specified here to create the session id. 1386 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.entropy-file 1387 | ;session.entropy_file = /dev/urandom 1388 | session.entropy_file = 1389 | 1390 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.entropy-length 1391 | ;session.entropy_length = 16 1392 | 1393 | ; Set to {nocache,private,public,} to determine HTTP caching aspects 1394 | ; or leave this empty to avoid sending anti-caching headers. 1395 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.cache-limiter 1396 | session.cache_limiter = nocache 1397 | 1398 | ; Document expires after n minutes. 1399 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.cache-expire 1400 | session.cache_expire = 180 1401 | 1402 | ; trans sid support is disabled by default. 1403 | ; Use of trans sid may risk your users security. 1404 | ; Use this option with caution. 1405 | ; - User may send URL contains active session ID 1406 | ; to other person via. email/irc/etc. 1407 | ; - URL that contains active session ID may be stored 1408 | ; in publically accessible computer. 1409 | ; - User may access your site with the same session ID 1410 | ; always using URL stored in browser's history or bookmarks. 1411 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.use-trans-sid 1412 | session.use_trans_sid = 0 1413 | 1414 | ; Select a hash function for use in generating session ids. 1415 | ; Possible Values 1416 | ; 0 (MD5 128 bits) 1417 | ; 1 (SHA-1 160 bits) 1418 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.hash-function 1419 | session.hash_function = 0 1420 | 1421 | ; Define how many bits are stored in each character when converting 1422 | ; the binary hash data to something readable. 1423 | ; Possible values: 1424 | ; 4 (4 bits: 0-9, a-f) 1425 | ; 5 (5 bits: 0-9, a-v) 1426 | ; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") 1427 | ; Default Value: 4 1428 | ; Development Value: 5 1429 | ; Production Value: 5 1430 | ; http://www.php.net/manual/en/session.configuration.php#ini.session.hash-bits-per-character 1431 | session.hash_bits_per_character = 5 1432 | 1433 | ; The URL rewriter will look for URLs in a defined set of HTML tags. 1434 | ; form/fieldset are special; if you include them here, the rewriter will 1435 | ; add a hidden field with the info which is otherwise appended 1436 | ; to URLs. If you want XHTML conformity, remove the form entry. 1437 | ; Note that all valid entries require a "=", even if no value follows. 1438 | ; Default Value: "a=href,area=href,frame=src,form=,fieldset=" 1439 | ; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" 1440 | ; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry" 1441 | ; http://www.php.net/manual/en/session.configuration.php#ini.url-rewriter.tags 1442 | url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" 1443 | 1444 | [MSSQL] 1445 | ; Allow or prevent persistent links. 1446 | mssql.allow_persistent = On 1447 | 1448 | ; Maximum number of persistent links. -1 means no limit. 1449 | mssql.max_persistent = -1 1450 | 1451 | ; Maximum number of links (persistent+non persistent). -1 means no limit. 1452 | mssql.max_links = -1 1453 | 1454 | ; Minimum error severity to display. 1455 | mssql.min_error_severity = 10 1456 | 1457 | ; Minimum message severity to display. 1458 | mssql.min_message_severity = 10 1459 | 1460 | ; Compatibility mode with old versions of PHP 3.0. 1461 | mssql.compatability_mode = Off 1462 | 1463 | ; Connect timeout 1464 | ;mssql.connect_timeout = 5 1465 | 1466 | ; Query timeout 1467 | ;mssql.timeout = 60 1468 | 1469 | ; Valid range 0 - 2147483647. Default = 4096. 1470 | ;mssql.textlimit = 4096 1471 | 1472 | ; Valid range 0 - 2147483647. Default = 4096. 1473 | ;mssql.textsize = 4096 1474 | 1475 | ; Limits the number of records in each batch. 0 = all records in one batch. 1476 | ;mssql.batchsize = 0 1477 | 1478 | ; Specify how datetime and datetim4 columns are returned 1479 | ; On => Returns data converted to SQL server settings 1480 | ; Off => Returns values as YYYY-MM-DD hh:mm:ss 1481 | ;mssql.datetimeconvert = On 1482 | 1483 | ; Use NT authentication when connecting to the server 1484 | mssql.secure_connection = Off 1485 | 1486 | ; Specify max number of processes. -1 = library default 1487 | ; msdlib defaults to 25 1488 | ; FreeTDS defaults to 4096 1489 | ;mssql.max_procs = -1 1490 | 1491 | ; Specify client character set. 1492 | ; If empty or not set the client charset from freetds.comf is used 1493 | ; This is only used when compiled with FreeTDS 1494 | ;mssql.charset = "ISO-8859-1" 1495 | 1496 | [Assertion] 1497 | ; Assert(expr); active by default. 1498 | ; http://www.php.net/manual/en/info.configuration.php#ini.assert.active 1499 | ;assert.active = On 1500 | 1501 | ; Issue a PHP warning for each failed assertion. 1502 | ; http://www.php.net/manual/en/info.configuration.php#ini.assert.warning 1503 | ;assert.warning = On 1504 | 1505 | ; Don't bail out by default. 1506 | ; http://www.php.net/manual/en/info.configuration.php#ini.assert.bail 1507 | ;assert.bail = Off 1508 | 1509 | ; User-function to be called if an assertion fails. 1510 | ; http://www.php.net/manual/en/info.configuration.php#ini.assert.callback 1511 | ;assert.callback = 0 1512 | 1513 | ; Eval the expression with current error_reporting(). Set to true if you want 1514 | ; error_reporting(0) around the eval(). 1515 | ; http://www.php.net/manual/en/info.configuration.php#ini.assert.quiet-eval 1516 | ;assert.quiet_eval = 0 1517 | 1518 | [COM] 1519 | ; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs 1520 | ; http://www.php.net/manual/en/com.configuration.php#ini.com.typelib-file 1521 | ;com.typelib_file = 1522 | 1523 | ; allow Distributed-COM calls 1524 | ; http://www.php.net/manual/en/com.configuration.php#ini.com.allow-dcom 1525 | ;com.allow_dcom = true 1526 | 1527 | ; autoregister constants of a components typlib on com_load() 1528 | ; http://www.php.net/manual/en/com.configuration.php#ini.com.autoregister-typelib 1529 | ;com.autoregister_typelib = true 1530 | 1531 | ; register constants casesensitive 1532 | ; http://www.php.net/manual/en/com.configuration.php#ini.com.autoregister-casesensitive 1533 | ;com.autoregister_casesensitive = false 1534 | 1535 | ; show warnings on duplicate constant registrations 1536 | ; http://www.php.net/manual/en/com.configuration.php#ini.com.autoregister-verbose 1537 | ;com.autoregister_verbose = true 1538 | 1539 | [mbstring] 1540 | ; language for internal character representation. 1541 | ; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.language 1542 | ;mbstring.language = Japanese 1543 | 1544 | ; internal/script encoding. 1545 | ; Some encoding cannot work as internal encoding. 1546 | ; (e.g. SJIS, BIG5, ISO-2022-*) 1547 | ; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.internal-encoding 1548 | ;mbstring.internal_encoding = EUC-JP 1549 | 1550 | ; http input encoding. 1551 | ; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.http-input 1552 | ;mbstring.http_input = auto 1553 | 1554 | ; http output encoding. mb_output_handler must be 1555 | ; registered as output buffer to function 1556 | ; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.http-output 1557 | ;mbstring.http_output = SJIS 1558 | 1559 | ; enable automatic encoding translation according to 1560 | ; mbstring.internal_encoding setting. Input chars are 1561 | ; converted to internal encoding by setting this to On. 1562 | ; Note: Do _not_ use automatic encoding translation for 1563 | ; portable libs/applications. 1564 | ; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.encoding-translation 1565 | ;mbstring.encoding_translation = Off 1566 | 1567 | ; automatic encoding detection order. 1568 | ; auto means 1569 | ; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.detect-order 1570 | ;mbstring.detect_order = auto 1571 | 1572 | ; substitute_character used when character cannot be converted 1573 | ; one from another 1574 | ; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.substitute-character 1575 | ;mbstring.substitute_character = none; 1576 | 1577 | ; overload(replace) single byte functions by mbstring functions. 1578 | ; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), 1579 | ; etc. Possible values are 0,1,2,4 or combination of them. 1580 | ; For example, 7 for overload everything. 1581 | ; 0: No overload 1582 | ; 1: Overload mail() function 1583 | ; 2: Overload str*() functions 1584 | ; 4: Overload ereg*() functions 1585 | ; http://www.php.net/manual/en/mbstring.configuration.php#ini.mbstring.func-overload 1586 | ;mbstring.func_overload = 0 1587 | 1588 | ; enable strict encoding detection. 1589 | ;mbstring.strict_detection = Off 1590 | 1591 | ; This directive specifies the regex pattern of content types for which mb_output_handler() 1592 | ; is activated. 1593 | ; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml) 1594 | ;mbstring.http_output_conv_mimetype= 1595 | 1596 | [gd] 1597 | ; Tell the jpeg decode to ignore warnings and try to create 1598 | ; a gd image. The warning will then be displayed as notices 1599 | ; disabled by default 1600 | ; http://www.php.net/manual/en/image.configuration.php#ini.image.jpeg-ignore-warning 1601 | ;gd.jpeg_ignore_warning = 0 1602 | 1603 | [exif] 1604 | ; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. 1605 | ; With mbstring support this will automatically be converted into the encoding 1606 | ; given by corresponding encode setting. When empty mbstring.internal_encoding 1607 | ; is used. For the decode settings you can distinguish between motorola and 1608 | ; intel byte order. A decode setting cannot be empty. 1609 | ; http://www.php.net/manual/en/exif.configuration.php#ini.exif.encode-unicode 1610 | ;exif.encode_unicode = ISO-8859-15 1611 | 1612 | ; http://www.php.net/manual/en/exif.configuration.php#ini.exif.decode-unicode-motorola 1613 | ;exif.decode_unicode_motorola = UCS-2BE 1614 | 1615 | ; http://www.php.net/manual/en/exif.configuration.php#ini.exif.decode-unicode-intel 1616 | ;exif.decode_unicode_intel = UCS-2LE 1617 | 1618 | ; http://www.php.net/manual/en/exif.configuration.php#ini.exif.encode-jis 1619 | ;exif.encode_jis = 1620 | 1621 | ; http://www.php.net/manual/en/exif.configuration.php#ini.exif.decode-jis-motorola 1622 | ;exif.decode_jis_motorola = JIS 1623 | 1624 | ; http://www.php.net/manual/en/exif.configuration.php#ini.exif.decode-jis-intel 1625 | ;exif.decode_jis_intel = JIS 1626 | 1627 | [Tidy] 1628 | ; The path to a default tidy configuration file to use when using tidy 1629 | ; http://www.php.net/manual/en/tidy.configuration.php#ini.tidy.default-config 1630 | ;tidy.default_config = /usr/local/lib/php/default.tcfg 1631 | 1632 | ; Should tidy clean and repair output automatically? 1633 | ; WARNING: Do not use this option if you are generating non-html content 1634 | ; such as dynamic images 1635 | ; http://www.php.net/manual/en/tidy.configuration.php#ini.tidy.clean-output 1636 | tidy.clean_output = Off 1637 | 1638 | [soap] 1639 | ; Enables or disables WSDL caching feature. 1640 | ; http://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-enabled 1641 | soap.wsdl_cache_enabled=1 1642 | 1643 | ; Sets the directory name where SOAP extension will put cache files. 1644 | ; http://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-dir 1645 | soap.wsdl_cache_dir="/tmp" 1646 | 1647 | ; (time to live) Sets the number of second while cached file will be used 1648 | ; instead of original one. 1649 | ; http://www.php.net/manual/en/soap.configuration.php#ini.soap.wsdl-cache-ttl 1650 | soap.wsdl_cache_ttl=86400 1651 | 1652 | [sysvshm] 1653 | ; A default size of the shared memory segment 1654 | ;sysvshm.init_mem = 10000 1655 | 1656 | 1657 | ; Local Variables: 1658 | ; tab-width: 4 1659 | ; End: 1660 | -------------------------------------------------------------------------------- /salt/php/init.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - apache 3 | 4 | php: 5 | pkg.installed: 6 | - name: php 7 | file.managed: 8 | - name: /etc/php.ini 9 | - source: salt://php/files/etc/php.ini 10 | - require: 11 | - pkg: php 12 | - watch_in: 13 | - service: apache 14 | -------------------------------------------------------------------------------- /salt/salt/files/etc/salt/minion: -------------------------------------------------------------------------------- 1 | ##### Primary configuration settings ##### 2 | ########################################## 3 | 4 | # Per default the minion will automatically include all config files 5 | # from minion.d/*.conf (minion.d is a directory in the same directory 6 | # as the main minion config file). 7 | #default_include: minion.d/*.conf 8 | 9 | # Set the location of the salt master server, if the master server cannot be 10 | # resolved, then the minion will fail to start. 11 | #master: salt 12 | master: {{master}} 13 | 14 | # Set the number of seconds to wait before attempting to resolve 15 | # the master hostname if name resolution fails. Defaults to 30 seconds. 16 | # Set to zero if the minion should shutdown and not retry. 17 | # retry_dns: 30 18 | 19 | # Set the port used by the master reply and authentication server 20 | #master_port: 4506 21 | 22 | # The user to run salt 23 | #user: root 24 | 25 | # Specify the location of the daemon process ID file 26 | #pidfile: /var/run/salt-minion.pid 27 | 28 | # The root directory prepended to these options: pki_dir, cachedir, log_file, 29 | # sock_dir, pidfile. 30 | #root_dir: / 31 | 32 | # The directory to store the pki information in 33 | #pki_dir: /etc/salt/pki/minion 34 | 35 | # Explicitly declare the id for this minion to use, if left commented the id 36 | # will be the hostname as returned by the python call: socket.getfqdn() 37 | # Since salt uses detached ids it is possible to run multiple minions on the 38 | # same machine but with different ids, this can be useful for salt compute 39 | # clusters. 40 | #id: 41 | 42 | # Append a domain to a hostname in the event that it does not exist. This is 43 | # useful for systems where socket.getfqdn() does not actually result in a 44 | # FQDN (for instance, Solaris). 45 | #append_domain: 46 | 47 | # Custom static grains for this minion can be specified here and used in SLS 48 | # files just like all other grains. This example sets 4 custom grains, with 49 | # the 'roles' grain having two values that can be matched against: 50 | #grains: 51 | # roles: 52 | # - webserver 53 | # - memcache 54 | # deployment: datacenter4 55 | # cabinet: 13 56 | # cab_u: 14-15 57 | 58 | # Where cache data goes 59 | #cachedir: /var/cache/salt/minion 60 | 61 | # Verify and set permissions on configuration directories at startup 62 | #verify_env: True 63 | 64 | # The minion can locally cache the return data from jobs sent to it, this 65 | # can be a good way to keep track of jobs the minion has executed 66 | # (on the minion side). By default this feature is disabled, to enable 67 | # set cache_jobs to True 68 | #cache_jobs: False 69 | 70 | # set the directory used to hold unix sockets 71 | #sock_dir: /var/run/salt/minion 72 | 73 | # Set the default outputter used by the salt-call command. The default is 74 | # "nested" 75 | #output: nested 76 | # 77 | # By default output is colored, to disable colored output set the color value 78 | # to False 79 | #color: True 80 | 81 | # Backup files that are replaced by file.managed and file.recurse under 82 | # 'cachedir'/file_backups relative to their original location and appended 83 | # with a timestamp. The only valid setting is "minion". Disabled by default. 84 | # 85 | # Alternatively this can be specified for each file in state files: 86 | # 87 | # /etc/ssh/sshd_config: 88 | # file.managed: 89 | # - source: salt://ssh/sshd_config 90 | # - backup: minion 91 | # 92 | #backup_mode: minion 93 | 94 | # When waiting for a master to accept the minion's public key, salt will 95 | # continuously attempt to reconnect until successful. This is the time, in 96 | # seconds, between those reconnection attempts. 97 | #acceptance_wait_time: 10 98 | 99 | # The loop_interval sets how long in seconds the minion will wait between 100 | # evaluating the scheduler and running cleanup tasks. This defaults to a 101 | # sane 60 seconds, but if the minion scheduler needs to be evaluated more 102 | # often lower this value 103 | #loop_interval: 60 104 | 105 | # When healing, a dns_check is run. This is to make sure that the originally 106 | # resolved dns has not changed. If this is something that does not happen in 107 | # your environment, set this value to False. 108 | #dns_check: True 109 | 110 | # Windows platforms lack posix IPC and must rely on slower TCP based inter- 111 | # process communications. Set ipc_mode to 'tcp' on such systems 112 | #ipc_mode: ipc 113 | # 114 | # Overwrite the default tcp ports used by the minion when in tcp mode 115 | #tcp_pub_port: 4510 116 | #tcp_pull_port: 4511 117 | 118 | # The minion can include configuration from other files. To enable this, 119 | # pass a list of paths to this option. The paths can be either relative or 120 | # absolute; if relative, they are considered to be relative to the directory 121 | # the main minion configuration file lives in (this file). Paths can make use 122 | # of shell-style globbing. If no files are matched by a path passed to this 123 | # option then the minion will log a warning message. 124 | # 125 | # 126 | # Include a config file from some other path: 127 | # include: /etc/salt/extra_config 128 | # 129 | # Include config from several files and directories: 130 | # include: 131 | # - /etc/salt/extra_config 132 | # - /etc/roles/webserver 133 | 134 | ##### Minion module management ##### 135 | ########################################## 136 | # Disable specific modules. This allows the admin to limit the level of 137 | # access the master has to the minion 138 | #disable_modules: [cmd,test] 139 | #disable_returners: [] 140 | # 141 | # Modules can be loaded from arbitrary paths. This enables the easy deployment 142 | # of third party modules. Modules for returners and minions can be loaded. 143 | # Specify a list of extra directories to search for minion modules and 144 | # returners. These paths must be fully qualified! 145 | #module_dirs: [] 146 | #returner_dirs: [] 147 | #states_dirs: [] 148 | #render_dirs: [] 149 | # 150 | # A module provider can be statically overwritten or extended for the minion 151 | # via the providers option, in this case the default module will be 152 | # overwritten by the specified module. In this example the pkg module will 153 | # be provided by the yumpkg5 module instead of the system default. 154 | # 155 | # providers: 156 | # pkg: yumpkg5 157 | # 158 | # Enable Cython modules searching and loading. (Default: False) 159 | #cython_enable: False 160 | # 161 | 162 | ##### State Management Settings ##### 163 | ########################################### 164 | # The state management system executes all of the state templates on the minion 165 | # to enable more granular control of system state management. The type of 166 | # template and serialization used for state management needs to be configured 167 | # on the minion, the default renderer is yaml_jinja. This is a yaml file 168 | # rendered from a jinja template, the available options are: 169 | # yaml_jinja 170 | # yaml_mako 171 | # yaml_wempy 172 | # json_jinja 173 | # json_mako 174 | # json_wempy 175 | # 176 | #renderer: yaml_jinja 177 | # 178 | # The failhard option tells the minions to stop immediately after the first 179 | # failure detected in the state execution, defaults to False 180 | #failhard: False 181 | # 182 | # autoload_dynamic_modules Turns on automatic loading of modules found in the 183 | # environments on the master. This is turned on by default, to turn of 184 | # autoloading modules when states run set this value to False 185 | #autoload_dynamic_modules: True 186 | # 187 | # clean_dynamic_modules keeps the dynamic modules on the minion in sync with 188 | # the dynamic modules on the master, this means that if a dynamic module is 189 | # not on the master it will be deleted from the minion. By default this is 190 | # enabled and can be disabled by changing this value to False 191 | #clean_dynamic_modules: True 192 | # 193 | # Normally the minion is not isolated to any single environment on the master 194 | # when running states, but the environment can be isolated on the minion side 195 | # by statically setting it. Remember that the recommended way to manage 196 | # environments is to isolate via the top file. 197 | #environment: None 198 | # 199 | # If using the local file directory, then the state top file name needs to be 200 | # defined, by default this is top.sls. 201 | #state_top: top.sls 202 | # 203 | # Run states when the minion daemon starts. To enable, set startup_states to: 204 | # 'highstate' -- Execute state.highstate 205 | # 'sls' -- Read in the sls_list option and execute the named sls files 206 | # 'top' -- Read top_file option and execute based on that file on the Master 207 | #startup_states: '' 208 | # 209 | # list of states to run when the minion starts up if startup_states is 'sls' 210 | #sls_list: 211 | # - edit.vim 212 | # - hyper 213 | # 214 | # top file to execute if startup_states is 'top' 215 | #top_file: '' 216 | 217 | ##### File Directory Settings ##### 218 | ########################################## 219 | # The Salt Minion can redirect all file server operations to a local directory, 220 | # this allows for the same state tree that is on the master to be used if 221 | # copied completely onto the minion. This is a literal copy of the settings on 222 | # the master but used to reference a local directory on the minion. 223 | 224 | # Set the file client, the client defaults to looking on the master server for 225 | # files, but can be directed to look at the local file directory setting 226 | # defined below by setting it to local. 227 | #file_client: remote 228 | 229 | # The file directory works on environments passed to the minion, each environment 230 | # can have multiple root directories, the subdirectories in the multiple file 231 | # roots cannot match, otherwise the downloaded files will not be able to be 232 | # reliably ensured. A base environment is required to house the top file. 233 | # Example: 234 | # file_roots: 235 | # base: 236 | # - /srv/salt/ 237 | # dev: 238 | # - /srv/salt/dev/services 239 | # - /srv/salt/dev/states 240 | # prod: 241 | # - /srv/salt/prod/services 242 | # - /srv/salt/prod/states 243 | # 244 | # Default: 245 | #file_roots: 246 | # base: 247 | # - /srv/salt 248 | 249 | # The hash_type is the hash to use when discovering the hash of a file in 250 | # the minion directory, the default is md5, but sha1, sha224, sha256, sha384 251 | # and sha512 are also supported. 252 | #hash_type: md5 253 | 254 | # The Salt pillar is searched for locally if file_client is set to local. If 255 | # this is the case, and pillar data is defined, then the pillar_roots need to 256 | # also be configured on the minion: 257 | #pillar_roots: 258 | # base: 259 | # - /srv/pillar 260 | 261 | ###### Security settings ##### 262 | ########################################### 263 | # Enable "open mode", this mode still maintains encryption, but turns off 264 | # authentication, this is only intended for highly secure environments or for 265 | # the situation where your keys end up in a bad state. If you run in open mode 266 | # you do so at your own risk! 267 | #open_mode: False 268 | 269 | # Enable permissive access to the salt keys. This allows you to run the 270 | # master or minion as root, but have a non-root group be given access to 271 | # your pki_dir. To make the access explicit, root must belong to the group 272 | # you've given access to. This is potentially quite insecure. 273 | #permissive_pki_access: False 274 | 275 | # The state_verbose and state_output settings can be used to change the way 276 | # state system data is printed to the display. By default all data is printed. 277 | # The state_verbose setting can be set to True or False, when set to False 278 | # all data that has a result of True and no changes will be suppressed. 279 | #state_verbose: True 280 | # 281 | # The state_output setting changes if the output is the full multi line 282 | # output for each changed state if set to 'full', but if set to 'terse' 283 | # the output will be shortened to a single line. 284 | #state_output: full 285 | # 286 | # Fingerprint of the master public key to double verify the master is valid, 287 | # the master fingerprint can be found by running "salt-key -F master" on the 288 | # salt master. 289 | #master_finger: '' 290 | 291 | ###### Thread settings ##### 292 | ########################################### 293 | # Disable multiprocessing support, by default when a minion receives a 294 | # publication a new process is spawned and the command is executed therein. 295 | #multiprocessing: True 296 | 297 | ##### Logging settings ##### 298 | ########################################## 299 | # The location of the minion log file 300 | # The minion log can be sent to a regular file, local path name, or network 301 | # location. Remote logging works best when configured to use rsyslogd(8) (e.g.: 302 | # ``file:///dev/log``), with rsyslogd(8) configured for network logging. The URI 303 | # format is: ://:/ 304 | #log_file: /var/log/salt/minion 305 | #log_file: file:///dev/log 306 | #log_file: udp://loghost:10514 307 | # 308 | #log_file: /var/log/salt/minion 309 | #key_logfile: /var/log/salt/key 310 | # 311 | # The level of messages to send to the console. 312 | # One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. 313 | # Default: 'warning' 314 | #log_level: warning 315 | # 316 | # The level of messages to send to the log file. 317 | # One of 'garbage', 'trace', 'debug', info', 'warning', 'error', 'critical'. 318 | # Default: 'warning' 319 | #log_level_logfile: 320 | 321 | # The date and time format used in log messages. Allowed date/time formating 322 | # can be seen here: http://docs.python.org/library/time.html#time.strftime 323 | #log_datefmt: '%H:%M:%S' 324 | #log_datefmt_logfile: '%Y-%m-%d %H:%M:%S' 325 | # 326 | # The format of the console logging messages. Allowed formatting options can 327 | # be seen here: http://docs.python.org/library/logging.html#logrecord-attributes 328 | #log_fmt_console: '[%(levelname)-8s] %(message)s' 329 | #log_fmt_logfile: '%(asctime)s,%(msecs)03.0f [%(name)-17s][%(levelname)-8s] %(message)s' 330 | # 331 | # This can be used to control logging levels more specificically. This 332 | # example sets the main salt library at the 'warning' level, but sets 333 | # 'salt.modules' to log at the 'debug' level: 334 | # log_granular_levels: 335 | # 'salt': 'warning', 336 | # 'salt.modules': 'debug' 337 | # 338 | #log_granular_levels: {} 339 | 340 | ###### Module configuration ##### 341 | ########################################### 342 | # Salt allows for modules to be passed arbitrary configuration data, any data 343 | # passed here in valid yaml format will be passed on to the salt minion modules 344 | # for use. It is STRONGLY recommended that a naming convention be used in which 345 | # the module name is followed by a . and then the value. Also, all top level 346 | # data must be applied via the yaml dict construct, some examples: 347 | # 348 | # You can specify that all modules should run in test mode: 349 | #test: True 350 | # 351 | # A simple value for the test module: 352 | #test.foo: foo 353 | # 354 | # A list for the test module: 355 | #test.bar: [baz,quo] 356 | # 357 | # A dict for the test module: 358 | #test.baz: {spam: sausage, cheese: bread} 359 | 360 | 361 | ###### Update settings ###### 362 | ########################################### 363 | # Using the features in Esky, a salt minion can both run as a frozen app and 364 | # be updated on the fly. These options control how the update process 365 | # (saltutil.update()) behaves. 366 | # 367 | # The url for finding and downloading updates. Disabled by default. 368 | #update_url: False 369 | # 370 | # The list of services to restart after a successful update. Empty by default. 371 | #update_restart_services: [] 372 | 373 | 374 | ###### Keepalive settings ###### 375 | ############################################ 376 | # ZeroMQ now includes support for configuring SO_KEEPALIVE if supported by 377 | # the OS. If connections between the minion and the master pass through 378 | # a state tracking device such as a firewall or VPN gateway, there is 379 | # the risk that it could tear down the connection the master and minion 380 | # without informing either party that their connection has been taken away. 381 | # Enabling TCP Keepalives prevents this from happening. 382 | # 383 | # Overall state of TCP Keepalives, enable (1 or True), disable (0 or False) 384 | # or leave to the OS defaults (-1), on Linux, typically disabled. Default True, enabled. 385 | #tcp_keepalive: True 386 | # 387 | # How long before the first keepalive should be sent in seconds. Default 300 388 | # to send the first keepalive after 5 minutes, OS default (-1) is typically 7200 seconds 389 | # on Linux see /proc/sys/net/ipv4/tcp_keepalive_time. 390 | #tcp_keepalive_idle: 300 391 | # 392 | # How many lost probes are needed to consider the connection lost. Default -1 393 | # to use OS defaults, typically 9 on Linux, see /proc/sys/net/ipv4/tcp_keepalive_probes. 394 | #tcp_keepalive_cnt: -1 395 | # 396 | # How often, in seconds, to send keepalives after the first one. Default -1 to 397 | # use OS defaults, typically 75 seconds on Linux, see 398 | # /proc/sys/net/ipv4/tcp_keepalive_intvl. 399 | #tcp_keepalive_intvl: -1 400 | 401 | 402 | ###### Windows Software settings ###### 403 | ############################################ 404 | # Location of the repository cache file on the master 405 | # win_repo_cachefile: 'salt://win/repo/winrepo.p' 406 | -------------------------------------------------------------------------------- /salt/salt/master.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - salt.minion 3 | 4 | salt-master: 5 | pkg.installed: 6 | - name: salt-master 7 | file.managed: 8 | - name: /etc/salt/master 9 | - require: 10 | - pkg: salt-master 11 | service.running: 12 | - enable: True 13 | - watch: 14 | - pkg: salt-master 15 | - file: salt-master 16 | 17 | salt-master-role: 18 | file.append: 19 | - name: /etc/salt/roles 20 | - text: 21 | - 'salt-master' 22 | - require: 23 | - file: roles 24 | - service: salt-master 25 | - service: salt-minion 26 | - watch_in: 27 | - module: sync_grains 28 | -------------------------------------------------------------------------------- /salt/salt/minion.sls: -------------------------------------------------------------------------------- 1 | salt-minion: 2 | pkg.installed: 3 | - name: salt-minion 4 | file.managed: 5 | - name: /etc/salt/minion 6 | - source: salt://salt/files/etc/salt/minion 7 | - template: jinja 8 | - defaults: 9 | master: salt-test-01 10 | - require: 11 | - pkg: salt-minion 12 | service.running: 13 | - enable: True 14 | - watch: 15 | - pkg: salt-minion 16 | - file: salt-minion 17 | 18 | roles: 19 | file.managed: 20 | - name: /etc/salt/roles 21 | 22 | sync_grains: 23 | module.wait: 24 | - name: saltutil.sync_grains 25 | 26 | mine_update: 27 | module.run: 28 | - name: mine.update 29 | - require: 30 | - module: sync_grains 31 | 32 | salt-minion-role: 33 | file.append: 34 | - name: /etc/salt/roles 35 | - text: 36 | - 'salt-minion' 37 | - require: 38 | - file: roles 39 | - service: salt-minion 40 | - watch_in: 41 | - module: sync_grains 42 | -------------------------------------------------------------------------------- /salt/top.sls: -------------------------------------------------------------------------------- 1 | base: 2 | '*': 3 | - base 4 | - salt.minion 5 | - zabbix.agent 6 | 'salt-test-01': 7 | - salt.master 8 | - mysql.server 9 | - zabbix.server 10 | - zabbix.web 11 | 'salt-test-02': 12 | - zabbix.api 13 | 'salt-test-03': 14 | - memcached 15 | -------------------------------------------------------------------------------- /salt/zabbix/agent.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - salt.minion 3 | 4 | zabbix-agent: 5 | pkg.installed: 6 | - name: zabbix20-agent 7 | file.managed: 8 | - name: /etc/zabbix_agentd.conf 9 | - source: salt://zabbix/files/etc/zabbix_agentd.conf 10 | - template: jinja 11 | - defaults: 12 | Server: {{ pillar['zabbix-agent']['Zabbix_Server'] }} 13 | - require: 14 | - pkg: zabbix-agent 15 | service.running: 16 | - enable: True 17 | - watch: 18 | - pkg: zabbix-agent 19 | - file: zabbix-agent 20 | 21 | zabbix-agent-role: 22 | file.append: 23 | - name: /etc/salt/roles 24 | - text: 25 | - 'zabbix-agent' 26 | - require: 27 | - file: roles 28 | - service: zabbix-agent 29 | - service: salt-minion 30 | - watch_in: 31 | - module: sync_grains 32 | 33 | 34 | zabbix_agentd_conf-link: 35 | file.symlink: 36 | - name: /etc/zabbix/zabbix_agentd.conf 37 | - target: /etc/zabbix_agentd.conf 38 | - require_in: 39 | - service: zabbix-agent 40 | - require: 41 | - pkg: zabbix-agent 42 | - file: zabbix-agent 43 | 44 | zabbix_agentd.conf.d: 45 | file.directory: 46 | - name: /etc/zabbix/zabbix_agentd.conf.d 47 | - watch_in: 48 | - service: zabbix-agent 49 | - require: 50 | - pkg: zabbix-agent 51 | - file: zabbix-agent 52 | 53 | -------------------------------------------------------------------------------- /salt/zabbix/api.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - salt.minion 3 | 4 | python-zabbix-zapi: 5 | file.recurse: 6 | - name: /usr/lib/python2.6/site-packages/zabbix 7 | - source: salt://zabbix/files/usr/lib/python2.6/site-packages/zabbix 8 | - include_empty: True 9 | 10 | 11 | zabbix-api-role: 12 | file.append: 13 | - name: /etc/salt/roles 14 | - text: 15 | - 'zabbix-api' 16 | - require: 17 | - file: roles 18 | - service: salt-minion 19 | - file: python-zabbix-zapi 20 | - watch_in: 21 | - module: sync_grains 22 | 23 | zabbix-api-config: 24 | file.managed: 25 | - name: /etc/zabbix/api/config.yaml 26 | - source: salt://zabbix/files/etc/zabbix/api/config.yaml 27 | - makedirs: True 28 | - template: jinja 29 | - defaults: 30 | Hostgroup: {{pillar['zabbix-api']['Hostgroup']}} 31 | Monitors_DIR: {{pillar['zabbix-api']['Monitors_DIR']}} 32 | Templates_DIR: {{pillar['zabbix-api']['Templates_DIR']}} 33 | Zabbix_User: {{pillar['zabbix-api']['Zabbix_User']}} 34 | Zabbix_Pass: {{pillar['zabbix-api']['Zabbix_Pass']}} 35 | Zabbix_URL: {{pillar['zabbix-api']['Zabbix_URL']}} 36 | 37 | zabbix-templates: 38 | file.recurse: 39 | - name: {{pillar['zabbix-api']['Templates_DIR']}} 40 | - source: salt://zabbix/files/etc/zabbix/api/templates 41 | - require: 42 | - file: python-zabbix-zapi 43 | - file: zabbix-api-config 44 | 45 | zabbix-add-monitors-script: 46 | file.managed: 47 | - name: /etc/zabbix/api/add_monitors.py 48 | - source: salt://zabbix/files/etc/zabbix/api/add_monitors.py 49 | - makedirs: True 50 | - mode: 755 51 | - require: 52 | - file: python-zabbix-zapi 53 | - file: zabbix-api-config 54 | 55 | {% for each_minion, each_mine in salt['mine.get']('*', 'grains.item').iteritems() %} 56 | monitor-{{each_minion}}: 57 | file.managed: 58 | - name: {{pillar['zabbix-api']['Monitors_DIR']}}/{{each_minion}} 59 | - source: salt://zabbix/files/etc/zabbix/api/monitors/minion 60 | - makedirs: True 61 | - template: jinja 62 | - defaults: 63 | IP: {{each_mine.ipv4[1]}} 64 | Roles: {{each_mine.roles}} 65 | Templates: {{pillar['zabbix-templates']}} 66 | - order: last 67 | - require: 68 | - module: mine_update 69 | cmd.wait: 70 | - name: python /etc/zabbix/api/add_monitors.py {{each_minion}} 71 | - require: 72 | - file: zabbix-add-monitors-script 73 | - watch: 74 | - file: monitor-{{each_minion}} 75 | {% endfor %} 76 | -------------------------------------------------------------------------------- /salt/zabbix/files/etc/zabbix/api/add_monitors.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | #coding=utf8 3 | 4 | ########################################################## 5 | # Add Monitor To Zabbix 6 | # 7 | # Author: pengyao 8 | # Date: 2013-06-19 9 | ########################################################## 10 | 11 | import sys, os.path 12 | import yaml 13 | 14 | from zabbix.zapi import * 15 | from zabbix.zapi import ZabbixAPI 16 | 17 | def _config(config_file): 18 | '''get config''' 19 | 20 | config_fd = open(config_file) 21 | config = yaml.load(config_fd) 22 | 23 | return config 24 | 25 | def _get_templates(api_obj, templates_list): 26 | '''get templates ids''' 27 | 28 | templates_id = {} 29 | templates_result = api_obj.Template.getobjects({"host": templates_list}) 30 | 31 | for each_template in templates_result: 32 | template_name = each_template['name'] 33 | template_id = each_template['templateid'] 34 | templates_id[template_name] = template_id 35 | 36 | return templates_id 37 | 38 | def _get_host_templates(api_obj, hostid): 39 | '''get the host has linked templates''' 40 | 41 | templates_id = [] 42 | templates_result = api_obj.Template.get({'hostids': hostid}) 43 | 44 | for each_template in templates_result: 45 | template_id = each_template['templateid'] 46 | templates_id.append(template_id) 47 | 48 | return templates_id 49 | 50 | 51 | def _create_hostgroup(api_obj, group_name): 52 | '''create hostgroup''' 53 | 54 | ##check hostgroup exists 55 | hostgroup_status = api_obj.Hostgroup.exists({"name": "%s" %(group_name)}) 56 | if hostgroup_status: 57 | print "Hostgroup(%s) is already exists" %(group_name) 58 | group_id = api_obj.Hostgroup.getobjects({"name": "%s" %(group_name)})[0]["groupid"] 59 | else: 60 | hostgroup_status = api_obj.Hostgroup.create({"name": "%s" %(group_name)}) 61 | if hostgroup_status: 62 | print "Hostgroup(%s) create success" %(group_name) 63 | group_id = hostgroup_status["groupids"][0] 64 | else: 65 | sys.stderr.write("Hostgroup(%s) create failed, please connect administrator\n" %(group_name)) 66 | exit(2) 67 | 68 | return group_id 69 | 70 | def _create_host(api_obj, hostname, hostip, group_id): 71 | '''create host''' 72 | 73 | ##check host exists 74 | host_status = api_obj.Host.exists({"name": "%s" %(hostname)}) 75 | if host_status: 76 | print "Host(%s) is already exists" %(hostname) 77 | hostid = api_obj.Host.getobjects({"name": "%s" %(hostname)})[0]["hostid"] 78 | else: 79 | host_status = api_obj.Host.create({"host": "%s" %(hostname), "interfaces": [{"type": 1, "main": 1, "useip": 1, "ip": "%s" %(hostip), "dns": "", "port": "10050"}], "groups": [{"groupid": "%s" %(group_id)}]}) 80 | if host_status: 81 | print "Host(%s) create success" %(hostname) 82 | hostid = host_status["hostids"][0] 83 | else: 84 | sys.stderr.write("Host(%s) create failed, please connect administrator\n" %(hostname)) 85 | exit(3) 86 | 87 | return hostid 88 | 89 | def _link_templates(api_obj, hostname, hostid, templates_list): 90 | '''link templates''' 91 | 92 | all_templates = [] 93 | ##get templates id 94 | templates_id = _get_templates(api_obj, templates_list) 95 | ##get the host currently linked tempaltes 96 | curr_linked_templates = _get_host_templates(api_obj, hostid) 97 | 98 | for each_template in templates_id: 99 | if templates_id[each_template] in curr_linked_templates: 100 | print "Host(%s) is already linked %s" %(hostname, each_template) 101 | else: 102 | print "Host(%s) will link %s" %(hostname, each_template) 103 | all_templates.append(templates_id[each_template]) 104 | 105 | ##merge templates list 106 | for each_template in curr_linked_templates: 107 | if each_template not in all_templates: 108 | all_templates.append(each_template) 109 | 110 | ##convert to zabbix api style 111 | templates_list = [] 112 | for each_template in all_templates: 113 | templates_list.append({"templateid": each_template}) 114 | 115 | 116 | ##update host to link templates 117 | update_status = api_obj.Host.update({"hostid": hostid, "templates": templates_list}) 118 | 119 | if update_status: 120 | print "Host(%s) link templates success" %(hostname) 121 | else: 122 | print "Host(%s) link templates failed, please contact administrator" %(hostname) 123 | 124 | 125 | def _main(): 126 | '''main function''' 127 | 128 | hosts = [] 129 | if len(sys.argv) > 1: 130 | hosts = sys.argv[1:] 131 | 132 | config_dir = os.path.dirname(sys.argv[0]) 133 | if config_dir: 134 | config_file = config_dir+"/"+"config.yaml" 135 | else: 136 | config_file = "config.yaml" 137 | 138 | ###get config options 139 | config = _config(config_file) 140 | Monitor_DIR = config["Monitors_DIR"] 141 | Hostgroup = config["Hostgroup"] 142 | Zabbix_URL = config["Zabbix_URL"] 143 | Zabbix_User = config["Zabbix_User"] 144 | Zabbix_Pass = config["Zabbix_Pass"] 145 | 146 | if not hosts: 147 | hosts = os.listdir(Monitor_DIR) 148 | 149 | ###Login Zabbix 150 | zapi = ZabbixAPI(url=Zabbix_URL, user=Zabbix_User, password=Zabbix_Pass) 151 | zapi.login() 152 | 153 | ###Create Hostgroup 154 | group_id = _create_hostgroup(zapi, Hostgroup) 155 | 156 | 157 | for each_host in hosts: 158 | each_config_fd = open(Monitor_DIR+"/"+each_host) 159 | each_config = yaml.load(each_config_fd) 160 | 161 | ##Get config options 162 | each_ip = each_config["IP"] 163 | each_templates = each_config["Templates"] 164 | 165 | ##Create Host 166 | hostid = _create_host(zapi, each_host, each_ip, group_id) 167 | 168 | if each_templates: 169 | ##Link tempaltes 170 | _link_templates(zapi, each_host, hostid, each_templates) 171 | 172 | 173 | 174 | if __name__ == "__main__": 175 | _main() 176 | 177 | -------------------------------------------------------------------------------- /salt/zabbix/files/etc/zabbix/api/config.yaml: -------------------------------------------------------------------------------- 1 | Hostgroup: {{Hostgroup}} 2 | Monitors_DIR: {{Monitors_DIR}} 3 | Templates_DIR: {{Templates_DIR}} 4 | Zabbix_URL: {{Zabbix_URL}} 5 | Zabbix_User: {{Zabbix_User}} 6 | Zabbix_Pass: {{Zabbix_Pass}} 7 | 8 | -------------------------------------------------------------------------------- /salt/zabbix/files/etc/zabbix/api/monitors/minion: -------------------------------------------------------------------------------- 1 | IP: {{IP}} 2 | Templates: 3 | {% for each_role in Roles -%} 4 | {% if each_role in Templates -%} 5 | - {{ pillar['zabbix-templates'][each_role] }} 6 | {% endif -%} 7 | {% endfor -%} 8 | 9 | -------------------------------------------------------------------------------- /salt/zabbix/files/etc/zabbix/api/templates/Template_memacached.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | 1 7 | 8 | 127.0.0.1 9 | 10050 10 | 3 11 | 0 12 | 127.0.0.1 13 | 623 14 | 0 15 | 2 16 | 17 | 18 | 19 | Templates 20 | 21 | 22 | 23 | Memcached has been restarted on {HOSTNAME} 24 | 0 25 | {Template_Memcached:memcached[uptime,127.0.0.1,11211].last(0)}<3600 26 | 27 | 0 28 | 2 29 | Memcached has been restarted. 30 | 31 | It has been stopped / shutdown or has crashed. 32 | Check on the server for more details: 33 | - w / last 34 | - dmesg logs 35 | - /var/log/messages 36 | - memcached error logs 37 | 38 | 39 | Memcached is not running on {HOSTNAME} 40 | 0 41 | {Template_Memcached:proc.num[memcached,,,11211].last(0)}=0 42 | 43 | 0 44 | 3 45 | Memcached is not running. 46 | 47 | It has been stopped / shutdown or has crashed. 48 | Check on the server for more details: 49 | - w / last 50 | - dmesg logs 51 | - /var/log/messages 52 | - memcached error logs 53 | 54 | 55 | 56 | 57 | Memcached $1 58 | 59 | 300 60 | 90 61 | 365 62 | 0 63 | 0 64 | b 65 | 0 66 | 0 67 | 1 68 | 0 69 | 70 | 71 | 0 72 | 73 | 74 | 75 | 76 | 77 | 78 | public 79 | interfaces.ifTable.ifEntry.ifInOctets.1 80 | 161 81 | 82 | 0 83 | 84 | 85 | 86 | Memcached 87 | 88 | 89 | 90 | Memcached $1 91 | 92 | 300 93 | 90 94 | 365 95 | 0 96 | 0 97 | b 98 | 0 99 | 1 100 | 1 101 | 0 102 | 103 | 104 | 0 105 | 106 | 107 | 108 | 109 | 110 | 111 | public 112 | interfaces.ifTable.ifEntry.ifInOctets.1 113 | 161 114 | 115 | 0 116 | 117 | 118 | 119 | Memcached 120 | 121 | 122 | 123 | Memcached $1 124 | 125 | 300 126 | 90 127 | 365 128 | 0 129 | 0 130 | b 131 | 0 132 | 1 133 | 1 134 | 0 135 | 136 | 137 | 0 138 | 139 | 140 | 141 | 142 | 143 | 144 | public 145 | interfaces.ifTable.ifEntry.ifInOctets.1 146 | 161 147 | 148 | 0 149 | 150 | 151 | 152 | Memcached 153 | 154 | 155 | 156 | Memcached $1 157 | 158 | 300 159 | 90 160 | 365 161 | 0 162 | 0 163 | 164 | 0 165 | 1 166 | 1 167 | 0 168 | 169 | 170 | 0 171 | 172 | 173 | 174 | 175 | 176 | 177 | public 178 | interfaces.ifTable.ifEntry.ifInOctets.1 179 | 161 180 | 181 | 0 182 | 183 | 184 | 185 | Memcached 186 | 187 | 188 | 189 | Memcached $1 190 | 191 | 300 192 | 90 193 | 365 194 | 0 195 | 0 196 | 197 | 0 198 | 1 199 | 1 200 | 0 201 | 202 | 203 | 0 204 | 205 | 206 | 207 | 208 | 209 | 210 | public 211 | interfaces.ifTable.ifEntry.ifInOctets.1 212 | 161 213 | 214 | 0 215 | 216 | 217 | 218 | Memcached 219 | 220 | 221 | 222 | Memcached $1 223 | 224 | 300 225 | 90 226 | 365 227 | 0 228 | 0 229 | 230 | 0 231 | 0 232 | 1 233 | 0 234 | 235 | 236 | 0 237 | 238 | 239 | 240 | 241 | 242 | 243 | public 244 | interfaces.ifTable.ifEntry.ifInOctets.1 245 | 161 246 | 247 | 0 248 | 249 | 250 | 251 | Memcached 252 | 253 | 254 | 255 | Memcached $1 256 | 257 | 300 258 | 90 259 | 365 260 | 0 261 | 0 262 | 263 | 0 264 | 0 265 | 1 266 | 0 267 | 268 | 269 | 0 270 | 271 | 272 | 273 | 274 | 275 | 276 | public 277 | interfaces.ifTable.ifEntry.ifInOctets.1 278 | 161 279 | 280 | 0 281 | 282 | 283 | 284 | Memcached 285 | 286 | 287 | 288 | Memcached $1 289 | 290 | 300 291 | 90 292 | 365 293 | 0 294 | 0 295 | 296 | 0 297 | 1 298 | 1 299 | 0 300 | 301 | 302 | 0 303 | 304 | 305 | 306 | 307 | 308 | 309 | public 310 | interfaces.ifTable.ifEntry.ifInOctets.1 311 | 161 312 | 313 | 0 314 | 315 | 316 | 317 | Memcached 318 | 319 | 320 | 321 | Memcached $1 322 | 323 | 300 324 | 90 325 | 365 326 | 0 327 | 0 328 | 329 | 0 330 | 1 331 | 1 332 | 0 333 | 334 | 335 | 0 336 | 337 | 338 | 339 | 340 | 341 | 342 | public 343 | interfaces.ifTable.ifEntry.ifInOctets.1 344 | 161 345 | 346 | 0 347 | 348 | 349 | 350 | Memcached 351 | 352 | 353 | 354 | Memcached $1 355 | 356 | 300 357 | 90 358 | 365 359 | 0 360 | 0 361 | 362 | 0 363 | 1 364 | 1 365 | 0 366 | 367 | 368 | 0 369 | 370 | 371 | 372 | 373 | 374 | 375 | public 376 | interfaces.ifTable.ifEntry.ifInOctets.1 377 | 161 378 | 379 | 0 380 | 381 | 382 | 383 | Memcached 384 | 385 | 386 | 387 | Memcached $1 388 | 389 | 300 390 | 90 391 | 365 392 | 0 393 | 0 394 | b 395 | 0 396 | 0 397 | 1 398 | 0 399 | 400 | 401 | 0 402 | 403 | 404 | 405 | 406 | 407 | 408 | public 409 | interfaces.ifTable.ifEntry.ifInOctets.1 410 | 161 411 | 412 | 0 413 | 414 | 415 | 416 | Memcached 417 | 418 | 419 | 420 | Memcached $1 421 | 422 | 300 423 | 90 424 | 365 425 | 0 426 | 0 427 | 428 | 0 429 | 0 430 | 1 431 | 0 432 | 433 | 434 | 0 435 | 436 | 437 | 438 | 439 | 440 | 441 | public 442 | interfaces.ifTable.ifEntry.ifInOctets.1 443 | 161 444 | 445 | 0 446 | 447 | 448 | 449 | Memcached 450 | 451 | 452 | 453 | Memcached $1 454 | 455 | 300 456 | 90 457 | 365 458 | 0 459 | 0 460 | 461 | 0 462 | 0 463 | 1 464 | 0 465 | 466 | 467 | 0 468 | 469 | 470 | 471 | 472 | 473 | 474 | public 475 | interfaces.ifTable.ifEntry.ifInOctets.1 476 | 161 477 | 478 | 0 479 | 480 | 481 | 482 | Memcached 483 | 484 | 485 | 486 | Memcached $1 487 | 488 | 300 489 | 90 490 | 0 491 | 0 492 | 0 493 | 494 | 0 495 | 0 496 | 1 497 | 0 498 | 499 | 500 | 0 501 | 502 | 503 | 504 | 505 | 506 | 507 | public 508 | interfaces.ifTable.ifEntry.ifInOctets.1 509 | 161 510 | 511 | 0 512 | 513 | 514 | 515 | Memcached 516 | 517 | 518 | 519 | Number of $1 process 520 | 521 | 30 522 | 90 523 | 365 524 | 0 525 | 0 526 | 527 | 0 528 | 0 529 | 1 530 | 0 531 | 532 | 533 | 0 534 | 535 | 536 | 537 | 538 | 539 | 540 | public 541 | interfaces.ifTable.ifEntry.ifInOctets.1 542 | 161 543 | 544 | 0 545 | 546 | 547 | 548 | Memcached 549 | 550 | 551 | 552 | 553 | 554 | 555 | 1 556 | 0 557 | 558 | :memcached[limit_maxbytes,127.0.0.1,11211] 559 | 0 560 | 0 561 | 0 562 | 0.0000 563 | 0.0000 564 | 0 565 | 0 566 | 0.0000 567 | 0.0000 568 | 569 | 570 | 1 571 | 0 572 | 009900 573 | 0 574 | 4 575 | 0 576 | 5 577 | 578 | 579 | 2 580 | 1 581 | 990000 582 | 0 583 | 4 584 | 0 585 | 5 586 | 587 | 588 | 589 | 590 | 1 591 | 0 592 | 593 | :memcached[limit_maxbytes,127.0.0.1,11211] 594 | 0 595 | 0 596 | 0 597 | 0.0000 598 | 0.0000 599 | 0 600 | 0 601 | 0.0000 602 | 0.0000 603 | 604 | 605 | 0 606 | 0 607 | 009900 608 | 0 609 | 4 610 | 0 611 | 5 612 | 613 | 614 | 0 615 | 1 616 | 990000 617 | 0 618 | 4 619 | 0 620 | 5 621 | 622 | 623 | 624 | 625 | 1 626 | 0 627 | 628 | :memcached[limit_maxbytes,127.0.0.1,11211] 629 | 0 630 | 0 631 | 0 632 | 0.0000 633 | 0.0000 634 | 0 635 | 0 636 | 0.0000 637 | 0.0000 638 | 639 | 640 | 0 641 | 0 642 | 009900 643 | 0 644 | 4 645 | 0 646 | 5 647 | 648 | 649 | 0 650 | 1 651 | 990000 652 | 0 653 | 4 654 | 0 655 | 5 656 | 657 | 658 | 659 | 660 | 1 661 | 0 662 | 663 | :memcached[limit_maxbytes,127.0.0.1,11211] 664 | 0 665 | 0 666 | 0 667 | 0.0000 668 | 0.0000 669 | 0 670 | 0 671 | 0.0000 672 | 0.0000 673 | 674 | 675 | 0 676 | 0 677 | 009900 678 | 0 679 | 4 680 | 0 681 | 5 682 | 683 | 684 | 0 685 | 1 686 | 990000 687 | 1 688 | 4 689 | 0 690 | 5 691 | 692 | 693 | 694 | 695 | 1 696 | 0 697 | 698 | :memcached[limit_maxbytes,127.0.0.1,11211] 699 | 0 700 | 0 701 | 0 702 | 0.0000 703 | 0.0000 704 | 0 705 | 0 706 | 0.0000 707 | 0.0000 708 | 709 | 710 | 0 711 | 0 712 | 009900 713 | 0 714 | 4 715 | 0 716 | 5 717 | 718 | 719 | 0 720 | 1 721 | 990000 722 | 0 723 | 4 724 | 0 725 | 5 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | -------------------------------------------------------------------------------- /salt/zabbix/files/etc/zabbix/web/zabbix.conf.php: -------------------------------------------------------------------------------- 1 | 21 | -------------------------------------------------------------------------------- /salt/zabbix/files/etc/zabbix_agentd.conf: -------------------------------------------------------------------------------- 1 | # This is a config file for the Zabbix agent daemon (Unix) 2 | # To get more information about Zabbix, visit http://www.zabbix.com 3 | 4 | ############ GENERAL PARAMETERS ################# 5 | 6 | ### Option: PidFile 7 | # Name of PID file. 8 | # 9 | # Mandatory: no 10 | # Default: 11 | PidFile=/var/run/zabbix/zabbix_agentd.pid 12 | 13 | ### Option: LogFile 14 | # Name of log file. 15 | # If not set, syslog is used. 16 | # 17 | # Mandatory: no 18 | # Default: 19 | # LogFile= 20 | 21 | LogFile=/var/log/zabbix/zabbix_agentd.log 22 | 23 | ### Option: LogFileSize 24 | # Maximum size of log file in MB. 25 | # 0 - disable automatic log rotation. 26 | # 27 | # Mandatory: no 28 | # Range: 0-1024 29 | # Default: 30 | LogFileSize=0 31 | 32 | ### Option: DebugLevel 33 | # Specifies debug level 34 | # 0 - no debug 35 | # 1 - critical information 36 | # 2 - error information 37 | # 3 - warnings 38 | # 4 - for debugging (produces lots of information) 39 | # 40 | # Mandatory: no 41 | # Range: 0-4 42 | # Default: 43 | # DebugLevel=3 44 | 45 | ### Option: SourceIP 46 | # Source IP address for outgoing connections. 47 | # 48 | # Mandatory: no 49 | # Default: 50 | # SourceIP= 51 | 52 | ### Option: EnableRemoteCommands 53 | # Whether remote commands from Zabbix server are allowed. 54 | # 0 - not allowed 55 | # 1 - allowed 56 | # 57 | # Mandatory: no 58 | # Default: 59 | # EnableRemoteCommands=0 60 | 61 | ### Option: LogRemoteCommands 62 | # Enable logging of executed shell commands as warnings. 63 | # 0 - disabled 64 | # 1 - enabled 65 | # 66 | # Mandatory: no 67 | # Default: 68 | # LogRemoteCommands=0 69 | 70 | ##### Passive checks related 71 | 72 | ### Option: Server 73 | # List of comma delimited IP addresses (or hostnames) of Zabbix servers. 74 | # Incoming connections will be accepted only from the hosts listed here. 75 | # No spaces allowed. 76 | # If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally. 77 | # 78 | # Mandatory: no 79 | # Default: 80 | # Server= 81 | 82 | Server={{Server}} 83 | 84 | ### Option: ListenPort 85 | # Agent will listen on this port for connections from the server. 86 | # 87 | # Mandatory: no 88 | # Range: 1024-32767 89 | # Default: 90 | # ListenPort=10050 91 | 92 | ### Option: ListenIP 93 | # List of comma delimited IP addresses that the agent should listen on. 94 | # First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks. 95 | # 96 | # Mandatory: no 97 | # Default: 98 | # ListenIP=0.0.0.0 99 | 100 | ### Option: StartAgents 101 | # Number of pre-forked instances of zabbix_agentd that process passive checks. 102 | # If set to 0, disables passive checks and the agent will not listen on any TCP port. 103 | # 104 | # Mandatory: no 105 | # Range: 0-100 106 | # Default: 107 | # StartAgents=3 108 | 109 | ##### Active checks related 110 | 111 | ### Option: ServerActive 112 | # List of comma delimited IP:port (or hostname:port) pairs of Zabbix servers for active checks. 113 | # If port is not specified, default port is used. 114 | # IPv6 addresses must be enclosed in square brackets if port for that host is specified. 115 | # If port is not specified, square brackets for IPv6 addresses are optional. 116 | # If this parameter is not specified, active checks are disabled. 117 | # Example: ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1] 118 | # 119 | # Mandatory: no 120 | # Default: 121 | # ServerActive= 122 | 123 | #ServerActive=127.0.0.1 124 | 125 | ### Option: Hostname 126 | # Unique, case sensitive hostname. 127 | # Required for active checks and must match hostname as configured on the server. 128 | # Value is acquired from HostnameItem if undefined. 129 | # 130 | # Mandatory: no 131 | # Default: 132 | # Hostname= 133 | 134 | 135 | ### Option: HostnameItem 136 | # Item used for generating Hostname if it is undefined. 137 | # Ignored if Hostname is defined. 138 | # 139 | # Mandatory: no 140 | # Default: 141 | # HostnameItem=system.hostname 142 | 143 | ### Option: RefreshActiveChecks 144 | # How often list of active checks is refreshed, in seconds. 145 | # 146 | # Mandatory: no 147 | # Range: 60-3600 148 | # Default: 149 | # RefreshActiveChecks=120 150 | 151 | ### Option: BufferSend 152 | # Do not keep data longer than N seconds in buffer. 153 | # 154 | # Mandatory: no 155 | # Range: 1-3600 156 | # Default: 157 | # BufferSend=5 158 | 159 | ### Option: BufferSize 160 | # Maximum number of values in a memory buffer. The agent will send 161 | # all collected data to Zabbix Server or Proxy if the buffer is full. 162 | # 163 | # Mandatory: no 164 | # Range: 2-65535 165 | # Default: 166 | # BufferSize=100 167 | 168 | ### Option: MaxLinesPerSecond 169 | # Maximum number of new lines the agent will send per second to Zabbix Server 170 | # or Proxy processing 'log' and 'logrt' active checks. 171 | # The provided value will be overridden by the parameter 'maxlines', 172 | # provided in 'log' or 'logrt' item keys. 173 | # 174 | # Mandatory: no 175 | # Range: 1-1000 176 | # Default: 177 | # MaxLinesPerSecond=100 178 | 179 | ### Option: AllowRoot 180 | # Allow the agent to run as 'root'. If disabled and the agent is started by 'root', the agent 181 | # will try to switch to user 'zabbix' instead. Has no effect if started under a regular user. 182 | # 0 - do not allow 183 | # 1 - allow 184 | # 185 | # Mandatory: no 186 | # Default: 187 | # AllowRoot=0 188 | 189 | ############ ADVANCED PARAMETERS ################# 190 | 191 | ### Option: Alias 192 | # Sets an alias for parameter. It can be useful to substitute long and complex parameter name with a smaller and simpler one. 193 | # 194 | # Mandatory: no 195 | # Range: 196 | # Default: 197 | 198 | ### Option: Timeout 199 | # Spend no more than Timeout seconds on processing 200 | # 201 | # Mandatory: no 202 | # Range: 1-30 203 | # Default: 204 | # Timeout=3 205 | 206 | ### Option: Include 207 | # You may include individual files or all files in a directory in the configuration file. 208 | # Installing Zabbix will create include directory in /etc, unless modified during the compile time. 209 | # 210 | # Mandatory: no 211 | # Default: 212 | # Include= 213 | 214 | # Include=/etc/zabbix_agentd.userparams.conf 215 | # Include=/etc/zabbix_agentd.conf.d/ 216 | Include=/etc/zabbix/zabbix_agentd.conf.d/ 217 | 218 | ####### USER-DEFINED MONITORED PARAMETERS ####### 219 | 220 | ### Option: UnsafeUserParameters 221 | # Allow all characters to be passed in arguments to user-defined parameters. 222 | # 0 - do not allow 223 | # 1 - allow 224 | # 225 | # Mandatory: no 226 | # Range: 0-1 227 | # Default: 228 | # UnsafeUserParameters=0 229 | 230 | ### Option: UserParameter 231 | # User-defined parameter to monitor. There can be several user-defined parameters. 232 | # Format: UserParameter=, 233 | # See 'zabbix_agentd' directory for examples. 234 | # 235 | # Mandatory: no 236 | # Default: 237 | # UserParameter= 238 | -------------------------------------------------------------------------------- /salt/zabbix/files/etc/zabbix_server.conf: -------------------------------------------------------------------------------- 1 | # This is a configuration file for Zabbix Server process 2 | # To get more information about Zabbix, 3 | # visit http://www.zabbix.com 4 | 5 | ############ GENERAL PARAMETERS ################# 6 | 7 | ### Option: NodeID 8 | # Unique NodeID in distributed setup. 9 | # 0 - standalone server 10 | # 11 | # Mandatory: no 12 | # Range: 0-999 13 | # Default: 14 | # NodeID=0 15 | 16 | ### Option: ListenPort 17 | # Listen port for trapper. 18 | # 19 | # Mandatory: no 20 | # Range: 1024-32767 21 | # Default: 22 | # ListenPort=10051 23 | 24 | ### Option: SourceIP 25 | # Source IP address for outgoing connections. 26 | # 27 | # Mandatory: no 28 | # Default: 29 | # SourceIP= 30 | 31 | ### Option: LogFile 32 | # Name of log file. 33 | # If not set, syslog is used. 34 | # 35 | # Mandatory: no 36 | # Default: 37 | # LogFile= 38 | 39 | LogFile=/var/log/zabbix/zabbix_server.log 40 | 41 | ### Option: LogFileSize 42 | # Maximum size of log file in MB. 43 | # 0 - disable automatic log rotation. 44 | # 45 | # Mandatory: no 46 | # Range: 0-1024 47 | # Default: 48 | LogFileSize=0 49 | 50 | ### Option: DebugLevel 51 | # Specifies debug level 52 | # 0 - no debug 53 | # 1 - critical information 54 | # 2 - error information 55 | # 3 - warnings 56 | # 4 - for debugging (produces lots of information) 57 | # 58 | # Mandatory: no 59 | # Range: 0-4 60 | # Default: 61 | # DebugLevel=3 62 | 63 | ### Option: PidFile 64 | # Name of PID file. 65 | # 66 | # Mandatory: no 67 | # Default: 68 | PidFile=/var/run/zabbix/zabbix_server.pid 69 | 70 | ### Option: DBHost 71 | # Database host name. 72 | # If set to localhost, socket is used for MySQL. 73 | # If set to empty string, socket is used for PostgreSQL. 74 | # 75 | # Mandatory: no 76 | # Default: 77 | # DBHost=localhost 78 | DBHost={{DBHost}} 79 | 80 | ### Option: DBName 81 | # Database name. 82 | # For SQLite3 path to database file must be provided. DBUser and DBPassword are ignored. 83 | # 84 | # Mandatory: yes 85 | # Default: 86 | # DBName= 87 | 88 | DBName={{DBName}} 89 | 90 | ### Option: DBSchema 91 | # Schema name. Used for IBM DB2. 92 | # 93 | # Mandatory: no 94 | # Default: 95 | # DBSchema= 96 | 97 | ### Option: DBUser 98 | # Database user. Ignored for SQLite. 99 | # 100 | # Mandatory: no 101 | # Default: 102 | # DBUser= 103 | 104 | DBUser={{DBUser}} 105 | 106 | ### Option: DBPassword 107 | # Database password. Ignored for SQLite. 108 | # Comment this line if no password is used. 109 | # 110 | # Mandatory: no 111 | # Default: 112 | # DBPassword= 113 | DBPassword={{DBPassword}} 114 | 115 | ### Option: DBSocket 116 | # Path to MySQL socket. 117 | # 118 | # Mandatory: no 119 | # Default: 120 | DBSocket={{DBSocket}} 121 | 122 | ### Option: DBPort 123 | # Database port when not using local socket. Ignored for SQLite. 124 | # 125 | # Mandatory: no 126 | # Range: 1024-65535 127 | # Default (for MySQL): 128 | # DBPort=3306 129 | DBPort={{DBPort}} 130 | 131 | ############ ADVANCED PARAMETERS ################ 132 | 133 | ### Option: StartPollers 134 | # Number of pre-forked instances of pollers. 135 | # 136 | # Mandatory: no 137 | # Range: 0-1000 138 | # Default: 139 | # StartPollers=5 140 | 141 | ### Option: StartIPMIPollers 142 | # Number of pre-forked instances of IPMI pollers. 143 | # 144 | # Mandatory: no 145 | # Range: 0-1000 146 | # Default: 147 | # StartIPMIPollers=0 148 | 149 | ### Option: StartPollersUnreachable 150 | # Number of pre-forked instances of pollers for unreachable hosts (including IPMI). 151 | # 152 | # Mandatory: no 153 | # Range: 0-1000 154 | # Default: 155 | # StartPollersUnreachable=1 156 | 157 | ### Option: StartTrappers 158 | # Number of pre-forked instances of trappers. 159 | # Trappers accept incoming connections from Zabbix sender, active agents, active proxies and child nodes. 160 | # At least one trapper process must be running to display server availability in the frontend. 161 | # 162 | # Mandatory: no 163 | # Range: 0-1000 164 | # Default: 165 | # StartTrappers=5 166 | 167 | ### Option: StartPingers 168 | # Number of pre-forked instances of ICMP pingers. 169 | # 170 | # Mandatory: no 171 | # Range: 0-1000 172 | # Default: 173 | # StartPingers=1 174 | 175 | ### Option: StartDiscoverers 176 | # Number of pre-forked instances of discoverers. 177 | # 178 | # Mandatory: no 179 | # Range: 0-250 180 | # Default: 181 | # StartDiscoverers=1 182 | 183 | ### Option: StartHTTPPollers 184 | # Number of pre-forked instances of HTTP pollers. 185 | # 186 | # Mandatory: no 187 | # Range: 0-1000 188 | # Default: 189 | # StartHTTPPollers=1 190 | 191 | ### Option: JavaGateway 192 | # IP address (or hostname) of Zabbix Java gateway. 193 | # Only required if Java pollers are started. 194 | # 195 | # Mandatory: no 196 | # Default: 197 | # JavaGateway= 198 | 199 | ### Option: JavaGatewayPort 200 | # Port that Zabbix Java gateway listens on. 201 | # 202 | # Mandatory: no 203 | # Range: 1024-32767 204 | # Default: 205 | # JavaGatewayPort=10052 206 | 207 | ### Option: StartJavaPollers 208 | # Number of pre-forked instances of Java pollers. 209 | # 210 | # Mandatory: no 211 | # Range: 0-1000 212 | # Default: 213 | # StartJavaPollers=0 214 | 215 | ### Option: SNMPTrapperFile 216 | # Temporary file used for passing data from SNMP trap daemon to the server. 217 | # Must be the same as in zabbix_trap_receiver.pl or SNMPTT configuration file. 218 | # 219 | # Mandatory: no 220 | # Default: 221 | # SNMPTrapperFile=/tmp/zabbix_traps.tmp 222 | 223 | ### Option: StartSNMPTrapper 224 | # If 1, SNMP trapper process is started. 225 | # 226 | # Mandatory: no 227 | # Range: 0-1 228 | # Default: 229 | # StartSNMPTrapper=0 230 | 231 | ### Option: ListenIP 232 | # List of comma delimited IP addresses that the trapper should listen on. 233 | # Trapper will listen on all network interfaces if this parameter is missing. 234 | # 235 | # Mandatory: no 236 | # Default: 237 | # ListenIP=0.0.0.0 238 | 239 | # ListenIP=127.0.0.1 240 | 241 | ### Option: HousekeepingFrequency 242 | # How often Zabbix will perform housekeeping procedure (in hours). 243 | # Housekeeping is removing unnecessary information from history, alert, and alarms tables. 244 | # 245 | # Mandatory: no 246 | # Range: 1-24 247 | # Default: 248 | # HousekeepingFrequency=1 249 | 250 | ### Option: MaxHousekeeperDelete 251 | # The table "housekeeper" contains "tasks" for housekeeping procedure in the format: 252 | # [housekeeperid], [tablename], [field], [value]. 253 | # No more than 'MaxHousekeeperDelete' rows (corresponding to [tablename], [field], [value]) 254 | # will be deleted per one task in one housekeeping cycle. 255 | # SQLite3 does not use this parameter, deletes all corresponding rows without a limit. 256 | # If set to 0 then no limit is used at all. In this case you must know what you are doing! 257 | # 258 | # Mandatory: no 259 | # Range: 0-1000000 260 | # Default: 261 | # MaxHousekeeperDelete=500 262 | 263 | ### Option: DisableHousekeeping 264 | # If set to 1, disables housekeeping. 265 | # 266 | # Mandatory: no 267 | # Range: 0-1 268 | # Default: 269 | # DisableHousekeeping=0 270 | 271 | ### Option: SenderFrequency 272 | # How often Zabbix will try to send unsent alerts (in seconds). 273 | # 274 | # Mandatory: no 275 | # Range: 5-3600 276 | # Default: 277 | # SenderFrequency=30 278 | 279 | ### Option: CacheSize 280 | # Size of configuration cache, in bytes. 281 | # Shared memory size for storing host, item and trigger data. 282 | # 283 | # Mandatory: no 284 | # Range: 128K-2G 285 | # Default: 286 | # CacheSize=8M 287 | 288 | ### Option: CacheUpdateFrequency 289 | # How often Zabbix will perform update of configuration cache, in seconds. 290 | # 291 | # Mandatory: no 292 | # Range: 1-3600 293 | # Default: 294 | # CacheUpdateFrequency=60 295 | 296 | ### Option: StartDBSyncers 297 | # Number of pre-forked instances of DB Syncers 298 | # 299 | # Mandatory: no 300 | # Range: 1-100 301 | # Default: 302 | # StartDBSyncers=4 303 | 304 | ### Option: HistoryCacheSize 305 | # Size of history cache, in bytes. 306 | # Shared memory size for storing history data. 307 | # 308 | # Mandatory: no 309 | # Range: 128K-2G 310 | # Default 311 | # HistoryCacheSize=8M 312 | 313 | ### Option: TrendCacheSize 314 | # Size of trend cache, in bytes. 315 | # Shared memory size for storing trends data. 316 | # 317 | # Mandatory: no 318 | # Range: 128K-2G 319 | # Default: 320 | # TrendCacheSize=4M 321 | 322 | ### Option: HistoryTextCacheSize 323 | # Size of text history cache, in bytes. 324 | # Shared memory size for storing character, text or log history data. 325 | # 326 | # Mandatory: no 327 | # Range: 128K-2G 328 | # Default: 329 | # HistoryTextCacheSize=16M 330 | 331 | ### Option: NodeNoEvents 332 | # If set to '1' local events won't be sent to master node. 333 | # This won't impact ability of this node to propagate events from its child nodes. 334 | # 335 | # Mandatory: no 336 | # Range: 0-1 337 | # Default: 338 | # NodeNoEvents=0 339 | 340 | ### Option: NodeNoHistory 341 | # If set to '1' local history won't be sent to master node. 342 | # This won't impact ability of this node to propagate history from its child nodes. 343 | # 344 | # Mandatory: no 345 | # Range: 0-1 346 | # Default: 347 | # NodeNoHistory=0 348 | 349 | ### Option: Timeout 350 | # Specifies how long we wait for agent, SNMP device or external check (in seconds). 351 | # 352 | # Mandatory: no 353 | # Range: 1-30 354 | # Default: 355 | # Timeout=3 356 | 357 | ### Option: TrapperTimeout 358 | # Specifies how many seconds trapper may spend processing new data. 359 | # 360 | # Mandatory: no 361 | # Range: 1-300 362 | # Default: 363 | # TrapperTimeout=300 364 | 365 | ### Option: UnreachablePeriod 366 | # After how many seconds of unreachability treat a host as unavailable. 367 | # 368 | # Mandatory: no 369 | # Range: 1-3600 370 | # Default: 371 | # UnreachablePeriod=45 372 | 373 | ### Option: UnavailableDelay 374 | # How often host is checked for availability during the unavailability period, in seconds. 375 | # 376 | # Mandatory: no 377 | # Range: 1-3600 378 | # Default: 379 | # UnavailableDelay=60 380 | 381 | ### Option: UnreachableDelay 382 | # How often host is checked for availability during the unreachability period, in seconds. 383 | # 384 | # Mandatory: no 385 | # Range: 1-3600 386 | # Default: 387 | # UnreachableDelay=15 388 | 389 | ### Option: AlertScriptsPath 390 | # Full path to location of custom alert scripts. 391 | # Default depends on compilation options. 392 | # 393 | # Mandatory: no 394 | # Default: 395 | AlertScriptsPath=/var/lib/zabbixsrv/alertscripts 396 | 397 | ### Option: ExternalScripts 398 | # Full path to location of external scripts. 399 | # Default depends on compilation options. 400 | # 401 | # Mandatory: no 402 | # Default: 403 | ExternalScripts=/var/lib/zabbixsrv/externalscripts 404 | 405 | ### Option: FpingLocation 406 | # Location of fping. 407 | # Make sure that fping binary has root ownership and SUID flag set. 408 | # 409 | # Mandatory: no 410 | # Default: 411 | # FpingLocation=/usr/sbin/fping 412 | 413 | ### Option: Fping6Location 414 | # Location of fping6. 415 | # Make sure that fping6 binary has root ownership and SUID flag set. 416 | # Make empty if your fping utility is capable to process IPv6 addresses. 417 | # 418 | # Mandatory: no 419 | # Default: 420 | # Fping6Location=/usr/sbin/fping6 421 | 422 | ### Option: SSHKeyLocation 423 | # Location of public and private keys for SSH checks and actions 424 | # 425 | # Mandatory: no 426 | # Default: 427 | # SSHKeyLocation= 428 | 429 | ### Option: LogSlowQueries 430 | # How long a database query may take before being logged (in milliseconds). 431 | # Only works if DebugLevel set to 3 or 4. 432 | # 0 - don't log slow queries. 433 | # 434 | # Mandatory: no 435 | # Range: 1-3600000 436 | # Default: 437 | # LogSlowQueries=0 438 | 439 | ### Option: TmpDir 440 | # Temporary directory. 441 | # 442 | # Mandatory: no 443 | # Default: 444 | # TmpDir=/tmp 445 | 446 | ### Option: Include 447 | # You may include individual files or all files in a directory in the configuration file. 448 | # Installing Zabbix will create include directory in /etc, unless modified during the compile time. 449 | # 450 | # Mandatory: no 451 | # Default: 452 | # Include= 453 | 454 | # Include=/etc/zabbix_server.general.conf 455 | # Include=/etc/zabbix_server.conf.d/ 456 | 457 | ### Option: StartProxyPollers 458 | # Number of pre-forked instances of pollers for passive proxies. 459 | # 460 | # Mandatory: no 461 | # Range: 0-250 462 | # Default: 463 | # StartProxyPollers=1 464 | 465 | ### Option: ProxyConfigFrequency 466 | # How often Zabbix Server sends configuration data to a Zabbix Proxy in seconds. 467 | # This parameter is used only for proxies in the passive mode. 468 | # 469 | # Mandatory: no 470 | # Range: 1-3600*24*7 471 | # Default: 472 | # ProxyConfigFrequency=3600 473 | 474 | ### Option: ProxyDataFrequency 475 | # How often Zabbix Server requests history data from a Zabbix Proxy in seconds. 476 | # This parameter is used only for proxies in the passive mode. 477 | # 478 | # Mandatory: no 479 | # Range: 1-3600 480 | # Default: 481 | # ProxyDataFrequency=1 482 | -------------------------------------------------------------------------------- /salt/zabbix/files/usr/lib/python2.6/site-packages/zabbix/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyao/salt-zabbix/cb4cf2f3fb0c146b510b687b3b5a2d4a3bdfb4f8/salt/zabbix/files/usr/lib/python2.6/site-packages/zabbix/__init__.py -------------------------------------------------------------------------------- /salt/zabbix/files/usr/lib/python2.6/site-packages/zabbix/zapi.py: -------------------------------------------------------------------------------- 1 | ################################################ 2 | # Python API for Zabbix v0.5 3 | # 4 | # Author: frankyao @PPTV, Shanghai, China 5 | # Email: baniu.yao@gmail.com 6 | # Date: 24, May, 2012 7 | ################################################ 8 | 9 | try: 10 | import json 11 | except ImportError: 12 | import simplejson as json 13 | 14 | import urllib2, subprocess, re, time 15 | 16 | class ZabbixAPIException(Exception): 17 | pass 18 | 19 | class ZabbixAPI(object): 20 | __auth = '' 21 | __id = 0 22 | _state = {} 23 | # def __new__(cls, *args, **kw): 24 | # if not cls._state.has_key(cls): 25 | # cls._state[cls] = super(ZabbixAPI, cls).__new__(cls, *args, **kw) 26 | # return cls._state[cls] 27 | def __init__(self, url, user, password): 28 | self.__url = url.rstrip('/') + '/api_jsonrpc.php' 29 | self.__user = user 30 | self.__password = password 31 | self._zabbix_api_object_list = ('Action', 'Alert', 'APIInfo', 'Application', 'DCheck', 'DHost', 'DRule', 32 | 'DService', 'Event', 'Graph', 'Grahpitem', 'History', 'Host', 'Hostgroup', 'Image', 'Item', 33 | 'Maintenance', 'Map', 'Mediatype', 'Proxy', 'Screen', 'Script', 'Template', 'Trigger', 'User', 34 | 'Usergroup', 'Usermacro', 'Usermedia') 35 | def __getattr__(self, name): 36 | if name not in self._zabbix_api_object_list: 37 | raise ZabbixAPIException('No such API object: %s' % name) 38 | if not self.__dict__.has_key(name): 39 | self.__dict__[name] = ZabbixAPIObjectFactory(self, name) 40 | return self.__dict__[name] 41 | def login(self): 42 | user_info = {'user' : self.__user, 43 | 'password' : self.__password} 44 | obj = self.json_obj('user.login', user_info) 45 | content = self.postRequest(obj) 46 | try: 47 | self.__auth = content['result'] 48 | except KeyError, e: 49 | e = content['error']['data'] 50 | raise ZabbixAPIException(e) 51 | def isLogin(self): 52 | return self.__auth != '' 53 | def __checkAuth__(self): 54 | if not self.isLogin(): 55 | raise ZabbixAPIException("NOT logged in") 56 | def json_obj(self, method, params): 57 | obj = { 'jsonrpc' : '2.0', 58 | 'method' : method, 59 | 'params' : params, 60 | 'auth' : self.__auth, 61 | 'id' : self.__id} 62 | return json.dumps(obj) 63 | def postRequest(self, json_obj): 64 | #print 'Post: %s' % json_obj 65 | headers = { 'Content-Type' : 'application/json-rpc', 66 | 'User-Agent' : 'python/zabbix_api'} 67 | req = urllib2.Request(self.__url, json_obj, headers) 68 | opener = urllib2.urlopen(req) 69 | content = json.loads(opener.read()) 70 | self.__id += 1 71 | #print 'Receive: %s' % content 72 | return content 73 | 74 | ''' 75 | /usr/local/zabbix/bin/zabbix_get is the default path to zabbix_get, it depends on the 'prefix' while install zabbix. 76 | plus, the ip(computer run this script) must be put into the conf of agent. 77 | ''' 78 | @staticmethod 79 | def zabbixGet(ip, key): 80 | zabbix_get = subprocess.Popen('/usr/local/zabbix/bin/zabbix_get -s %s -k %s' % (ip, key), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 81 | result, err = zabbix_get.communicate() 82 | if err: 83 | return 'ERROR' 84 | return result.strip() 85 | 86 | def createObject(self, object_name, *args, **kwargs): 87 | return object_name(self, *args, **kwargs) 88 | 89 | def getHostByHostid(self, hostids): 90 | if not isinstance(hostids,list): 91 | hostids = [hostids] 92 | return [dict['host'] for dict in self.host.get({'hostids':hostids,'output':'extend'})] 93 | 94 | ################################################# 95 | # Decorate Method 96 | ################################################# 97 | 98 | def checkAuth(func): 99 | def ret(self, *args): 100 | self.__checkAuth__() 101 | return func(self, args) 102 | return ret 103 | 104 | def postJson(method_name): 105 | def decorator(func): 106 | def wrapper(self, params): 107 | try: 108 | content = self.postRequest(self.json_obj(method_name, params)) 109 | return content['result'] 110 | except KeyError, e: 111 | e = content['error']['data'] 112 | raise ZabbixAPIException(e) 113 | return wrapper 114 | return decorator 115 | 116 | def ZabbixAPIObjectMethod(func): 117 | def wrapper(self, method_name, params): 118 | try: 119 | content = self.postRequest(self.json_obj(method_name, params)) 120 | return content['result'] 121 | except KeyError, e: 122 | e = content['error']['data'] 123 | raise ZabbixAPIException(e) 124 | return wrapper 125 | 126 | ################################################# 127 | # Zabbix API Object (host, item...) 128 | ################################################# 129 | 130 | class ZabbixAPIObjectFactory(object): 131 | def __init__(self, zapi, object_name=''): 132 | self.__zapi = zapi 133 | self.__object_name = object_name 134 | def __checkAuth__(self): 135 | self.__zapi.__checkAuth__() 136 | def postRequest(self, json_obj): 137 | return self.__zapi.postRequest(json_obj) 138 | def json_obj(self, method, param): 139 | return self.__zapi.json_obj(method, param) 140 | def __getattr__(self, method_name): 141 | def method(params): 142 | return self.proxyMethod('%s.%s' % (self.__object_name,method_name), params) 143 | return method 144 | # 'find' method is a wrapper of get. Difference between 'get' and 'find' is that 'find' can create object you want while it dosn't exist 145 | def find(self, params, attr_name=None, to_create=False): 146 | filtered_list = [] 147 | result = self.proxyMethod('%s.get' % self.__object_name, {'output':'extend','filter': params}) 148 | if to_create and len(result) == 0: 149 | result = self.proxyMethod('%s.create' % self.__object_name, params) 150 | return result.values()[0] 151 | if attr_name is not None: 152 | for element in result: 153 | filtered_list.append(element[attr_name]) 154 | return filtered_list 155 | else: 156 | return result 157 | 158 | 159 | @ZabbixAPIObjectMethod 160 | @checkAuth 161 | def proxyMethod(self, method_name, params): 162 | pass 163 | 164 | def testCase(): 165 | zapi = ZabbixAPI(url='http://your.zabbix.address', user='admin', password='zabbix') 166 | zapi.login() 167 | print zapi.Graph.find({'graphid':'49931'}, attr_name='graphid')[0] 168 | hostid = zapi.Host.find({'ip':ip}, attr_name='hostid')[0] 169 | print zapi.Host.exists({'filter':{'host':'BJBSJ-Zabbix-Proxy-82-225'}}) 170 | host = zapi.createObject(Host, 'HostToCreate') 171 | item = host.getItem('444107') 172 | zapi.host.get({'hostids':['16913','17411'],'output':'extend'}) 173 | group = zapi.createObject(Hostgroup, '926') 174 | print zapi.getHostByHostid('16913') 175 | 176 | if __name__ == '__main__': 177 | testCase() 178 | -------------------------------------------------------------------------------- /salt/zabbix/server.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - salt.minion 3 | - mysql.server 4 | 5 | zabbix-server: 6 | pkg.installed: 7 | - pkgs: 8 | - zabbix20-server 9 | - zabbix20-server-mysql 10 | file.managed: 11 | - name: /etc/zabbix_server.conf 12 | - source: salt://zabbix/files/etc/zabbix_server.conf 13 | - template: jinja 14 | - defaults: 15 | DBHost: localhost 16 | DBName: zabbix 17 | DBUser: zabbix 18 | DBPassword: zabbix_pass 19 | DBSocket: /var/lib/mysql/mysql.sock 20 | DBPort: 3306 21 | - require: 22 | - pkg: zabbix-server 23 | service.running: 24 | - enable: True 25 | - watch: 26 | - file: zabbix-server 27 | 28 | zabbix-server-role: 29 | file.append: 30 | - name: /etc/salt/roles 31 | - text: 32 | - 'zabbix-server' 33 | - require: 34 | - file: roles 35 | - service: zabbix-server 36 | - service: salt-minion 37 | - watch_in: 38 | - module: sync_grains 39 | 40 | 41 | zabbix_server.conf-link: 42 | file.symlink: 43 | - name: /etc/zabbix/zabbix_server.conf 44 | - target: /etc/zabbix_server.conf 45 | - require_in: 46 | - service: zabbix-server 47 | - require: 48 | - pkg: zabbix-server 49 | - file: zabbix-server 50 | 51 | zabbix_mysql: 52 | mysql_database.present: 53 | - name: zabbix 54 | mysql_user.present: 55 | - name: zabbix 56 | - host: localhost 57 | - password: zabbix_pass 58 | - require: 59 | - mysql_database: zabbix_mysql 60 | mysql_grants.present: 61 | - grant: all 62 | - database: zabbix.* 63 | - user: zabbix 64 | - host: localhost 65 | - require: 66 | - mysql_user: zabbix_mysql 67 | - require_in: 68 | - service: zabbix-server 69 | 70 | 71 | zabbix_mysql-init: 72 | cmd.run: 73 | - name: mysql -uroot zabbix < /usr/share/zabbix-mysql/schema.sql && mysql -uroot zabbix < /usr/share/zabbix-mysql/images.sql && mysql -uroot zabbix < /usr/share/zabbix-mysql/data.sql 74 | - unless: mysql -uroot -e "SELECT COUNT(*) from zabbix.users" 75 | - require: 76 | - pkg: zabbix-server 77 | - mysql_grants: zabbix_mysql 78 | - require_in: 79 | - file: zabbix-server 80 | - service: zabbix-server 81 | -------------------------------------------------------------------------------- /salt/zabbix/web.sls: -------------------------------------------------------------------------------- 1 | include: 2 | - apache 3 | - php 4 | - salt.minion 5 | 6 | zabbix-web: 7 | pkg.installed: 8 | - pkgs: 9 | - zabbix20-web 10 | - zabbix20-web-mysql 11 | - watch_in: 12 | - service: apache 13 | file.managed: 14 | - name: /etc/zabbix/web/zabbix.conf.php 15 | - source: salt://zabbix/files/etc/zabbix/web/zabbix.conf.php 16 | - require: 17 | - pkg: zabbix-web 18 | 19 | zabbix-web-role: 20 | file.append: 21 | - name: /etc/salt/roles 22 | - text: 23 | - 'zabbix-web' 24 | - require: 25 | - file: roles 26 | - pkg: zabbix-web 27 | - service: salt-minion 28 | - watch_in: 29 | - module: sync_grains 30 | -------------------------------------------------------------------------------- /记saltstack和zabbix的一次联姻--绿肥.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pengyao/salt-zabbix/cb4cf2f3fb0c146b510b687b3b5a2d4a3bdfb4f8/记saltstack和zabbix的一次联姻--绿肥.pdf --------------------------------------------------------------------------------