Merge branch 'enhancement-erenfro-issue15-split-webui-setup' of Linux-Help/zabbix into master

This commit is contained in:
Eric Renfro 2017-02-12 22:13:46 -05:00 committed by Gogs
commit 66ae4ce460
37 changed files with 16500 additions and 203 deletions

View File

@ -1,37 +1,59 @@
---
driver:
name: docker
name: qemu
provisioner:
name: chef_zero
environments_path: test/environments
nodes_path: test/fixtures/nodes
clients_path: test/fixtures/clients
environments_path: test/fixtures/environments
data_bags_path: test/fixtures/data_bags
chef_client_path: /usr/bin/chef-client
client_rb:
environment: integration_test_env
environment: test
platforms:
- name: centos-6.6-chef-11
- name: centos-7.3
driver_config:
image: centos:6.6
image: centos-7.3-chef.qcow2
platform: rhel
require_chef_omnibus: 12.5.1
use_sudo: false
hostname: integration.test.test
require_chef_omnibus: false
hostname: integration.centos7.test
suites:
- name: server
driver:
forward:
- 8087:80
data_bags_path: "test/integration/data_bags"
encrypted_data_bag_secret_key_path: "test/integration/server/encrypted_data_bag_secret"
networks:
- netdev: user,id=user,net=192.168.1.0/24,hostname=%h,hostfwd=tcp::%p-:22,hostfwd=tcp::8087-:80
device: virtio-net-pci,netdev=user
run_list:
- recipe[zabbix::database]
- recipe[zabbix::server]
attributes:
tags: [ 'httpd', 'openldap', 'mind1', 'mongodb', 'shibboleth', 'tomcat' ]
tags: [ 'httpd' ]
zabbix:
database:
repo:
pgdg: true
- name: server-nginx
driver:
networks:
- netdev: user,id=user,net=192.168.1.0/24,hostname=%h,hostfwd=tcp::%p-:22,hostfwd=tcp::8086-:80
device: virtio-net-pci,netdev=user
run_list:
- recipe[zabbix::database]
- recipe[zabbix::server]
attributes:
tags: [ 'httpd' ]
zabbix:
webserver:
backend: nginx
database:
repo:
pgdg: true
php:
use_fpm: false
- name: agent
data_bags_path: "test/integration/data_bags"
encrypted_data_bag_secret_key_path: "test/integration/agent/encrypted_data_bag_secret"
run_list:
- recipe[zabbix::default]
attributes:
@ -39,10 +61,17 @@ suites:
zabbix:
agent_servers: ['172.17.0.3']
- name: proxy
data_bags_path: "test/integration/data_bags"
encrypted_data_bag_secret_key_path: "test/integration/server/encrypted_data_bag_secret"
run_list:
- recipe[zabbix::proxy]
attributes:
tags: [ 'httpd', 'openldap', 'mind1', 'mongodb', 'shibboleth', 'tomcat' ]
tags: [ 'httpd' ]
- name: database
run_list:
- recipe[zabbix::database]
attributes:
tags: [ 'httpd' ]
zabbix:
version: '3.0'
database:
repo:
pgdg: true

View File

@ -2,5 +2,13 @@ source "https://supermarket.chef.io"
metadata
cookbook "chef-vault", '>= 2.1.1'
cookbook "apache2", '>= 3.2.2'
cookbook "chef_nginx", '>= 5.0.7'
#cookbook "httpd", '>= 0.4.4'
cookbook "php", '>= 2.2.0'
cookbook "postgresql", '>= 6.0.1'
cookbook "yum-ius", '>= 2.1.0'
cookbook "yum-zabbix", path: "../yum-zabbix"
#cookbook "apt-zabbix", path: "../apt-zabbix"
#cookbook "mysql", '>= 8.2.0'

View File

@ -1,3 +1,21 @@
default['zabbix']['database']['backend'] = 'postgresql'
default['zabbix']['database']['repo']['pgdg'] = false
default['zabbix']['webserver']['backend'] = 'apache'
default['zabbix']['webserver']['port'] = '80'
default['zabbix']['php']['use_fpm'] = true
default['zabbix']['php']['timezone'] = 'America/New_York'
default['zabbix']['ssl']['enable'] = false
default['zabbix']['ssl']['port'] = '443'
default['zabbix']['ssl']['cacert'] = nil
default['zabbix']['ssl']['server_cert'] = nil
default['zabbix']['ssl']['server_key'] = nil
default['zabbix']['ssl']['ssl_protocols'] = [ "TLSv1.2" ]
default['zabbix']['ssl']['ssl_ciphers'] = [
"HIGH",
"!aNULL",
"!MD5"
]
default['zabbix']['version'] = "3.0"
default['zabbix']['agent_meta'] = []
if node.run_list?('recipe[zabbix::server]')
@ -16,4 +34,3 @@ default['zabbix']['trap_scripts']['daily']['del'] = []
default['zabbix']['httpd_conf']['https_redirection_enabled'] = true
default['letsencrypt']['enabled'] = false
default['lba_host'] = 'default'

3282
files/mysql/3.0/data.sql Normal file

File diff suppressed because it is too large Load Diff

187
files/mysql/3.0/images.sql Normal file

File diff suppressed because one or more lines are too long

1593
files/mysql/3.0/schema.sql Normal file

File diff suppressed because it is too large Load Diff

3319
files/mysql/3.2/data.sql Normal file

File diff suppressed because it is too large Load Diff

187
files/mysql/3.2/images.sql Normal file

File diff suppressed because one or more lines are too long

