fuel-library/deployment/puppet/zabbix/manifests/params.pp
Stanislaw Bogatkin 9ea83a7d15 Separate zabbix top-scope role
* Move zabbix role out of legcay/cluster_ha manifests.
* Update tasks.yaml accordingly.
* Update existing classes to work properly with new task.

Change-Id: I50dd06bd7432d7d8ea5fd05ee64c84ee3628a918
Partial-blueprint: fuel-library-modularization
2015-02-02 14:59:47 +00:00

127 lines
4.3 KiB
Puppet

class zabbix::params {
# $enabled = ! empty(get_server_by_role($::fuel_settings['nodes'], 'zabbix-server'))
# if $enabled {
include zabbix::params::openstack
# $enabled = $::fuel_settings['zabbix']['enabled']
$server = (hiera('role') == 'zabbix-server')
$frontend = true
case $::operatingsystem {
'Ubuntu', 'Debian': {
$agent_pkg = 'zabbix-agent'
$server_pkg = 'zabbix-server-mysql'
$frontend_pkg = 'zabbix-frontend-php'
$agent_service = 'zabbix-agent'
$server_service = 'zabbix-server'
$agent_log_file = '/var/log/zabbix/zabbix_agentd.log'
$server_log_file = '/var/log/zabbix-server/zabbix_server.log'
$frontend_config = '/etc/zabbix/web/zabbix.conf.php'
$frontend_php_ini = '/etc/php5/conf.d/zabbix.ini'
$prepare_schema_cmd = 'cat /usr/share/zabbix-server-mysql/schema.sql /usr/share/zabbix-server-mysql/images.sql > /tmp/zabbix/schema.sql'
$frontend_service = 'apache2'
$mysql_server_pkg = 'mysql-server-wsrep-5.6'
$mysql_client_pkg = 'mysql-client-5.6'
}
'CentOS', 'RedHat': {
$agent_pkg = 'zabbix-agent'
$server_pkg = 'zabbix-server-mysql'
$frontend_pkg = 'zabbix-web-mysql'
$agent_service = 'zabbix-agent'
$server_service = 'zabbix-server'
$agent_log_file = '/var/log/zabbix/zabbix_agentd.log'
$server_log_file = '/var/log/zabbix/zabbix_server.log'
$frontend_config = '/etc/zabbix/web/zabbix.conf.php'
$frontend_php_ini = '/etc/php.d/zabbix.ini'
$prepare_schema_cmd = 'cat /usr/share/doc/zabbix-server-mysql-`zabbix_server -V | awk \'/v[0-9].[0-9].[0-9]/{print substr($3, 2)}\'`/create/schema.sql /usr/share/doc/zabbix-server-mysql-`zabbix_server -V | awk \'/v[0-9].[0-9].[0-9]/{print substr($3, 2)}\'`/create/images.sql > /tmp/zabbix/schema.sql'
$frontend_service = 'httpd'
$mysql_server_pkg = "MySQL-server-wsrep"
$mysql_client_pkg = 'MySQL-client-wsrep'
}
}
$agent_listen_ip = $::internal_address
$agent_source_ip = $::internal_address
$agent_listen_port = '10050'
$agent_hostname = $::hostname
$agent_config_template = 'zabbix/zabbix_agentd.conf.erb'
$agent_config = '/etc/zabbix/zabbix_agentd.conf'
$agent_pid_file = '/var/run/zabbix/zabbix_agentd.pid'
$agent_include = '/etc/zabbix/zabbix_agentd.d'
$agent_scripts = '/etc/zabbix/scripts'
$userparameters = {}
#server parameters
$server_node = get_server_by_role(hiera('nodes',{}), 'zabbix-server')
if $server_node != '' {
$server_hostname = $server_node['fqdn']
$server_ip = $server_node['internal_address']
}
$server_listen_port = '10051'
$server_include_path = '/etc/zabbix/agent_server.conf'
$server_config = '/etc/zabbix/zabbix_server.conf'
$server_config_template = 'zabbix/zabbix_server.conf.erb'
#$server_node_id = fqdn_rand(1000)
$server_node_id = 0
$server_ensure = present
#frontend parameters
$frontend_ensure = present
$frontend_hostname = $::fqdn
$frontend_base = '/zabbix'
$frontend_vhost_class = 'zabbix::frontend::vhost'
$frontend_port = 80
$frontend_timezone = $::timezone
$frontend_config_template = 'zabbix/zabbix.conf.php.erb'
$frontend_php_ini_template = 'zabbix/php_ini.erb'
# credentials
$zabbix_hash = hiera('zabbix',{})
$username = $zabbix_hash['username']
$password = $zabbix_hash['password']
$password_hash = md5($password)
#api parameters
$api_url = "http://${zabbix::params::server_ip}${zabbix::params::frontend_base}/api_jsonrpc.php"
$api_username = $username
$api_password = $password
$api_hash = { endpoint => $api_url,
username => $api_username,
password => $api_password }
#common parameters
$version = $::zabbixversion
$db_type = 'MYSQL'
$db_host = 'localhost'
$db_port = '3306'
$db_name = 'zabbix'
$db_user = 'zabbix'
$db_password = $zabbix_hash['db_password']
$db_root_password = $zabbix_hash['db_root_password']
#zabbix hosts params
$host_name = $::fqdn
$host_ip = $::internal_address
$host_groups = ['ManagedByPuppet']
# }
}