1722
files/mysql/3.2/schema.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@ -569,6 +569,7 @@ INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,hi
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23145','0','','','10081','Processor load (5 min average)','system.cpu.load[percpu,avg5]','60','7','365','0','0','','','0','0','','0','','','1','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23147','0','','','10081','Free swap space','system.swap.size[,free]','60','7','365','0','3','','B','0','0','','0','','','1','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23148','0','','','10081','Total swap space','system.swap.size[,total]','3600','7','365','0','3','','B','0','0','','0','','','1','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23664','0','','','10081','Free virtual memory, in %','vm.vmemory.size[pavailable]','60','7','365','0','0','','%','0','0','','0','','','1','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23149','0','','','10081','System information','system.uname','3600','7','0','0','1','','','0','0','','0','','','1','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','5','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23150','0','','','10081','System uptime','system.uptime','60','7','365','0','3','','uptime','0','0','','0','','','1','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23158','0','','','10081','Free memory','vm.memory.size[free]','60','7','365','0','3','','B','0','0','','0','','','1','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
@ -745,6 +746,9 @@ INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,hi
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23631','3','','','10091','Datastore discovery','vmware.hv.datastore.discovery[{$URL},{HOST.HOST}]','3600','90','0','0','4','','','0','0','','0','','','','',NULL,NULL,'','','','0','0','{$USERNAME}','{$PASSWORD}','','','1',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23632','3','','','10091','Average read latency of the datastore $3','vmware.hv.datastore.read[{$URL},{HOST.HOST},{#DATASTORE},latency]','60','90','365','0','3','','','0','0','','0','','','1','',NULL,NULL,'','','','0','0','{$USERNAME}','{$PASSWORD}','','','2',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23633','3','','','10091','Average write latency of the datastore $3','vmware.hv.datastore.write[{$URL},{HOST.HOST},{#DATASTORE},latency]','60','90','365','0','3','','','0','0','','0','','','1','',NULL,NULL,'','','','0','0','{$USERNAME}','{$PASSWORD}','','','2',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23665','3','','','10091','Total size of datastore $3','vmware.hv.datastore.size[{$URL},{HOST.HOST},{#DATASTORE}]','60','90','365','0','3','','B','0','0','','0','','','1','',NULL,NULL,'','','','0','0','{$USERNAME}','{$PASSWORD}','','','2',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23666','3','','','10091','Free space on datastore $3 (percentage)','vmware.hv.datastore.size[{$URL},{HOST.HOST},{#DATASTORE},pfree]','60','90','365','0','0','','%','0','0','','0','','','1','',NULL,NULL,'','','','0','0','{$USERNAME}','{$PASSWORD}','','','2',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23663','3','','','10091','Health state rollup','vmware.hv.sensor.health.state[{$URL},{HOST.HOST}]','60','90','365','0','3','','','0','0','','0','','','1','',NULL,'13','','','','0','0','{$USERNAME}','{$PASSWORD}','','','0',NULL,'','The host health state rollup sensor value: gray - unknown, ok, red - it has a problem, yellow - it might have a problem.','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23634','5','','','10047','Zabbix vmware cache, % free','zabbix[vmware,buffer,pfree]','60','7','365','0','0','','%','0','0','','0','','','1','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23636','16','','','10082','jvm Name','jmx["java.lang:type=Runtime",VmName]','3600','7','0','0','1','','','0','0','','0','','','1','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23637','16','','','10082','os Process CPU Load','jmx["java.lang:type=OperatingSystem",ProcessCpuLoad]','60','7','365','0','0','','%','1','0','','0','','','100','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
@ -770,7 +774,7 @@ INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,hi
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23657','3','','','10104','ICMP loss','icmppingloss','60','7','365','0','0','','%','0','0','','0','','','1','',NULL,NULL,'','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23658','3','','','10088','Full name','vmware.fullname[{$URL}]','3600','90','0','0','1','','','0','0','','0','','','1','',NULL,NULL,'','','','0','0','{$USERNAME}','{$PASSWORD}','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23659','3','','','10088','Version','vmware.version[{$URL}]','3600','90','0','0','1','','','0','0','','0','','','1','',NULL,NULL,'','','','0','0','{$USERNAME}','{$PASSWORD}','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23660','3','','','10089','CPU ready','vmware.vm.cpu.ready[{$URL},{HOST.HOST}]','60','90','365','0','3','','%','0','0','','0','','','1','',NULL,NULL,'','','','0','0','{$USERNAME}','{$PASSWORD}','','','0',NULL,'','Percentage of time that the virtual machine was ready, but could not get scheduled to run on the physical CPU. CPU ready time is dependent on the number of virtual machines on the host and their CPU loads.','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23660','3','','','10089','CPU ready','vmware.vm.cpu.ready[{$URL},{HOST.HOST}]','60','90','365','0','3','','ms','0','0','','0','','','1','',NULL,NULL,'','','','0','0','{$USERNAME}','{$PASSWORD}','','','0',NULL,'','Time that the virtual machine was ready, but could not get scheduled to run on the physical CPU during last measurement interval (VMware vCenter/ESXi Server performance counter sampling interval - 20 seconds)','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('23661','5','','','10047','Zabbix value cache operating mode','zabbix[vcache,cache,mode]','60','7','365','0','3','','','0','0','','0','','','1','',NULL,'15','','','','0','0','','','','','0',NULL,'','','0','30','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('10020','0','','','10001','Agent ping','agent.ping','60','7','365','0','3','','','0','0','','0','','','1','','22232','10','','','','0','0','','','','','0',NULL,'','The agent always returns 1 for this item. It could be used in combination with nodata() for availability check.','0','0','0','0','','0');
INSERT INTO items (itemid,type,snmp_community,snmp_oid,hostid,name,key_,delay,history,trends,status,value_type,trapper_hosts,units,multiplier,delta,snmpv3_securityname,snmpv3_securitylevel,snmpv3_authpassphrase,snmpv3_privpassphrase,formula,logtimefmt,templateid,valuemapid,delay_flex,params,ipmi_sensor,data_type,authtype,username,password,publickey,privatekey,flags,interfaceid,port,description,inventory_link,lifetime,snmpv3_authprotocol,snmpv3_privprotocol,snmpv3_contextname,evaltype) values ('10059','0','','','10001','Version of zabbix_agent(d) running','agent.version','3600','7','0','0','1','','','0','0','','0','','','1','','22231',NULL,'','','','0','0','','','','','0',NULL,'','','0','0','0','0','','0');
@ -1179,7 +1183,7 @@ INSERT INTO triggers (triggerid,expression,description,url,status,priority,comme
INSERT INTO triggers (triggerid,expression,description,url,status,priority,comments,templateid,type,flags) values ('13425','{12812}>0','Host information was changed on {HOST.NAME}','','0','3','',NULL,'0','0');
INSERT INTO triggers (triggerid,expression,description,url,status,priority,comments,templateid,type,flags) values ('13428','{12815}<0','{HOST.NAME} has just been restarted','','0','3','',NULL,'0','0');
INSERT INTO triggers (triggerid,expression,description,url,status,priority,comments,templateid,type,flags) values ('13430','{13095}>300','Too many processes on {HOST.NAME}','','0','3','',NULL,'0','0');
INSERT INTO triggers (triggerid,expression,description,url,status,priority,comments,templateid,type,flags) values ('13431','{12818}<100000','Lack of free swap space on {HOST.NAME}','','0','3','',NULL,'0','0');
INSERT INTO triggers (triggerid,expression,description,url,status,priority,comments,templateid,type,flags) values ('13431','({TRIGGER.VALUE}=0 and {12818}<10) or ({TRIGGER.VALUE}=1 and {12818}<20)','Lack of available virtual memory on server {HOST.NAME}','','0','3','',NULL,'0','0');
INSERT INTO triggers (triggerid,expression,description,url,status,priority,comments,templateid,type,flags) values ('13433','{12820}<10000','Lack of free memory on server {HOST.NAME}','','0','3','',NULL,'0','0');
INSERT INTO triggers (triggerid,expression,description,url,status,priority,comments,templateid,type,flags) values ('13435','{13094}>5','Processor load is too high on {HOST.NAME}','','0','3','',NULL,'0','0');
INSERT INTO triggers (triggerid,expression,description,url,status,priority,comments,templateid,type,flags) values ('13439','{12826}<20','Free disk space is less than 20% on volume {#FSNAME}','','0','2','',NULL,'0','2');
@ -1484,7 +1488,7 @@ INSERT INTO functions (functionid,itemid,triggerid,function,parameter) values ('
INSERT INTO functions (functionid,itemid,triggerid,function,parameter) values ('12810','23072','13423','last','0');
INSERT INTO functions (functionid,itemid,triggerid,function,parameter) values ('12812','23149','13425','diff','0');
INSERT INTO functions (functionid,itemid,triggerid,function,parameter) values ('12815','23150','13428','change','0');
INSERT INTO functions (functionid,itemid,triggerid,function,parameter) values ('12818','23147','13431','last','0');
INSERT INTO functions (functionid,itemid,triggerid,function,parameter) values ('12818','23664','13431','min','10m');
INSERT INTO functions (functionid,itemid,triggerid,function,parameter) values ('12820','23158','13433','last','0');
INSERT INTO functions (functionid,itemid,triggerid,function,parameter) values ('12824','23160','13437','nodata','5m');
INSERT INTO functions (functionid,itemid,triggerid,function,parameter) values ('12826','23165','13439','last','0');
@ -2946,6 +2950,10 @@ INSERT INTO items_applications (itemappid,applicationid,itemid) values ('5871','
INSERT INTO items_applications (itemappid,applicationid,itemid) values ('5872','457','23657');
INSERT INTO items_applications (itemappid,applicationid,itemid) values ('5873','458','23658');
INSERT INTO items_applications (itemappid,applicationid,itemid) values ('5874','458','23659');
INSERT INTO items_applications (itemappid,applicationid,itemid) values ('5876','418','23663');
INSERT INTO items_applications (itemappid,applicationid,itemid) values ('5881','328','23664');
INSERT INTO items_applications (itemappid,applicationid,itemid) values ('5882','445','23665');
INSERT INTO items_applications (itemappid,applicationid,itemid) values ('5885','445','23666');
INSERT INTO mappings (mappingid,valuemapid,value,newvalue) values ('1','1','0','Down');
INSERT INTO mappings (mappingid,valuemapid,value,newvalue) values ('2','1','1','Up');
INSERT INTO mappings (mappingid,valuemapid,value,newvalue) values ('3','2','0','not available');
@ -3288,6 +3296,8 @@ INSERT INTO item_discovery (itemdiscoveryid,itemid,parent_itemid) values ('208',
INSERT INTO item_discovery (itemdiscoveryid,itemid,parent_itemid) values ('209','23608','23600');
INSERT INTO item_discovery (itemdiscoveryid,itemid,parent_itemid) values ('218','23632','23631');
INSERT INTO item_discovery (itemdiscoveryid,itemid,parent_itemid) values ('219','23633','23631');
INSERT INTO item_discovery (itemdiscoveryid,itemid,parent_itemid) values ('220','23665','23631');
INSERT INTO item_discovery (itemdiscoveryid,itemid,parent_itemid) values ('221','23666','23631');
INSERT INTO host_discovery (hostid,parent_hostid,parent_itemid) values ('10090',NULL,'23542');
INSERT INTO host_discovery (hostid,parent_hostid,parent_itemid) values ('10092',NULL,'23554');
INSERT INTO application_template (application_templateid,applicationid,templateid) values ('1','207','206');

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ maintainer_email 'psi-jack@linux-help.org'
license 'Apache 2.0'
description 'Installs Zabbix Server & Client agents for EL linux distributions'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.4.0'
version '1.5.1'
source_url 'https://git.linux-help.org/Linux-Help/zabbix' if respond_to?(:source_url)
issues_url 'https://git.linux-help.org/Linux-Help/zabbix/issues' if respond_to?(:issues_url)
@ -14,3 +14,15 @@ end
recipe 'zabbix', 'Installs zabbix'
depends 'chef-vault', '>= 2.1.1'
depends 'apache2', '>= 3.2.2'
depends 'chef_nginx', '>= 5.0.7'
#depends 'httpd', '>= 0.4.4'
depends 'php', '>= 2.2.0'
depends 'postgresql', '>= 6.0.1'
depends 'yum-ius', '>= 2.1.0'
depends 'yum-zabbix', '>= 1.0.1'
#depends 'apt-zabbix'
#depends 'mysql', '>= 8.2.0'
chef_version '>= 12.1' if respond_to?(:chef_version)

View File

@ -16,7 +16,16 @@ end
# Install custom zabbix_agentd.conf
template "/etc/zabbix/zabbix_agentd.conf" do
source "zabbix_agentd.conf.erb"
source %W{
zabbix/#{node['zabbix']['version']}/#{node['platform']}-#{node['platform_version'].to_i}/zabbix_agentd.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform']}/zabbix_agentd.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}-#{node['platform_version'].to_i}/zabbix_agentd.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}/zabbix_agentd.conf.erb
zabbix/#{node['zabbix']['version']}/zabbix_agentd.conf.erb
zabbix/zabbix_agentd.conf.erb
default/zabbix_agentd.conf.erb
zabbix_agentd.conf.erb
}
mode "0644"
owner "root"
group "root"
@ -115,4 +124,3 @@ cron "zabbix_daily" do
command %Q{/etc/zabbix/trap.d/runtrap daily >/dev/null 2>&1}
only_if { node['zabbix']['trap_scripts']['daily']['add'].any? }
end

View File

@ -7,91 +7,9 @@
# Eric Renfro <psi-jack@linux-help.org>
#
yum_package 'postgresql94-server'
directory '/tmp/database' do
owner 'root'
group 'root'
mode '0755'
action :create
only_if { Dir.glob('/var/lib/pgsql/9.4/data/*').empty? }
case node['zabbix']['database']['backend']
when 'postgresql'
include_recipe 'zabbix::database_postgresql'
else
Chef::Application.fatal!('Unknown database backend to use.', 101)
end
template "/tmp/database/schema.sql" do
source "schema.sql.erb"
mode "0644"
owner "root"
group "root"
action :create
only_if { Dir.exist?('/tmp/database') }
end
template "/tmp/database/images.sql" do
source "images.sql.erb"
mode "0644"
owner "root"
group "root"
action :create
only_if { Dir.exist?('/tmp/database') }
end
template "/tmp/database/data.sql" do
source "data.sql.erb"
mode "0644"
owner "root"
group "root"
action :create
only_if { Dir.exist?('/tmp/database') }
end
execute 'initializingdb' do
command 'service postgresql-9.4 initdb'
action :run
only_if { Dir.glob('/var/lib/pgsql/9.4/data/*').empty? }
end
template "/var/lib/pgsql/9.4/data/pg_hba.conf" do
source "pg_hba.conf.erb"
mode "0600"
owner "postgres"
group "postgres"
notifies :restart, "service[postgresql-9.4]", :immediately
end
service 'postgresql-9.4' do
action [:start, :enable]
end
bash 'configure_postgres' do
user 'root'
sensitive true
credentials = Chef::EncryptedDataBagItem.load("odhp_credentials", "credentials")
code <<-EOH
su postgres -l -c "psql -U postgres -c \\"CREATE DATABASE zabbix WITH ENCODING='UTF-8';\\""
su postgres -l -c "psql -U postgres -c \\"CREATE USER zabbixmaster WITH PASSWORD '#{credentials['zabbix']['postgres_password']}';\\""
su postgres -l -c "psql -U postgres -c \\"GRANT ALL PRIVILEGES ON DATABASE zabbix to zabbixmaster;\\""
EOH
only_if { Dir.exist?('/tmp/database') }
end
bash 'configure_schema' do
credentials = Chef::EncryptedDataBagItem.load("odhp_credentials", "credentials")
sensitive true
environment ({
"PGPASSWORD" => credentials['zabbix']['postgres_password']
})
code <<-EOH
cd /tmp/database/
psql -h 127.0.0.1 -U zabbixmaster -d zabbix -f /tmp/database/schema.sql;
psql -h 127.0.0.1 -U zabbixmaster -d zabbix -f /tmp/database/images.sql;
psql -h 127.0.0.1 -U zabbixmaster -d zabbix -f /tmp/database/data.sql;
EOH
only_if { Dir.exist?('/tmp/database') }
end
directory "cleanup" do
path "/tmp/database"
recursive true
action :delete
end

90
recipes/database_mysql.rb Normal file
View File

@ -0,0 +1,90 @@
#
# Cookbook Name:: zabbix
# Recipe:: database_mysql
#
# Copyright 2017, Linux-Help.org
# Authors:
# Eric Renfro <psi-jack@linux-help.org>
#
include_recipe 'chef-vault'
if not node['zabbix']['database']['backend'] == 'mysql'
Chef::Application.fatal!('database_mysql, but backend is set differently.', 111)
end
mysql_service 'zabbix' do
port '3306'
initial_root_password 'password'
action [:create, :start]
end
directory '/tmp/database' do
owner 'root'
group 'root'
mode '0755'
action :create
not_if "true"
end
cookbook_file '/tmp/database/schema.sql' do
source %W{
host-#{node['fqdn']}/schema.sql
#{node['zabbix']['database']['backend']}/#{node['zabbix']['version']}/schema.sql
}
backup false
action :nothing
subscribes :create, 'directory[/tmp/database]', :immediately
end
cookbook_file '/tmp/database/images.sql' do
source %W{
host-#{node['fqdn']}/images.sql
#{node['zabbix']['database']['backend']}/#{node['zabbix']['version']}/images.sql
}
backup false
action :nothing
subscribes :create, 'directory[/tmp/database]', :immediately
end
cookbook_file '/tmp/database/data.sql' do
source %W{
host-#{node['fqdn']}/data.sql
#{node['zabbix']['database']['backend']}/#{node['zabbix']['version']}/data.sql
}
backup false
action :nothing
subscribes :create, 'directory[/tmp/database]', :immediately
end
bash 'create_zabbix_db_user' do
user 'postgres'
sensitive true
credentials = chef_vault_item("secrets", "zabbix")
code <<-EOH
psql -c "CREATE DATABASE zabbix WITH ENCODING='UTF-8';"
psql -c "CREATE USER zabbix WITH PASSWORD '#{credentials['postgres']}';"
psql -c "GRANT ALL PRIVILEGES ON DATABASE zabbix TO zabbix;"
EOH
action :nothing
subscribes :run, 'directory[/tmp/database]', :immediately
end
bash 'initialize_zabbix_db' do
sensitive true
user 'postgres'
code <<-EOH
psql -d zabbix -f /tmp/database/schema.sql
psql -d zabbix -f /tmp/database/images.sql
psql -d zabbix -f /tmp/database/data.sql
EOH
action :nothing
subscribes :run, 'directory[/tmp/database]', :immediately
end
directory "cleanup" do
path "/tmp/database"
recursive true
action :nothing
subscribes :delete, 'directory[/tmp/database]', :immediately
end

View File

@ -0,0 +1,103 @@
#
# Cookbook Name:: zabbix
# Recipe:: database_postgresql
#
# Copyright 2017, Linux-Help.org
# Authors:
# Eric Renfro <psi-jack@linux-help.org>
#
include_recipe 'chef-vault'
if node['zabbix']['database']['backend'] == 'postgresql'
if node['zabbix']['database']['repo']['pgdg']
node.default['postgresql']['enable_pgdg_apt'] = true
node.default['postgresql']['enable_pgdg_yum'] = true
node.default['postgresql']['version'] = "9.6"
end
node.default['postgresql']['pg_hba'] = [
{ type: 'local', db: 'all', user: 'postgres', addr: nil, method: 'ident' },
{ type: 'local', db: 'all', user: 'all', addr: nil, method: 'md5' },
{ type: 'host', db: 'all', user: 'all', addr: '127.0.0.1/32', method: 'md5' },
{ type: 'host', db: 'all', user: 'all', addr: '::1/128', method: 'md5' },
]
include_recipe 'postgresql::server'
else
Chef::Application.fatal!('database_postgresql, but backend is set differently.', 111)
end
directory '/tmp/database' do
owner 'root'
group 'root'
mode '0755'
action :create
not_if "sudo -u postgres psql -lqtA | grep -q '^zabbix'"
end
cookbook_file '/tmp/database/schema.sql' do
sensitive true
source %W{
host-#{node['fqdn']}/schema.sql
#{node['zabbix']['database']['backend']}/#{node['zabbix']['version']}/schema.sql
}
backup false
action :nothing
subscribes :create, 'directory[/tmp/database]', :immediately
end
cookbook_file '/tmp/database/images.sql' do
sensitive true
source %W{
host-#{node['fqdn']}/images.sql
#{node['zabbix']['database']['backend']}/#{node['zabbix']['version']}/images.sql
}
backup false
action :nothing
subscribes :create, 'directory[/tmp/database]', :immediately
end
cookbook_file '/tmp/database/data.sql' do
sensitive true
source %W{
host-#{node['fqdn']}/data.sql
#{node['zabbix']['database']['backend']}/#{node['zabbix']['version']}/data.sql
}
backup false
action :nothing
subscribes :create, 'directory[/tmp/database]', :immediately
end
bash 'create_zabbix_db_user' do
user 'postgres'
#sensitive true
credentials = chef_vault_item("secrets", "zabbix")
code <<-EOH
psql -c "CREATE USER \"#{credentials['username']}\" WITH PASSWORD '#{credentials['password']}';"
psql -c "CREATE DATABASE \"#{credentials['database']}\" WITH OWNER \"#{credentials['username']}\" ENCODING 'UTF-8';"
EOH
action :nothing
subscribes :run, 'directory[/tmp/database]', :immediately
end
bash 'initialize_zabbix_db' do
sensitive true
credentials = chef_vault_item("secrets", "zabbix")
environment({
"PGUSER" => credentials['username'],
"PGPASSWORD" => credentials['password']
})
code <<-EOH
psql -d zabbix -f /tmp/database/schema.sql
psql -d zabbix -f /tmp/database/images.sql
psql -d zabbix -f /tmp/database/data.sql
EOH
action :nothing
subscribes :run, 'directory[/tmp/database]', :immediately
end
directory "cleanup" do
path "/tmp/database"
recursive true
action :nothing
subscribes :delete, 'directory[/tmp/database]', :immediately
end

View File

@ -7,6 +7,8 @@
# Eric Renfro <psi-jack@linux-help.org>
#
include_recipe 'chef-vault'
%w{zabbix-proxy-sqlite3 zabbix-get}.each do |pkg|
yum_package pkg do
version '3.0.5-1.el6'
@ -23,11 +25,22 @@ directory "/var/lib/zabbix" do
end
template "/etc/zabbix/zabbix_proxy.conf" do
credentials = Chef::EncryptedDataBagItem.load("odhp_credentials", "credentials")
credentials = chef_vault_item("secrets", "zabbix")
variables({
:DBPassword => credentials['zabbix']['postgres_password']
:DBUsername => credentials['username'],
:DBPassword => credentials['password'],
:DBDatabase => credentials['database']
})
source "zabbix_proxy.conf.erb"
source %W{
zabbix/#{node['zabbix']['version']}/#{node['platform']}-#{node['platform_version'].to_i}/zabbix_proxy.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform']}/zabbix_proxy.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}-#{node['platform_version'].to_i}/zabbix_proxy.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}/zabbix_proxy.conf.erb
zabbix/#{node['zabbix']['version']}/zabbix_proxy.conf.erb
zabbix/zabbix_proxy.conf.erb
default/zabbix_proxy.conf.erb
zabbix_proxy.conf.erb
}
sensitive true
mode "0640"
owner "root"
@ -41,4 +54,3 @@ service 'zabbix-proxy' do
end
include_recipe 'zabbix::agent'

View File

@ -7,103 +7,161 @@
# Eric Renfro <psi-jack@linux-help.org>
#
%w{httpd mod_ssl}.each do |pkg|
yum_package pkg do
version '2.2.15-39.el6'
allow_downgrade true
action :install
end
include_recipe 'chef-vault'
include_recipe "#{cookbook_name}::database"
#################################
# Include Additional Repositories
case node['platform_family']
when 'rhel'
include_recipe 'yum-ius'
include_recipe 'yum-zabbix'
end
%w{php56u php56u-bcmath php56u-gd php56u-mbstring php56u-pgsql php56u-xml php56u-xmlrpc php56u-cli php56u-opcache}.each do |pkg|
yum_package pkg do
version '5.6.28-1.ius.centos6'
allow_downgrade true
action :install
end
#############################
# Setup and Install Webserver
case node['zabbix']['webserver']['backend']
when 'apache'
include_recipe "#{cookbook_name}::server_apache"
when 'nginx'
include_recipe "#{cookbook_name}::server_nginx"
else
Chef::Application.fatal!('Webserver backend can either be apache or nginx', 121)
end
%w{zabbix-server-pgsql zabbix-web-pgsql zabbix-get}.each do |pkg|
yum_package pkg do
version '3.0.5-1.el6'
allow_downgrade true
action :install
end
end
template "/etc/httpd/conf/httpd.conf" do
source "httpd.conf.erb"
mode "0644"
owner "root"
group "root"
notifies :restart, "service[httpd]", :delayed
end
template "/etc/httpd/conf.d/zabbix.conf" do
source "zabbix_httpd.conf.erb"
mode "0644"
owner "root"
group "root"
notifies :restart, "service[httpd]", :delayed
end
template "/etc/httpd/conf.d/security.conf" do
source "security.conf.erb"
mode "0644"
owner "root"
group "root"
notifies :restart, "service[httpd]", :delayed
end
template "/etc/httpd/conf.d/ssl.conf" do
source "ssl.conf.erb"
mode "0644"
owner "root"
group "root"
notifies :restart, "service[httpd]", :delayed
#######################
# Setup and Install PHP
include_recipe "#{cookbook_name}::server_php"
#######################
# Install Zabbix Server
case node['zabbix']['database']['backend']
when 'postgresql'
%w(zabbix-server-pgsql zabbix-web-pgsql zabbix-get).each do |pkg|
package pkg
end
when 'mysql', 'mariadb', 'percona'
%w(zabbix-server-mysql zabbix-web-mysql zabbix-get).each do |pkg|
package pkg
end
end
#########################
# Configure Zabbix Server
template "/etc/zabbix/zabbix_server.conf" do
credentials = Chef::EncryptedDataBagItem.load("odhp_credentials", "credentials")
credentials = chef_vault_item("secrets", "zabbix")
variables({
:DBPassword => credentials['zabbix']['postgres_password']
:DBUsername => credentials['username'],
:DBPassword => credentials['password'],
:DBDatabase => credentials['database']
})
source "zabbix_server.conf.erb"
source %W{
zabbix/#{node['zabbix']['version']}/#{node['platform']}-#{node['platform_version'].to_i}/zabbix_server.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform']}/zabbix_server.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}-#{node['platform_version'].to_i}/zabbix_server.conf.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}/zabbix_server.conf.erb
zabbix/#{node['zabbix']['version']}/zabbix_server.conf.erb
zabbix/zabbix_server.conf.erb
default/zabbix_server.conf.erb
zabbix_server.conf.erb
}
sensitive true
mode "0640"
mode "0640"
owner "root"
group "root"
notifies :restart, "service[zabbix-server]", :immediately
end
directory "/etc/zabbix/web" do
mode "0750"
owner "root"
group case node['zabbix']['php']['use_fpm']
when true
node['php']['fpm_group']
else
case node['zabbix']['webserver']['backend']
when 'apache'
node['apache']['group']
when 'nginx'
node['php']['fpm_group']
end
end
end
template "/etc/zabbix/web/zabbix.conf.php" do
credentials = Chef::EncryptedDataBagItem.load("odhp_credentials", "credentials")
credentials = chef_vault_item("secrets", "zabbix")
variables({
:DBPassword => credentials['zabbix']['postgres_password']
:DBUsername => credentials['username'],
:DBPassword => credentials['password'],
:DBDatabase => credentials['database']
})
source "zabbix_web.conf.erb"
source %W{
zabbix/#{node['zabbix']['version']}/#{node['platform']}-#{node['platform_version'].to_i}/zabbix.conf.php.erb
zabbix/#{node['zabbix']['version']}/#{node['platform']}/zabbix.conf.php.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}-#{node['platform_version'].to_i}/zabbix.conf.php.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}/zabbix.conf.php.erb
zabbix/#{node['zabbix']['version']}/zabbix.conf.php.erb
zabbix/zabbix.conf.php.erb
default/zabbix.conf.php.erb
zabbix.conf.php.erb
}
sensitive true
mode "0640"
mode "0640"
owner "root"
group "apache"
group case node['zabbix']['php']['use_fpm']
when true
node['php']['fpm_group']
else
case node['zabbix']['webserver']['backend']
when 'apache'
node['apache']['group']
when 'nginx'
node['php']['fpm_group']
end
end
end
template "/etc/php.ini" do
source "php.ini.erb"
mode "0644"
template "/etc/zabbix/web/maintenance.inc.php" do
source %W{
zabbix/#{node['zabbix']['version']}/#{node['platform']}-#{node['platform_version'].to_i}/maintenance.inc.php.erb
zabbix/#{node['zabbix']['version']}/#{node['platform']}/maintenance.inc.php.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}-#{node['platform_version'].to_i}/maintenance.inc.php.erb
zabbix/#{node['zabbix']['version']}/#{node['platform_family']}/maintenance.inc.php.erb
zabbix/#{node['zabbix']['version']}/maintenance.inc.php.erb
zabbix/maintenance.inc.php.erb
default/maintenance.inc.php.erb
maintenance.inc.php.erb
}
sensitive true
mode "0640"
owner "root"
group "root"
notifies :restart, "service[httpd]", :immediately
end
service 'httpd' do
supports :restart => true, :start => true
action :enable
group case node['zabbix']['php']['use_fpm']
when true
node['php']['fpm_group']
else
case node['zabbix']['webserver']['backend']
when 'apache'
node['apache']['group']
when 'nginx'
node['php']['fpm_group']
end
end
end
#################
# Manage Services
service 'zabbix-server' do
supports :restart => true, :start => true
action :enable
action [:enable, :start]
subscribes :restart, "template[/etc/zabbix/zabbix_server.conf]", :delayed
end
service 'php-fpm' do
action [:enable, :start]
subscribes :reload, "php_fpm_pool[default]", :delayed
only_if { node['zabbix']['php']['use_fpm'] }
end
######################
# Include Zabbix Agent
include_recipe 'zabbix::agent'

36
recipes/server_apache.rb Normal file
View File

@ -0,0 +1,36 @@
#
# Cookbook Name:: zabbix
# Recipe:: server_apache
#
# Copyright 2017, Linux-Help.org
# Authors:
# Eric Renfro <psi-jack@linux-help.org>
#
include_recipe 'apache2'
##########################
# Setup and Install Apache
%w(proxy proxy_fcgi).each do |mod|
apache_module mod do
only_if { node['zabbix']['php']['use_fpm'] }
end
end
web_app "zabbix" do
tname = node['zabbix']['php']['use_fpm'] ? "zabbix-fpm" : "zabbix-mod"
server_name node['fqdn']
server_aliases ["zabbix.#{node['domain']}"]
template %W{
apache/#{node['platform']}/#{node['platform_version'].to_i}/#{tname}.conf.erb
apache/#{node['platform']}/#{tname}.conf.erb
apache/#{node['platform_family']}/#{node['platform_version'].to_i}/#{tname}.conf.erb
apache/#{node['platform_family']}/#{tname}.conf.erb
apache/default/#{tname}.conf.erb
apache/#{tname}.conf.erb
}
docroot "/usr/share/zabbix"
directory_index ["index.php"]
directory_options [ "FollowSymLinks" ]
allow_override [ "None" ]
end

34
recipes/server_nginx.rb Normal file
View File

@ -0,0 +1,34 @@
#
# Cookbook Name:: zabbix
# Recipe:: server_nginx
#
# Copyright 2017, Linux-Help.org
# Authors:
# Eric Renfro <psi-jack@linux-help.org>
#
#########################
# Setup and Install nginx
node.default['nginx']['default_site_enabled'] = false
include_recipe 'chef_nginx'
nginx_site "zabbix" do
template 'nginx/zabbix.conf.erb'
variables({
:params => {
:server_port => node['zabbix']['webserver']['port'],
:ssl_port => node['zabbix']['ssl']['port'],
:server_name => [ "#{node['fqdn']}, zabbix.#{node['domain']}" ],
:docroot => '/usr/share/zabbix',
:cacert => node['zabbix']['ssl']['cacert'],
:server_cert => node['zabbix']['ssl']['server_cert'],
:server_key => node['zabbix']['ssl']['server_key'],
:ssl_proto => node['zabbix']['ssl']['ssl_protocols'],
:ssl_ciphers => node['zabbix']['ssl']['ssl_ciphers']
}
})
end
file "/etc/nginx/conf.d/default.conf" do
action :delete
end

82
recipes/server_php.rb Normal file
View File

@ -0,0 +1,82 @@
#
# Cookbook Name:: zabbix
# Recipe:: server_php
#
# Copyright 2017, Linux-Help.org
# Authors:
# Eric Renfro <psi-jack@linux-help.org>
#
#######################
# Install and Setup PHP
case node['platform_family']
when 'rhel'
# Remove distro-provided versions if installed
%w(php php-cli php-pear php-devel php-common).each do |pkg|
package pkg do
action :remove
end
end
# Setup PHP to use yum-ius packages
node.default['php']['packages'] = %w(php56u php56u-bcmath php56u-gd php56u-mbstring php56u-xml php56u-xmlrpc php56u-cli php56u-opcache)
node.default['php']['fpm_package'] = 'php56u-fpm'
node.default['php']['fpm_user'] = 'php-fpm'
node.default['php']['fpm_group'] = 'php-fpm'
node.default['php']['gd']['package'] = 'php56u-gd'
node.default['php']['apcu']['package'] = 'php56u-pecl-apcu'
node.default['php']['ldap']['package'] = 'php56u-ldap'
if node['zabbix']['php']['use_fpm'] != true
if node['zabbix']['webserver']['backend'] == 'apache'
node.default['php']['packages'] += ['php56u']
end
end
case node['zabbix']['database']['backend']
when 'postgresql'
node.default['php']['packages'] += ['php56u-pgsql']
node.default['php']['postgresql']['package'] = 'php56u-pgsql'
when 'mysql', 'mariadb', 'percona'
node.default['php']['packages'] += ['php56u-mysqlnd']
node.default['php']['mysql']['package'] = 'php56u-mysqlnd'
end
end
# Set PHP timezone
node.default['php']['directives'] = {
'date.timezone' => node['zabbix']['php']['timezone']
}
include_recipe 'php'
#############################
# Install PHP-FPM Zabbix pool
php_fpm_pool 'zabbix' do
listen '127.0.0.1:9001'
user 'php-fpm'
group 'php-fpm'
#chdir '/usr/share/zabbix'
max_children 50
start_servers 5
min_spare_servers 5
max_spare_servers 35
additional_config({
'pm.process_idle_timeout' => '10s',
'pm.max_requests' => '500',
'ping.path' => '/ping',
'ping.response' => 'pong',
'php_flag[display_errors]' => 'off',
'php_admin_value[error_log]' => '/var/log/php-fpm/www-error.log',
'php_admin_flag[log_errors]' => 'on',
'php_admin_value[memory_limit]' => '128M',
'php_value[session.save_handler]' => 'files',
'php_value[session.save_path]' => '/var/lib/php-fpm/session',
'php_value[soap.wsdl_cache_dir]' => '/var/lib/php-fpm/wsdlcache',
'php_value[max_execution_time]' => '300',
'php_value[post_max_size]' => '16M',
'php_value[upload_max_filesize]' => '2M',
'php_value[max_input_time]' => '300',
'php_value[always_populate_raw_post_data]' => '-1'
})
action :install
only_if { node['zabbix']['php']['use_fpm'] || node['zabbix']['webserver']['backend'] == 'nginx' }
end

View File

@ -0,0 +1,77 @@
<% if node['apache']['version'] != '2.4' -%>
NameVirtualHost *:<%= @params[:server_port] %>
<% end -%>
<VirtualHost *:<%= @params[:server_port] %>>
ServerName <%= @params[:server_name] %>
<% if @params[:server_aliases] -%>
ServerAlias <%= @params[:server_aliases].join " " %>
<% end -%>
DocumentRoot <%= @params[:docroot] %>
# The following lines prevent .user.ini files from being viewed by Web clients.
<Files ".user.ini">
Require all denied
</Files>
# Allow php to handle Multiviews.
AddType text/html .php
# Enable http authorization headers.
SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9001/usr/share/zabbix/$1
<Directory <%= @params[:docroot] %>>
Options <%= [@params[:directory_options] || "FollowSymLinks" ].flatten.join " " %>
AllowOverride <%= [@params[:allow_override] || "None" ].flatten.join " " %>
<% if node['apache']['version'] == '2.4' -%>
Require all granted
<% else -%>
Order allow,deny
Allow from all
<% end -%>
</Directory>
<Directory <%= @params[:docroot] %>/conf>
<% if node['apache']['version'] == '2.4' -%>
Require all denied
<% else -%>
Order deny,allow
Deny from all
<% end -%>
</Directory>
<Directory <%= @params[:docroot] %>/app>
<% if node['apache']['version'] == '2.4' -%>
Require all denied
<% else -%>
Order deny,allow
Deny from all
<% end -%>
</Directory>
<Directory <%= @params[:docroot] %>/include>
<% if node['apache']['version'] == '2.4' -%>
Require all denied
<% else -%>
Order deny,allow
Deny from all
<% end -%>
</Directory>
<Directory <%= @params[:docroot] %>/local>
<% if node['apache']['version'] == '2.4' -%>
Require all denied
<% else -%>
Order deny,allow
Deny from all
<% end -%>
</Directory>
ErrorLog <%= node['apache']['log_dir'] %>/<%= @params[:name] %>-error.log
CustomLog <%= node['apache']['log_dir'] %>/<%= @params[:name] %>-access.log combined
<% if @params[:directory_index] -%>
DirectoryIndex <%= [@params[:directory_index]].flatten.join " " %>
<% end -%>
</VirtualHost>

View File

@ -0,0 +1,81 @@
<% if node['apache']['version'] != '2.4' -%>
NameVirtualHost *:<%= @params[:server_port] %>
<% end -%>
<VirtualHost *:<%= @params[:server_port] %>>
ServerName <%= @params[:server_name] %>
<% if @params[:server_aliases] -%>
ServerAlias <%= @params[:server_aliases].join " " %>
<% end -%>
DocumentRoot <%= @params[:docroot] %>
# The following lines prevent .user.ini files from being viewed by Web clients.
<Files ".user.ini">
Require all denied
</Files>
# Allow php to handle Multiviews.
AddType text/html .php
<IfModule mod_php5.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
</IfModule>
<Directory <%= @params[:docroot] %>>
Options <%= [@params[:directory_options] || "FollowSymLinks" ].flatten.join " " %>
AllowOverride <%= [@params[:allow_override] || "None" ].flatten.join " " %>
<% if node['apache']['version'] == '2.4' -%>
Require all granted
<% else -%>
Order allow,deny
Allow from all
<% end -%>
</Directory>
<Directory <%= @params[:docroot] %>/conf>
<% if node['apache']['version'] == '2.4' -%>
Require all denied
<% else -%>
Order deny,allow
Deny from all
<% end -%>
</Directory>
<Directory <%= @params[:docroot] %>/app>
<% if node['apache']['version'] == '2.4' -%>
Require all denied
<% else -%>
Order deny,allow
Deny from all
<% end -%>
</Directory>
<Directory <%= @params[:docroot] %>/include>
<% if node['apache']['version'] == '2.4' -%>
Require all denied
<% else -%>
Order deny,allow
Deny from all
<% end -%>
</Directory>
<Directory <%= @params[:docroot] %>/local>
<% if node['apache']['version'] == '2.4' -%>
Require all denied
<% else -%>
Order deny,allow
Deny from all
<% end -%>
</Directory>
ErrorLog <%= node['apache']['log_dir'] %>/<%= @params[:name] %>-error.log
CustomLog <%= node['apache']['log_dir'] %>/<%= @params[:name] %>-access.log combined
<% if @params[:directory_index] -%>
DirectoryIndex <%= [@params[:directory_index]].flatten.join " " %>
<% end -%>
</VirtualHost>

View File

@ -1,9 +0,0 @@
# MANAGED BY CHEF, DO NOT MODIFY
#
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 md5
host all all 10.10.2.0/16 md5
# IPV6 local connections:
host all all ::1/128 md5

View File

@ -0,0 +1,26 @@
[zabbix]
user = php-fpm
group = php-fpm
listen = 127.0.0.1:9001
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.process_idle_timeout = 10s;
pm.max_requests = 500
ping.path = /ping
ping.response = pong
php_flag[display_errors] = off
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_admin_value[memory_limit] = 128M
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php-fpm/session
php_value[soap.wsdl_cache_dir] = /var/lib/php-fpm/wsdlcache
php_value[max_execution_time] = 300
php_value[post_max_size] = 16M
php_value[upload_max_filesize] = 2M
php_value[max_input_time] = 300
php_value[always_populate_raw_post_data] = -1

View File

@ -0,0 +1,62 @@
upstream php-handler {
server 127.0.0.1:9001;
}
<% if node['zabbix']['ssl']['enable'] %>
server {
listen <%= @params['server_port'] %> default_server;
listen [::]:<%= @params['server_port'] %> default_server;
server_name _;
return 301 https://$host:<%= @params['ssl_port'] %>$request_uri;
}
<% end %>
server {
<% if node['zabbix']['ssl']['enable'] %>
listen <%= @params[:ssl_port] %> default_server;
listen [::]:<%= @params[:ssl_port] %> default_server;
<% else %>
listen <%= @params[:server_port] %> default_server;
listen [::]:<%= @params[:server_port] %> default_server;
<% end %>
server_name <%= [@params[:server_name]].flatten.join ", " %>;
access_log /var/log/nginx/zabbix.log;
error_log /var/log/nginx/zabbix.error;
<% if node['zabbix']['ssl']['enable'] %>
ssl on;
ssl_certificate <%= @params[:server_cert] %>;
ssl_certificate_key <%= @params[:server_cert] %>;
ssl_protocols <%= [@params[:ssl_proto]].flatten.join " " %>;
#ssl_ciphers <%= [@params[:ssl_ciphers]].flatten.join ":" %>;
<% end %>
root <%= @params[:docroot] %>;
index index.php index.html;
client_max_body_size 5m;
client_body_buffer_size 128k;
#location ~ \.php$ {
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
#fastcgi_pass unix:/var/run/zabbix.socket;
fastcgi_pass php-handler;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ {
expires max;
log_not_found off;
}
location ~ /\.ht {
deny all;
}
location ~ /\. {
deny all;
}
}

View File

@ -0,0 +1,29 @@
<?php
/*
** Zabbix
** Copyright (C) 2001-2016 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
// Maintenance mode
//define('ZBX_DENY_GUI_ACCESS', 1);
// IP range, who are allowed to connect to FrontEnd
//$ZBX_GUI_ACCESS_IP_RANGE = array('127.0.0.1');
// MSG shown on Warning screen!
//$_REQUEST['warning_msg'] = 'Zabbix is under maintenance.';

View File

@ -1,12 +1,14 @@
<?php
// MANAGED BY CHEF
//
// Zabbix GUI configuration file.
global $DB;
$DB['TYPE'] = 'POSTGRESQL';
$DB['SERVER'] = 'localhost';
$DB['PORT'] = '0';
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbixmaster';
$DB['DATABASE'] = '<%= @DBDatabase %>';
$DB['USER'] = '<%= @DBUsername %>';
$DB['PASSWORD'] = '<%= @DBPassword %>';
// Schema name. Used for IBM DB2 and PostgreSQL.
@ -17,4 +19,3 @@ $ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'Zabbix';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;

View File

@ -81,7 +81,7 @@ PidFile=/var/run/zabbix/zabbix_server.pid
# Default:
# DBName=
DBName=zabbix
DBName=<%= @DBDatabase %>
### Option: DBSchema
# Schema name. Used for IBM DB2 and PostgreSQL.
@ -97,7 +97,7 @@ DBName=zabbix
# Default:
# DBUser=
DBUser=zabbixmaster
DBUser=<%= @DBUsername %>
### Option: DBPassword
# Database password. Ignored for SQLite.

View File

@ -0,0 +1,6 @@
{
"id": "zabbix",
"username": "zabbix",
"password": "password",
"database": "zabbix"
}

View File

@ -1,5 +1,5 @@
{
"name": "integration_test_env",
"name": "test",
"description": "placeholder for integration testing",
"cookbook_versions": {