From 89196c3022844f1d6cc61752c48f9e293b842d08 Mon Sep 17 00:00:00 2001 From: Szymon Banka Date: Thu, 19 Mar 2015 12:38:07 +0100 Subject: [PATCH] add Zabbix plugin code Change-Id: I9e1c1073453a4f49f660ad992df1e861c6e45373 --- .gitignore | 4 + LICENSE | 176 + deployment_scripts/puppet/manifests/agent.pp | 30 + .../puppet/manifests/controller.pp | 16 + .../puppet/manifests/primary_controller.pp | 16 + .../puppet/manifests/zabbix_server_config.pp | 16 + .../puppet/modules/plugin_zabbix/AUTHORS.txt | 6 + .../puppet/modules/plugin_zabbix/LICENSE | 201 + .../puppet/modules/plugin_zabbix/Modulefile | 6 + .../files/externalscripts/db_clean.sh | 11 + .../import/Screens_OpenStack_Cluster.xml | 137 + .../files/import/Template_App_HAProxy.xml | 6126 +++++++++++++++++ .../import/Template_App_Iptables_Stats.xml | 482 ++ .../files/import/Template_App_Memcache.xml | 1294 ++++ .../files/import/Template_App_MySQL.xml | 798 +++ .../Template_App_OpenStack_Ceilometer.xml | 430 ++ ...plate_App_OpenStack_Ceilometer_Compute.xml | 86 + .../import/Template_App_OpenStack_Ceph.xml | 138 + .../Template_App_OpenStack_Cinder_API.xml | 132 + ...emplate_App_OpenStack_Cinder_API_check.xml | 83 + ...emplate_App_OpenStack_Cinder_Scheduler.xml | 83 + .../Template_App_OpenStack_Cinder_Volume.xml | 128 + .../Template_App_OpenStack_Glance_API.xml | 132 + ...emplate_App_OpenStack_Glance_API_check.xml | 83 + ...Template_App_OpenStack_Glance_Registry.xml | 132 + .../import/Template_App_OpenStack_Horizon.xml | 181 + .../Template_App_OpenStack_Keystone.xml | 181 + ...plate_App_OpenStack_Keystone_API_check.xml | 132 + .../import/Template_App_OpenStack_Libvirt.xml | 83 + ...mplate_App_OpenStack_Neutron_API_check.xml | 83 + ...plate_App_OpenStack_Neutron_DHCP_Agent.xml | 128 + ...emplate_App_OpenStack_Neutron_L3_Agent.xml | 128 + ...e_App_OpenStack_Neutron_Metadata_Agent.xml | 83 + ...mplate_App_OpenStack_Neutron_OVS_Agent.xml | 83 + .../Template_App_OpenStack_Neutron_Server.xml | 138 + .../Template_App_OpenStack_Nova_API.xml | 83 + .../Template_App_OpenStack_Nova_API_EC2.xml | 83 + ...mplate_App_OpenStack_Nova_API_Metadata.xml | 83 + .../Template_App_OpenStack_Nova_API_OSAPI.xml | 83 + ...ate_App_OpenStack_Nova_API_OSAPI_check.xml | 83 + .../Template_App_OpenStack_Nova_Cert.xml | 83 + .../Template_App_OpenStack_Nova_Compute.xml | 83 + ...emplate_App_OpenStack_Nova_ConsoleAuth.xml | 83 + .../Template_App_OpenStack_Nova_Network.xml | 83 + .../Template_App_OpenStack_Nova_Scheduler.xml | 83 + .../Template_App_OpenStack_Open_vSwitch.xml | 132 + .../Template_App_OpenStack_RabbitMQ_ha.xml | 474 ++ .../Template_App_OpenStack_Swift_Account.xml | 181 + ...Template_App_OpenStack_Swift_Container.xml | 181 + .../Template_App_OpenStack_Swift_Object.xml | 181 + .../Template_App_OpenStack_Swift_Proxy.xml | 132 + .../import/Template_App_Zabbix_Agent.xml | 183 + .../import/Template_App_Zabbix_Server.xml | 1758 +++++ .../files/import/Template_Fuel_OS_Linux.xml | 3065 +++++++++ .../import/Template_OpenStack_Cluster.xml | 1012 +++ .../files/scripts/ceph_health.sh | 7 + .../plugin_zabbix/files/scripts/check_api.py | 117 + .../files/scripts/check_rabbit.py | 128 + .../files/scripts/crm_node_check.sh | 12 + .../plugin_zabbix/files/scripts/haproxy.sh | 88 + .../plugin_zabbix/files/scripts/query_db.py | 57 + .../files/scripts/vfs.dev.discovery.sh | 19 + .../files/scripts/vfs.mdadm.discovery.sh | 17 + .../files/scripts/zabbix_checks_logger.py | 32 + .../plugin_zabbix/files/sql/block_dev.sql | 2 + .../files/zabbix-server-mysql.conf | 2 + .../plugin_zabbix/files/zabbix-server.ocf | 249 + .../modules/plugin_zabbix/files/zabbix-sudo | 5 + .../parser/functions/defined_in_state.rb | 24 + .../parser/functions/get_server_by_role.rb | 15 + .../lib/puppet/provider/plugin_zabbix.rb | 113 + .../ruby.rb | 100 + .../provider/plugin_zabbix_host/ruby.rb | 52 + .../provider/plugin_zabbix_hostgroup/ruby.rb | 25 + .../plugin_zabbix_template_link/ruby.rb | 51 + .../provider/plugin_zabbix_usermacro/ruby.rb | 116 + .../plugin_zabbix_configuration_import.rb | 59 + .../lib/puppet/type/plugin_zabbix_host.rb | 101 + .../puppet/type/plugin_zabbix_hostgroup.rb | 31 + .../type/plugin_zabbix_template_link.rb | 44 + .../puppet/type/plugin_zabbix_usermacro.rb | 64 + .../modules/plugin_zabbix/manifests/agent.pp | 66 + .../plugin_zabbix/manifests/agent/scripts.pp | 59 + .../manifests/agent/userparameter.pp | 47 + .../plugin_zabbix/manifests/controller.pp | 97 + .../modules/plugin_zabbix/manifests/db.pp | 26 + .../plugin_zabbix/manifests/db/mysql.pp | 72 + .../plugin_zabbix/manifests/db/mysql_db.pp | 58 + .../plugin_zabbix/manifests/frontend.pp | 95 + .../plugin_zabbix/manifests/ha/haproxy.pp | 97 + .../manifests/ha/haproxy_service.pp | 78 + .../modules/plugin_zabbix/manifests/init.pp | 16 + .../plugin_zabbix/manifests/monitoring.pp | 109 + .../monitoring/ceilometer_compute_mon.pp | 28 + .../manifests/monitoring/ceilometer_mon.pp | 28 + .../manifests/monitoring/ceph_mon.pp | 32 + .../manifests/monitoring/cinder_mon.pp | 53 + .../manifests/monitoring/firewall_mon.pp | 34 + .../manifests/monitoring/glance_mon.pp | 45 + .../manifests/monitoring/haproxy_mon.pp | 47 + .../manifests/monitoring/horizon_mon.pp | 28 + .../manifests/monitoring/keystone_mon.pp | 39 + .../manifests/monitoring/memcached_mon.pp | 32 + .../manifests/monitoring/mysql_mon.pp | 52 + .../manifests/monitoring/neutron_mon.pp | 76 + .../manifests/monitoring/nova_mon.pp | 109 + .../monitoring/openstack_virtual_mon.pp | 52 + .../manifests/monitoring/openvswitch_mon.pp | 27 + .../manifests/monitoring/rabbitmq_mon.pp | 55 + .../manifests/monitoring/swift_mon.pp | 46 + .../manifests/monitoring/zabbixserver_mon.pp | 26 + .../modules/plugin_zabbix/manifests/params.pp | 125 + .../manifests/params/openstack.pp | 47 + .../manifests/primary_controller.pp | 62 + .../plugin_zabbix/manifests/server/config.pp | 318 + .../modules/plugin_zabbix/spec/spec_helper.rb | 1 + .../provider/plugin_zabbix_host/ruby_spec.rb | 21 + .../spec/unit/provider/plugin_zabbix_spec.rb | 39 + .../plugin_zabbix_template_link/ruby_spec.rb | 33 + .../plugin_zabbix_usermacro/ruby_spec.rb | 33 + ...plugin_zabbix_configuration_import_spec.rb | 78 + .../spec/unit/type/plugin_zabbix_host_spec.rb | 167 + .../unit/type/plugin_zabbix_hostgroup_spec.rb | 77 + .../type/plugin_zabbix_template_link_spec.rb | 99 + .../unit/type/plugin_zabbix_usermacro_spec.rb | 122 + .../templates/check_api.conf.erb | 18 + .../plugin_zabbix/templates/check_db.conf.erb | 37 + .../templates/check_rabbit.conf.erb | 7 + .../plugin_zabbix/templates/data_clean.erb | 50 + .../plugin_zabbix/templates/my.cnf.erb | 4 + .../templates/zabbix.conf.php.erb | 18 + .../templates/zabbix_agent_userparam.conf.erb | 1 + .../templates/zabbix_agentd.conf.erb | 37 + .../templates/zabbix_server.conf.erb | 160 + environment_config.yaml | 19 + metadata.yaml | 33 + pre_build_hook | 34 + repositories/centos/.gitkeep | 0 repositories/ubuntu/.gitkeep | 0 tasks.yaml | 28 + 140 files changed, 24922 insertions(+) create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 deployment_scripts/puppet/manifests/agent.pp create mode 100644 deployment_scripts/puppet/manifests/controller.pp create mode 100644 deployment_scripts/puppet/manifests/primary_controller.pp create mode 100644 deployment_scripts/puppet/manifests/zabbix_server_config.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/AUTHORS.txt create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/LICENSE create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/Modulefile create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/externalscripts/db_clean.sh create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Screens_OpenStack_Cluster.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_HAProxy.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Iptables_Stats.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Memcache.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_MySQL.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceilometer.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceilometer_Compute.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceph.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_API.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_API_check.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_Scheduler.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_Volume.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_API.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_API_check.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_Registry.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Horizon.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Keystone.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Keystone_API_check.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Libvirt.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_API_check.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_DHCP_Agent.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_L3_Agent.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_Metadata_Agent.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_OVS_Agent.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_Server.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_EC2.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_Metadata.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_OSAPI.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_OSAPI_check.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Cert.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Compute.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_ConsoleAuth.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Network.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Scheduler.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Open_vSwitch.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_RabbitMQ_ha.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Account.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Container.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Object.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Proxy.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Zabbix_Agent.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Zabbix_Server.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_Fuel_OS_Linux.xml create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_OpenStack_Cluster.xml create mode 100755 deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/ceph_health.sh create mode 100755 deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/check_api.py create mode 100755 deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/check_rabbit.py create mode 100755 deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/crm_node_check.sh create mode 100755 deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/haproxy.sh create mode 100755 deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/query_db.py create mode 100755 deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/vfs.dev.discovery.sh create mode 100755 deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/vfs.mdadm.discovery.sh create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/zabbix_checks_logger.py create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/sql/block_dev.sql create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-server-mysql.conf create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-server.ocf create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-sudo create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/parser/functions/defined_in_state.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/parser/functions/get_server_by_role.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_configuration_import/ruby.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_host/ruby.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_hostgroup/ruby.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_template_link/ruby.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_usermacro/ruby.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_configuration_import.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_host.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_hostgroup.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_template_link.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_usermacro.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent/scripts.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent/userparameter.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/controller.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/db.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/db/mysql.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/db/mysql_db.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/frontend.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/ha/haproxy.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/ha/haproxy_service.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/init.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceilometer_compute_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceilometer_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceph_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/cinder_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/firewall_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/glance_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/haproxy_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/horizon_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/keystone_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/memcached_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/mysql_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/neutron_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/nova_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/openstack_virtual_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/openvswitch_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/rabbitmq_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/swift_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/zabbixserver_mon.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/params.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/params/openstack.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/primary_controller.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/manifests/server/config.pp create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/spec/spec_helper.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_host/ruby_spec.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_spec.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_template_link/ruby_spec.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_usermacro/ruby_spec.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_configuration_import_spec.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_host_spec.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_hostgroup_spec.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_template_link_spec.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_usermacro_spec.rb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/templates/check_api.conf.erb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/templates/check_db.conf.erb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/templates/check_rabbit.conf.erb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/templates/data_clean.erb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/templates/my.cnf.erb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix.conf.php.erb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_agent_userparam.conf.erb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_agentd.conf.erb create mode 100644 deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_server.conf.erb create mode 100644 environment_config.yaml create mode 100644 metadata.yaml create mode 100755 pre_build_hook create mode 100644 repositories/centos/.gitkeep create mode 100644 repositories/ubuntu/.gitkeep create mode 100644 tasks.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2a41f2e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.build/ +zabbix_monitoring*.noarch.rpm +repositories/centos/*.rpm +repositories/ubuntu/*.deb diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..68c771a --- /dev/null +++ b/LICENSE @@ -0,0 +1,176 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + diff --git a/deployment_scripts/puppet/manifests/agent.pp b/deployment_scripts/puppet/manifests/agent.pp new file mode 100644 index 0000000..76800c5 --- /dev/null +++ b/deployment_scripts/puppet/manifests/agent.pp @@ -0,0 +1,30 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +$nodes_hash = hiera('nodes') + +$primary_controller_nodes = filter_nodes($nodes_hash,'role','primary-controller') +$controllers = concat($primary_controller_nodes, filter_nodes($nodes_hash,'role','controller')) +$controller_internal_addresses = nodes_to_hash($controllers,'name','internal_address') +$controller_nodes = ipsort(values($controller_internal_addresses)) + +$node_data = filter_nodes($nodes_hash,'fqdn',$::fqdn) +$internal_address = join(values(nodes_to_hash($node_data,'name','internal_address'))) +$public_address = join(values(nodes_to_hash($node_data,'name','public_address'))) +$swift_address = join(values(nodes_to_hash($node_data,'name','storage_address'))) + +class { 'plugin_zabbix::monitoring': + server_ips => $controller_nodes, +} diff --git a/deployment_scripts/puppet/manifests/controller.pp b/deployment_scripts/puppet/manifests/controller.pp new file mode 100644 index 0000000..798dfc6 --- /dev/null +++ b/deployment_scripts/puppet/manifests/controller.pp @@ -0,0 +1,16 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +include plugin_zabbix::controller diff --git a/deployment_scripts/puppet/manifests/primary_controller.pp b/deployment_scripts/puppet/manifests/primary_controller.pp new file mode 100644 index 0000000..5de3b77 --- /dev/null +++ b/deployment_scripts/puppet/manifests/primary_controller.pp @@ -0,0 +1,16 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +include plugin_zabbix::primary_controller diff --git a/deployment_scripts/puppet/manifests/zabbix_server_config.pp b/deployment_scripts/puppet/manifests/zabbix_server_config.pp new file mode 100644 index 0000000..bfc5317 --- /dev/null +++ b/deployment_scripts/puppet/manifests/zabbix_server_config.pp @@ -0,0 +1,16 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +include plugin_zabbix::server::config diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/AUTHORS.txt b/deployment_scripts/puppet/modules/plugin_zabbix/AUTHORS.txt new file mode 100644 index 0000000..b8f5d0c --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/AUTHORS.txt @@ -0,0 +1,6 @@ +Damian Szeluga +Kamil Swiatkowski +Szymon Banka +Tomasz 'Zen' Napierala +Dmitry Nikishov +Piotr Misiak diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/LICENSE b/deployment_scripts/puppet/modules/plugin_zabbix/LICENSE new file mode 100644 index 0000000..ad410e1 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/LICENSE @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/Modulefile b/deployment_scripts/puppet/modules/plugin_zabbix/Modulefile new file mode 100644 index 0000000..ba89a22 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/Modulefile @@ -0,0 +1,6 @@ +name 'puppet-zabbix' +version '0.1.0' + +license 'Apache' +summary 'Zabbix puppet module' +description "This module installs and manages Zabbix. It is intended to work within fuel-library. It is a reimplementation of the old module by PL team." diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/externalscripts/db_clean.sh b/deployment_scripts/puppet/modules/plugin_zabbix/files/externalscripts/db_clean.sh new file mode 100644 index 0000000..a66895e --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/externalscripts/db_clean.sh @@ -0,0 +1,11 @@ +#!/bin/bash +mysql zabbix -e " +update triggers set value=0,error='' where triggerid in ( + select ee.objectid from events ee + inner join + (select objectid,MAX(eventid) as maxid + from events + group by objectid) + ee2 on ee.objectid=ee2.objectid and ee.eventid=ee2.maxid + where + ee.acknowledged=1) and value=1 and description in ('SNMPtrigger Critical: {ITEM.VALUE1}', 'SNMPtrigger Error: {ITEM.VALUE1}', 'SNMPtrigger Warning: {ITEM.VALUE1}', 'SNMPtrigger Information: {ITEM.VALUE1}');" diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Screens_OpenStack_Cluster.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Screens_OpenStack_Cluster.xml new file mode 100644 index 0000000..d62072a --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Screens_OpenStack_Cluster.xml @@ -0,0 +1,137 @@ + + + 2.0 + 2014-12-10T10:36:40Z + + + Openstack Cluster + 2 + 3 + + + 0 + 500 + 100 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + + + 0 + 0 + + Cluster CPU Load + OpenStackCluster + + + + + 0 + 500 + 100 + 0 + 1 + 1 + 1 + 0 + 0 + 0 + + + 0 + 0 + + CPUs in Cluster + OpenStackCluster + + + + + 0 + 500 + 100 + 1 + 1 + 1 + 1 + 0 + 0 + 0 + + + 0 + 0 + + RAM in Cluster + OpenStackCluster + + + + + 13 + 500 + 100 + 1 + 0 + 1 + 1 + 10 + 0 + 0 + + + 0 + 0 + 0 + + + + 0 + 500 + 100 + 0 + 2 + 1 + 1 + 0 + 0 + 0 + + + 0 + 0 + + Number of instances + OpenStackCluster + + + + + 0 + 500 + 100 + 1 + 2 + 1 + 1 + 0 + 0 + 0 + + + 0 + 0 + + Openstack Offline Services + OpenStackCluster + + + + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_HAProxy.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_HAProxy.xml new file mode 100644 index 0000000..892fecc --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_HAProxy.xml @@ -0,0 +1,6126 @@ + + + 2.0 + 2013-07-31T09:48:06Z + + + Load Balancers + + + Templates + + + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Iptables_Stats.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Iptables_Stats.xml new file mode 100644 index 0000000..f355321 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Iptables_Stats.xml @@ -0,0 +1,482 @@ + + + 2.0 + 2013-07-10T21:14:51Z + + + Templates + + + + + + + + FLUX + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 1 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 3 + 1 + 00CC00 + 1 + 2 + 0 + + Template App Iptables Stats + iptstate.udp + + + + 2 + 1 + FFFF00 + 1 + 2 + 0 + + Template App Iptables Stats + iptstate.icmp + + + + 1 + 1 + FF3333 + 1 + 2 + 0 + + Template App Iptables Stats + iptstate.other + + + + 4 + 1 + 0000CC + 1 + 2 + 0 + + Template App Iptables Stats + iptstate.tcp + + + + + + TCP + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 1 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 1 + 1 + 0000CC + 1 + 2 + 0 + + Template App Iptables Stats + iptstate.tcp.established + + + + 3 + 1 + FFFF00 + 1 + 2 + 0 + + Template App Iptables Stats + iptstate.tcp.syn + + + + 2 + 1 + 009999 + 1 + 2 + 0 + + Template App Iptables Stats + iptstate.tcp.timewait + + + + 4 + 1 + 666666 + 1 + 2 + 0 + + Template App Iptables Stats + iptstate.tcp.close + + + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Memcache.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Memcache.xml new file mode 100644 index 0000000..902e60c --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Memcache.xml @@ -0,0 +1,1294 @@ + + + 2.0 + 2013-07-16T21:38:19Z + + + Templates + + + + + + + + {Template App Memcache:proc.num[memcached,,,].last(0)}=0 + Memcached process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App Memcache:net.tcp.service[tcp,{$IP_MANAGEMENT},11211].last(0)}=0 + Memcache service is down on {HOSTNAME} + + 0 + 4 + + 0 + + + + + + Connections per second + 900 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 1 + 0 + 0 + 0 + + + 0 + 2 + 009900 + 0 + 2 + 0 + + Template App Memcache + memcache[total_connections] + + + + + + Current items + 900 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 2 + 009900 + 0 + 2 + 0 + + Template App Memcache + memcache[curr_items] + + + + + + Current open connections + 900 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 1 + 0 + 0 + 0 + + + 0 + 2 + 009900 + 0 + 2 + 0 + + Template App Memcache + memcache[curr_connections] + + + + + + Evictions + 900 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 2 + 990000 + 0 + 2 + 0 + + Template App Memcache + memcache[evictions] + + + + + + Items per second + 900 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 2 + 009900 + 0 + 2 + 0 + + Template App Memcache + memcache[total_items] + + + + + + Network traffic + 900 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 1 + 0 + 0 + 0 + + + 0 + 2 + 009900 + 0 + 2 + 0 + + Template App Memcache + memcache[bytes_read] + + + + 1 + 2 + 990000 + 0 + 2 + 0 + + Template App Memcache + memcache[bytes_written] + + + + + + Requests per second + 900 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 1 + 0 + 0 + 0 + + + 0 + 2 + 009900 + 0 + 2 + 0 + + Template App Memcache + memcache[cmd_get] + + + + 1 + 2 + 990000 + 0 + 2 + 0 + + Template App Memcache + memcache[cmd_set] + + + + + + Resource usage + 900 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 2 + 009900 + 0 + 2 + 0 + + Template App Memcache + memcache[rusage_user] + + + + 1 + 2 + 000099 + 0 + 2 + 0 + + Template App Memcache + memcache[rusage_system] + + + + + + Retrieval hit and miss per second + 900 + 200 + 0.0000 + 100.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 1 + 0 + 0 + 0 + + + 0 + 2 + 009900 + 0 + 2 + 0 + + Template App Memcache + memcache[get_hits] + + + + 1 + 2 + 990000 + 0 + 2 + 0 + + Template App Memcache + memcache[get_misses] + + + + + + Storage usage + 900 + 200 + 0.0000 + 0.0000 + 0 + 0 + 0 + 1 + 0 + 0.0000 + 0.0000 + 1 + 0 + 0 + 0 + + + 0 + 1 + 009900 + 0 + 2 + 0 + + Template App Memcache + memcache[limit_maxbytes] + + + + 1 + 1 + 990000 + 0 + 2 + 0 + + Template App Memcache + memcache[bytes] + + + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_MySQL.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_MySQL.xml new file mode 100644 index 0000000..c8f2cf5 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_MySQL.xml @@ -0,0 +1,798 @@ + + + 2.0 + 2013-07-10T21:15:06Z + + + Templates + + + + + + + + {Template App MySQL:mysql.ping.last(0)}=0 + MySQL is down + + 0 + 2 + + 0 + + + + + + MySQL bandwidth + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 5 + 00AA00 + 0 + 2 + 0 + + Template App MySQL + mysql.status[Bytes_received] + + + + 1 + 5 + 3333FF + 0 + 2 + 0 + + Template App MySQL + mysql.status[Bytes_sent] + + + + + + MySQL operations + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + C8C800 + 0 + 2 + 0 + + Template App MySQL + mysql.status[Com_begin] + + + + 1 + 0 + 006400 + 0 + 2 + 0 + + Template App MySQL + mysql.status[Com_commit] + + + + 2 + 0 + C80000 + 0 + 2 + 0 + + Template App MySQL + mysql.status[Com_delete] + + + + 3 + 0 + 0000EE + 0 + 2 + 0 + + Template App MySQL + mysql.status[Com_insert] + + + + 4 + 0 + 640000 + 0 + 2 + 0 + + Template App MySQL + mysql.status[Com_rollback] + + + + 5 + 0 + 00C800 + 0 + 2 + 0 + + Template App MySQL + mysql.status[Com_select] + + + + 6 + 0 + C800C8 + 0 + 2 + 0 + + Template App MySQL + mysql.status[Com_update] + + + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceilometer.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceilometer.xml new file mode 100644 index 0000000..96ecf25 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceilometer.xml @@ -0,0 +1,430 @@ + + + 2.0 + 2014-05-23T15:04:32Z + + + Templates + + + + + + + + {Template App OpenStack Ceilometer:proc.num[python,ceilometer,,ceilometer-agent-central].last(0)}=0 & {Template App OpenStack Ceilometer:crm.node.check[p_openstack-ceilometer-agent-central].last(0)}=1 + Ceilometer Alarm Agent Central service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Ceilometer:proc.num[python,ceilometer,,ceilometer-alarm-evaluator].last(0)}=0 & {Template App OpenStack Ceilometer:crm.node.check[p_openstack-ceilometer-alarm-evaluator].last(0)}=1 + Ceilometer Alarm Alarm Evaluator service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Ceilometer:proc.num[python,ceilometer,,ceilometer-alarm-notifier].last(0)}=0 + Ceilometer Alarm Notifier service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Ceilometer:proc.num[python,ceilometer,,ceilometer-api].last(0)}=0 + Ceilometer API Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Ceilometer:net.tcp.service[http,{$IP_MANAGEMENT},8777].last()}=0 + Ceilometer API Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Ceilometer:proc.num[python,ceilometer,,ceilometer-collector].last(0)}=0 + Ceilometer Collector service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceilometer_Compute.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceilometer_Compute.xml new file mode 100644 index 0000000..60b2bb7 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceilometer_Compute.xml @@ -0,0 +1,86 @@ + + + 2.0 + 2014-06-27T08:32:31Z + + + Templates + + + + + + + + {Template App OpenStack Ceilometer Compute:proc.num[python,ceilometer,,ceilometer-agent-compute].last(0)}=0 + Ceilometer Agent Compute service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceph.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceph.xml new file mode 100644 index 0000000..0138a9f --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Ceph.xml @@ -0,0 +1,138 @@ + + + 2.0 + 2014-12-04T13:12:00Z + + + Templates + + + + + + + + {Template App OpenStack Ceph:ceph.health.last(0)}=0 + Ceph health is not OK on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Ceph:proc.num[,,,/usr/bin/ceph-osd].last(0)}=0 + Ceph OSD process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_API.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_API.xml new file mode 100644 index 0000000..f6b663e --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_API.xml @@ -0,0 +1,132 @@ + + + 2.0 + 2013-07-10T21:15:29Z + + + Templates + + + + + + + + {Template App OpenStack Cinder API:proc.num[python,cinder,,cinder-api].last(0)}=0 + Cinder API Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Cinder API:net.tcp.service[http,{$IP_MANAGEMENT},8776].last(0)}=0 + Cinder API Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_API_check.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_API_check.xml new file mode 100644 index 0000000..2ce06bb --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_API_check.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-10T21:15:49Z + + + Templates + + + + + + + + {Template App OpenStack Cinder API check:cinder.api.status.last(0)}=0 + Cinder API test failed + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_Scheduler.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_Scheduler.xml new file mode 100644 index 0000000..4c68310 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_Scheduler.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-10T21:16:07Z + + + Templates + + + + + + + + {Template App OpenStack Cinder Scheduler:proc.num[python,cinder,,cinder-scheduler].last(0)}=0 + Cinder Scheduler process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_Volume.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_Volume.xml new file mode 100644 index 0000000..1c50a4f --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Cinder_Volume.xml @@ -0,0 +1,128 @@ + + + 2.0 + 2014-12-11T12:22:08Z + + + Templates + + + + + + + + {Template App OpenStack Cinder Volume:proc.num[python,cinder,,cinder-volume].last(0)}=0 & {Template App OpenStack Cinder Volume:crm.node.check[p_cinder-volume].last(0)}=1 + Cinder Volume process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_API.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_API.xml new file mode 100644 index 0000000..53adadc --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_API.xml @@ -0,0 +1,132 @@ + + + 2.0 + 2013-07-10T21:16:32Z + + + Templates + + + + + + + + {Template App OpenStack Glance API:proc.num[python,glance,,glance-api].last(0)}=0 + Glance API Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Glance API:net.tcp.service[http,{$IP_MANAGEMENT},9292].last(0)}=0 + Glance API Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_API_check.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_API_check.xml new file mode 100644 index 0000000..be5f590 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_API_check.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-10T21:16:53Z + + + Templates + + + + + + + + {Template App OpenStack Glance API check:glance.api.status.last(0)}=0 + Glance API test failed on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_Registry.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_Registry.xml new file mode 100644 index 0000000..77e7904 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Glance_Registry.xml @@ -0,0 +1,132 @@ + + + 2.0 + 2013-07-10T21:17:07Z + + + Templates + + + + + + + + {Template App OpenStack Glance Registry:proc.num[python,glance,,glance-registry].last(0)}=0 + Glance Registry Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Glance Registry:net.tcp.service[http,{$IP_MANAGEMENT},9191].last(0)}=0 + Glance Registry Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Horizon.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Horizon.xml new file mode 100644 index 0000000..d743cf4 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Horizon.xml @@ -0,0 +1,181 @@ + + + 2.0 + 2013-07-10T21:17:23Z + + + Templates + + + + + + + + {Template App OpenStack Horizon:proc.num[,apache,,/usr/sbin/httpd].last(0)}=0 + Horizon HTTP Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Horizon:net.tcp.service[http,{$IP_MANAGEMENT},80].last(0)}=0 + Horizon HTTP Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Horizon:net.tcp.service[https,{$IP_MANAGEMENT},443].last(0)}=0 + Horizon HTTPS Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Keystone.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Keystone.xml new file mode 100644 index 0000000..755268f --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Keystone.xml @@ -0,0 +1,181 @@ + + + 2.0 + 2013-07-10T21:17:37Z + + + Templates + + + + + + + + {Template App OpenStack Keystone:net.tcp.service[http,{$IP_MANAGEMENT},35357].last(0)}=0 + Keystone Admin API Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Keystone:net.tcp.service[http,{$IP_MANAGEMENT},5000].last(0)}=0 + Keystone API Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Keystone:proc.num[python,keystone,,keystone-all].last(0)}=0 + Keystone Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Keystone_API_check.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Keystone_API_check.xml new file mode 100644 index 0000000..4d7b36a --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Keystone_API_check.xml @@ -0,0 +1,132 @@ + + + 2.0 + 2013-07-10T21:17:50Z + + + Templates + + + + + + + + {Template App OpenStack Keystone API check:keystone.api.status.last(0)}=0 + Keystone API test failed on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Keystone API check:keystone.service.api.status.last(0)}=0 + Keystone Service API test failed on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Libvirt.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Libvirt.xml new file mode 100644 index 0000000..f06e6cc --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Libvirt.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-10T21:18:03Z + + + Templates + + + + + + + + {Template App OpenStack Libvirt:proc.num[libvirtd,root,,].last(0)}=0 + Libvirtd process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_API_check.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_API_check.xml new file mode 100644 index 0000000..4b632cc --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_API_check.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-10T21:19:34Z + + + Templates + + + + + + + + {Template App OpenStack Neutron API check:neutron.api.status.last(0)}=0 + Neutron API test failed on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_DHCP_Agent.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_DHCP_Agent.xml new file mode 100644 index 0000000..0dbb66c --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_DHCP_Agent.xml @@ -0,0 +1,128 @@ + + + 2.0 + 2014-05-23T08:33:55Z + + + Templates + + + + + + + + {Template App OpenStack Neutron DHCP Agent:proc.num[python,neutron,,neutron-dhcp-agent].last(0)}=0 & {Template App OpenStack Neutron DHCP Agent:crm.node.check[p_neutron-dhcp-agent].last(0)}=1 + Neutron DHCP Agent process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_L3_Agent.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_L3_Agent.xml new file mode 100644 index 0000000..f8dcc45 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_L3_Agent.xml @@ -0,0 +1,128 @@ + + + 2.0 + 2014-05-23T08:53:02Z + + + Templates + + + + + + + + {Template App OpenStack Neutron L3 Agent:proc.num[python,neutron,,neutron-l3-agent].last(0)}=0 & {Template App OpenStack Neutron L3 Agent:crm.node.check[p_neutron-l3-agent].last(0)}=1 + Neutron L3 Agent process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_Metadata_Agent.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_Metadata_Agent.xml new file mode 100644 index 0000000..de17d3e --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_Metadata_Agent.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-15T21:42:33Z + + + Templates + + + + + + + + {Template App OpenStack Neutron Metadata Agent:proc.num[python,neutron,,neutron-metadata-agent].last(0)}=0 + Neutron Metadata Agent process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_OVS_Agent.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_OVS_Agent.xml new file mode 100644 index 0000000..078aa26 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_OVS_Agent.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-15T21:42:33Z + + + Templates + + + + + + + + {Template App OpenStack Neutron OVS Agent:proc.num[python,neutron,,neutron-openvswitch-agent].last(0)}=0 + Neutron OVS Agent process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_Server.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_Server.xml new file mode 100644 index 0000000..f9e36b7 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Neutron_Server.xml @@ -0,0 +1,138 @@ + + + 2.0 + 2014-04-24T19:16:37Z + + + Templates + + + + + + + + {Template App OpenStack Neutron Server:proc.num[python,neutron,,neutron-server].last(0)}=0 + Neutron Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Neutron Server:net.tcp.service[http,{$IP_MANAGEMENT},9696].last(0)}=0 + Neutron Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API.xml new file mode 100644 index 0000000..c434e6f --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-10T21:18:18Z + + + Templates + + + + + + + + {Template App OpenStack Nova API:proc.num[python,nova,,nova-api].last(0)}=0 + Nova API process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_EC2.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_EC2.xml new file mode 100644 index 0000000..2153a0a --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_EC2.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-10T21:18:30Z + + + Templates + + + + + + + + {Template App OpenStack Nova API EC2:net.tcp.service[http,{$IP_MANAGEMENT},8773].last(0)}=0 + Nova API EC2 Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_Metadata.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_Metadata.xml new file mode 100644 index 0000000..717b25c --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_Metadata.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-10T21:18:50Z + + + Templates + + + + + + + + {Template App OpenStack Nova API Metadata:net.tcp.service[http,{$IP_MANAGEMENT},8775].last(0)}=0 + Nova API Metadata Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_OSAPI.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_OSAPI.xml new file mode 100644 index 0000000..4a5b793 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_OSAPI.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-10T21:19:04Z + + + Templates + + + + + + + + {Template App OpenStack Nova API OSAPI:net.tcp.service[http,{$IP_MANAGEMENT},8774].last(0)}=0 + Nova API OSAPI Compute Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_OSAPI_check.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_OSAPI_check.xml new file mode 100644 index 0000000..cc7fda4 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_API_OSAPI_check.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-10T21:19:34Z + + + Templates + + + + + + + + {Template App OpenStack Nova API OSAPI check:nova.api.status.last(0)}=0 + Nova API test failed on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Cert.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Cert.xml new file mode 100644 index 0000000..2a886ff --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Cert.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-15T21:42:33Z + + + Templates + + + + + + + + {Template App OpenStack Nova Cert:proc.num[python,nova,,nova-cert].last(0)}=0 + Nova Cert process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Compute.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Compute.xml new file mode 100644 index 0000000..c437a35 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Compute.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-15T21:55:39Z + + + Templates + + + + + + + + {Template App OpenStack Nova Compute:proc.num[python,nova,,nova-compute].last(0)}=0 + Nova Compute process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_ConsoleAuth.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_ConsoleAuth.xml new file mode 100644 index 0000000..07444d4 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_ConsoleAuth.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-15T21:36:18Z + + + Templates + + + + + + + + {Template App OpenStack Nova ConsoleAuth:proc.num[python,nova,,nova-consoleauth].last(0)}=0 + Nova ConsoleAuth process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Network.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Network.xml new file mode 100644 index 0000000..ed2bfd2 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Network.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-18T07:47:28Z + + + Templates + + + + + + + + {Template App OpenStack Nova Network:proc.num[python,nova,,nova-network].last(0)}=0 + Nova Network process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Scheduler.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Scheduler.xml new file mode 100644 index 0000000..7d5d49a --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Nova_Scheduler.xml @@ -0,0 +1,83 @@ + + + 2.0 + 2013-07-15T22:01:03Z + + + Templates + + + + + + + + {Template App OpenStack Nova Scheduler:proc.num[python,nova,,nova-scheduler].last(0)}=0 + Nova Scheduler process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Open_vSwitch.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Open_vSwitch.xml new file mode 100644 index 0000000..3d0c125 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Open_vSwitch.xml @@ -0,0 +1,132 @@ + + + 2.0 + 2013-07-10T21:21:22Z + + + Templates + + + + + + + + {Template App OpenStack Open vSwitch:proc.num[,root,,ovsdb-server].last(0)}=0 + Open vSwitch DB Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Open vSwitch:proc.num[,root,,ovs-vswitchd].last(0)}=0 + Open vSwitch Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_RabbitMQ_ha.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_RabbitMQ_ha.xml new file mode 100644 index 0000000..e24bd6c --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_RabbitMQ_ha.xml @@ -0,0 +1,474 @@ + + + 2.0 + 2013-07-18T13:46:42Z + + + Templates + + + + + + + + {Template App OpenStack HA RabbitMQ:net.tcp.port[,4369].last(0)}=0 + RabbitMQ EPMD service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack HA RabbitMQ:proc.num[,root,,bin/epmd].last(0)}=0 + RabbitMQ EPMD process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack HA RabbitMQ:proc.num[,rabbitmq,,bin/beam].last(0)}=0 + RabbitMQ BEAM process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack HA RabbitMQ:net.tcp.port[{$IP_MANAGEMENT},5673].last(0)}=0 + RabbitMQ Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack HA RabbitMQ:net.tcp.port[,41055].last(0)}=0 + RabbitMQ Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Account.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Account.xml new file mode 100644 index 0000000..9f0fb21 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Account.xml @@ -0,0 +1,181 @@ + + + 2.0 + 2013-07-10T21:22:14Z + + + Templates + + + + + + + + {Template App OpenStack Swift Account:proc.num[python,swift,,swift-account-replicator].last(0)}=0 + Swift Account Replicator process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Swift Account:proc.num[python,swift,,swift-account-server].last(0)}=0 + Swift Account Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Swift Account:net.tcp.service[http,{$IP_STORAGE},6002].last(0)}=0 + Swift Account Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Container.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Container.xml new file mode 100644 index 0000000..3fdab78 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Container.xml @@ -0,0 +1,181 @@ + + + 2.0 + 2013-07-10T21:22:26Z + + + Templates + + + + + + + + {Template App OpenStack Swift Container:proc.num[python,swift,,swift-container-replicator].last(0)}=0 + Swift Container Replicator process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Swift Container:proc.num[python,swift,,swift-container-server].last(0)}=0 + Swift Container Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Swift Container:net.tcp.service[http,{$IP_STORAGE},6001].last(0)}=0 + Swift Container Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Object.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Object.xml new file mode 100644 index 0000000..828f0cf --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Object.xml @@ -0,0 +1,181 @@ + + + 2.0 + 2013-07-10T21:22:38Z + + + Templates + + + + + + + + {Template App OpenStack Swift Object:proc.num[python,swift,,swift-object-replicator].last(0)}=0 + Swift Object Replicator process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Swift Object:proc.num[python,swift,,swift-object-server].last(0)}=0 + Swift Object Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Swift Object:net.tcp.service[http,{$IP_STORAGE},6000].last(0)}=0 + Swift Object Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Proxy.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Proxy.xml new file mode 100644 index 0000000..085af10 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_OpenStack_Swift_Proxy.xml @@ -0,0 +1,132 @@ + + + 2.0 + 2013-07-10T21:22:52Z + + + Templates + + + + + + + + {Template App OpenStack Swift Proxy:proc.num[python,swift,,swift-proxy-server].last(0)}=0 + Swift Proxy Server process is not running on {HOST.NAME} + + 0 + 4 + + 0 + + + + {Template App OpenStack Swift Proxy:net.tcp.service[http,{$IP_STORAGE},8080].last(0)}=0 + Swift Proxy Server service is down on {HOST.NAME} + + 0 + 4 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Zabbix_Agent.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Zabbix_Agent.xml new file mode 100644 index 0000000..849558e --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Zabbix_Agent.xml @@ -0,0 +1,183 @@ + + + 2.0 + 2013-07-10T21:23:38Z + + + Templates + + + + + + + + {Template App Zabbix Agent:agent.hostname.diff(0)}>0 + Host name of zabbix_agentd was changed on {HOST.NAME} + + 0 + 1 + + 0 + + + + {Template App Zabbix Agent:agent.version.diff(0)}>0 + Version of zabbix_agent(d) was changed on {HOST.NAME} + + 0 + 1 + + 0 + + + + {Template App Zabbix Agent:agent.ping.nodata(5m)}=1 + Zabbix agent on {HOST.NAME} is unreachable for 5 minutes + + 0 + 3 + + 0 + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Zabbix_Server.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Zabbix_Server.xml new file mode 100644 index 0000000..9f73372 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_App_Zabbix_Server.xml @@ -0,0 +1,1758 @@ + + + 2.0 + 2013-07-10T21:23:51Z + + + Templates + + + + + + + + {Template App Zabbix Server:zabbix[rcache,buffer,pfree].min(600)}<25 + Less than 25% free in the configuration cache + + 0 + 3 + Consider increasing CacheSize in the zabbix_server.conf configuration file + 0 + + + + {Template App Zabbix Server:zabbix[wcache,history,pfree].min(600)}<25 + Less than 25% free in the history cache + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[wcache,text,pfree].min(600)}<25 + Less than 25% free in the text history cache + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[wcache,trend,pfree].min(600)}<25 + Less than 25% free in the trends cache + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[queue,10m].min(600)}>100 + More than 100 items having missing data for more than 10 minutes + + 0 + 2 + zabbix[queue,10m] item is collecting data about how many items are missing data for more than 10 minutes (next parameter) + 0 + + + + {Template App Zabbix Server:zabbix[process,alerter,avg,busy].min(600)}>75 + Zabbix alerter processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,configuration syncer,avg,busy].min(600)}>75 + Zabbix configuration syncer processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,db watchdog,avg,busy].min(600)}>75 + Zabbix db watchdog processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,discoverer,avg,busy].min(600)}>75 + Zabbix discoverer processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,escalator,avg,busy].min(600)}>75 + Zabbix escalator processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,history syncer,avg,busy].min(600)}>75 + Zabbix history syncer processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,housekeeper,avg,busy].min(1800)}>75 + Zabbix housekeeper processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,http poller,avg,busy].min(600)}>75 + Zabbix http poller processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,icmp pinger,avg,busy].min(600)}>75 + Zabbix icmp pinger processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,ipmi poller,avg,busy].min(600)}>75 + Zabbix ipmi poller processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,java poller,avg,busy].min(600)}>75 + Zabbix java poller processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,node watcher,avg,busy].min(600)}>75 + Zabbix node watcher processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,poller,avg,busy].min(600)}>75 + Zabbix poller processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,proxy poller,avg,busy].min(600)}>75 + Zabbix proxy poller processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,self-monitoring,avg,busy].min(600)}>75 + Zabbix self-monitoring processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,snmp trapper,avg,busy].min(600)}>75 + Zabbix snmp trapper processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,timer,avg,busy].min(600)}>75 + Zabbix timer processes more than 75% busy + + 0 + 3 + Timer processes usually are busy because they have to process time based trigger functions + 0 + + + + {Template App Zabbix Server:zabbix[process,trapper,avg,busy].min(600)}>75 + Zabbix trapper processes more than 75% busy + + 0 + 3 + + 0 + + + + {Template App Zabbix Server:zabbix[process,unreachable poller,avg,busy].min(600)}>75 + Zabbix unreachable poller processes more than 75% busy + + 0 + 3 + + 0 + + + + + + Zabbix cache usage, % free + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 1 + 1 + 0 + 0 + + + 0 + 0 + 009900 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[wcache,trend,pfree] + + + + 1 + 0 + DD0000 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[rcache,buffer,pfree] + + + + 2 + 0 + 00DDDD + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[wcache,text,pfree] + + + + 3 + 0 + 3333FF + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[wcache,history,pfree] + + + + + + Zabbix data gathering process busy % + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 1 + 1 + 0 + 0 + + + 0 + 0 + 990099 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,trapper,avg,busy] + + + + 1 + 0 + 990000 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,poller,avg,busy] + + + + 2 + 0 + 0000EE + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,ipmi poller,avg,busy] + + + + 3 + 0 + FF33FF + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,discoverer,avg,busy] + + + + 4 + 0 + 00EE00 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,icmp pinger,avg,busy] + + + + 5 + 0 + 003300 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,http poller,avg,busy] + + + + 6 + 0 + CCCC00 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,proxy poller,avg,busy] + + + + 7 + 0 + 33FFFF + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,unreachable poller,avg,busy] + + + + 8 + 0 + DD0000 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,java poller,avg,busy] + + + + 9 + 0 + 000099 + 0 + 7 + 0 + + Template App Zabbix Server + zabbix[process,snmp trapper,avg,busy] + + + + + + Zabbix internal process busy % + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 1 + 1 + 0 + 0 + + + 0 + 0 + 00EE00 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,timer,avg,busy] + + + + 1 + 0 + 007777 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,node watcher,avg,busy] + + + + 2 + 0 + 0000EE + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,escalator,avg,busy] + + + + 3 + 0 + FFAA00 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,housekeeper,avg,busy] + + + + 4 + 0 + 00EEEE + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,alerter,avg,busy] + + + + 5 + 0 + 990099 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,configuration syncer,avg,busy] + + + + 6 + 0 + 666600 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,db watchdog,avg,busy] + + + + 7 + 0 + EE0000 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,history syncer,avg,busy] + + + + 8 + 0 + FF66FF + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[process,self-monitoring,avg,busy] + + + + + + Zabbix server performance + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 5 + 00C800 + 0 + 2 + 0 + + Template App Zabbix Server + zabbix[wcache,values] + + + + 1 + 5 + C80000 + 1 + 2 + 0 + + Template App Zabbix Server + zabbix[queue] + + + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_Fuel_OS_Linux.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_Fuel_OS_Linux.xml new file mode 100644 index 0000000..d1baab7 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_Fuel_OS_Linux.xml @@ -0,0 +1,3065 @@ + + + 2.0 + 2014-12-11T12:21:22Z + + + Templates + + + + + + + + {Template Fuel OS Linux:vfs.file.cksum[/etc/passwd].diff(0)}>0 + /etc/passwd has been changed on {HOST.NAME} + + 0 + 2 + + 0 + + + + {Template Fuel OS Linux:kernel.maxfiles.last(0)}<1024 + Configured max number of opened files is too low on {HOST.NAME} + + 0 + 1 + + 0 + + + + {Template Fuel OS Linux:kernel.maxproc.last(0)}<256 + Configured max number of processes is too low on {HOST.NAME} + + 0 + 1 + + 0 + + + + {Template Fuel OS Linux:system.cpu.util[,iowait].last(0)}>20 + Disk I/O is overloaded on {HOST.NAME} + + 0 + 2 + OS spends significant time waiting for I/O (input/output) operations. It could be indicator of performance issues with storage system. + 0 + + + + {Template Fuel OS Linux:net.dns[,zabbix.com,,2,1].count(#3,0)}>0 + DNS resolve error on {HOST.NAME} + + 1 + 4 + + 0 + + + + {Template Fuel OS Linux:system.uname.diff(0)}>0 + Host information was changed on {HOST.NAME} + + 0 + 1 + + 0 + + + + {Template Fuel OS Linux:system.hostname.diff(0)}>0 + Hostname was changed on {HOST.NAME} + + 0 + 1 + + 0 + + + + {Template Fuel OS Linux:vm.memory.size[available].last(0)}<20M + Lack of available memory on server {HOST.NAME} + + 0 + 3 + + 0 + + + + {Template Fuel OS Linux:system.swap.size[,pfree].last(0)}<50 + Lack of free swap space on {HOST.NAME} + + 0 + 2 + It probably means that the systems requires more physical memory. + 0 + + + + {Template Fuel OS Linux:proc.num[ntpd,,,].last(0)}=0 + NTP Server process is not running on {HOST.NAME} + + 0 + 2 + + 0 + + + + {Template Fuel OS Linux:net.udp.listen[123].last(0)}=0 + NTP Server service is down on {HOST.NAME} + + 0 + 2 + + 0 + + + + {Template Fuel OS Linux:system.cpu.load[percpu,avg1].last(0)}>5 + Processor load is too high on {HOST.NAME} + + 0 + 2 + + 0 + + + + {Template Fuel OS Linux:proc.num[rsyslogd,,,].last(0)}=0 + RsyslogD Server process is not running on {HOST.NAME} + + 0 + 2 + + 0 + + + + {Template Fuel OS Linux:proc.num[sshd,,,].last(0)}=0 + SSH Server process is not running on {HOST.NAME} + + 0 + 2 + + 0 + + + + {Template Fuel OS Linux:net.tcp.service[ssh,,22].last(0)}=0 + SSH Server service is down on {HOST.NAME} + + 0 + 2 + + 0 + + + + {Template Fuel OS Linux:proc.num[].last(0)}>1500 + Too many processes on {HOST.NAME} + + 0 + 2 + + 0 + + + + {Template Fuel OS Linux:proc.num[,,run].last(0)}>30 + Too many processes running on {HOST.NAME} + + 0 + 2 + + 0 + + + + {Template Fuel OS Linux:system.uptime.change(0)}<0 + {HOST.NAME} has just been restarted + + 0 + 1 + + 0 + + + + + + CPU jumps + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 1 + 0 + 009900 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.switches + + + + 2 + 0 + 000099 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.intr + + + + + + CPU load + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 1 + 0 + 0 + 0 + + + 0 + 0 + 009900 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.load[percpu,avg1] + + + + 1 + 0 + 000099 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.load[percpu,avg5] + + + + 2 + 0 + 990000 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.load[percpu,avg15] + + + + + + CPU utilization + 900 + 200 + 0.0000 + 100.0000 + 1 + 0 + 1 + 1 + 0 + 0.0000 + 0.0000 + 1 + 1 + 0 + 0 + + + 1 + 1 + FF5555 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.util[,steal] + + + + 2 + 1 + 55FF55 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.util[,softirq] + + + + 3 + 1 + 009999 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.util[,interrupt] + + + + 4 + 1 + 990099 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.util[,nice] + + + + 5 + 1 + 999900 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.util[,iowait] + + + + 6 + 1 + 990000 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.util[,system] + + + + 7 + 1 + 000099 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.util[,user] + + + + 8 + 1 + 009900 + 0 + 2 + 0 + + Template Fuel OS Linux + system.cpu.util[,idle] + + + + + + Swap usage + 600 + 340 + 0.0000 + 0.0000 + 0 + 0 + 2 + 1 + 1 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + AA0000 + 0 + 2 + 2 + + Template Fuel OS Linux + system.swap.size[,total] + + + + 1 + 0 + 00AA00 + 0 + 2 + 0 + + Template Fuel OS Linux + system.swap.size[,free] + + + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_OpenStack_Cluster.xml b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_OpenStack_Cluster.xml new file mode 100644 index 0000000..00572c9 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/import/Template_OpenStack_Cluster.xml @@ -0,0 +1,1012 @@ + + + 2.0 + 2014-12-10T10:37:28Z + + + Templates + + + + + + + + {Template OpenStack Cluster:vip.cinder.api.status.last(0)}=0 + Cinder VIP API test failed + + 0 + 5 + + 0 + + + + {Template OpenStack Cluster:vip.glance.api.status.last(0)}=0 + Glance VIP API test failed + + 0 + 5 + + 0 + + + + {Template OpenStack Cluster:vip.keystone.service.api.status.last(0)}=0 + Keystone service VIP API test failed + + 0 + 5 + + 0 + + + + {Template OpenStack Cluster:vip.keystone.api.status.last(0)}=0 + Keystone VIP API test failed + + 0 + 5 + + 0 + + + + {Template OpenStack Cluster:vip.nova.api.status.last(0)}=0 + Nova VIP API test failed + + 0 + 5 + + 0 + + + + + + Cluster CPU Load + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + C80000 + 0 + 2 + 0 + + Template OpenStack Cluster + grpavg["Controllers", "system.cpu.load[percpu,avg1]", last, 0] + + + + 1 + 0 + 00C800 + 0 + 2 + 0 + + Template OpenStack Cluster + grpavg["Controllers", "system.cpu.load[percpu,avg5]", last, 0] + + + + 2 + 0 + 0000C8 + 0 + 2 + 0 + + Template OpenStack Cluster + grpavg["Controllers", "system.cpu.load[percpu,avg15]", last, 0] + + + + + + CPUs in Cluster + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + C80000 + 0 + 2 + 0 + + Template OpenStack Cluster + db.cpu.used.query + + + + 1 + 0 + 00C800 + 0 + 2 + 0 + + Template OpenStack Cluster + db.cpu.total.query + + + + + + Number of instances + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + C80000 + 0 + 2 + 0 + + Template OpenStack Cluster + db.instance.count.query + + + + 1 + 0 + 00C800 + 0 + 2 + 0 + + Template OpenStack Cluster + db.instance.error.query + + + + + + Openstack Offline Services + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + C80000 + 0 + 2 + 0 + + Template OpenStack Cluster + db.services.offline.cinder.query + + + + 1 + 0 + 00C800 + 0 + 2 + 0 + + Template OpenStack Cluster + db.services.offline.nova.query + + + + + + RAM in Cluster + 900 + 200 + 0.0000 + 100.0000 + 1 + 1 + 0 + 1 + 0 + 0.0000 + 0.0000 + 0 + 0 + 0 + 0 + + + 0 + 0 + C80000 + 0 + 2 + 0 + + Template OpenStack Cluster + db.ram.total.query + + + + 1 + 0 + 00C800 + 0 + 2 + 0 + + Template OpenStack Cluster + db.ram.used.query + + + + + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/ceph_health.sh b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/ceph_health.sh new file mode 100755 index 0000000..86abc32 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/ceph_health.sh @@ -0,0 +1,7 @@ +#!/bin/sh +sudo ceph health | grep -q HEALTH_OK; +if [ $? -eq 0 ]; then + echo 1 +else + echo 0 +fi diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/check_api.py b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/check_api.py new file mode 100755 index 0000000..51652d9 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/check_api.py @@ -0,0 +1,117 @@ +#!/usr/bin/python +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +import urllib2 +import sys +import simplejson as json +import ConfigParser +from zabbix_checks_logger import get_logger + +CONF_FILE = '/etc/zabbix/check_api.conf' + + +class OSAPI(object): + """Openstack API""" + + def __init__(self, logger, config): + self.logger = logger + self.config = config + self.username = self.config.get('api', 'user') + self.password = self.config.get('api', 'password') + self.tenant_name = self.config.get('api', 'tenant') + self.endpoint_keystone = self.config.get('api', + 'keystone_endpoints' + ).split(',') + self.token = None + self.tenant_id = None + self.get_token() + + def get_timeout(self, service): + try: + return int(self.config.get('api', '%s_timeout' % service)) + except ConfigParser.NoOptionError: + return 1 + + def get_token(self): + data = json.dumps({ + "auth": + { + 'tenantName': self.tenant_name, + 'passwordCredentials': + { + 'username': self.username, + 'password': self.password + } + } + }) + fail_services = 0 + for keystone in self.endpoint_keystone: + self.logger.info("Trying to get token from '%s'" % keystone) + try: + request = urllib2.Request( + '%s/tokens' % keystone, + data=data, + headers={ + 'Content-type': 'application/json' + }) + data = json.loads( + urllib2.urlopen( + request, timeout=self.get_timeout('keystone')).read()) + self.token = data['access']['token']['id'] + self.tenant_id = data['access']['token']['tenant']['id'] + self.logger.debug("Got token '%s'" % self.token) + return + except Exception as e: + self.logger.debug("Got exception '%s'" % e) + fail_services += 1 + if fail_services == len(self.endpoint_keystone): + self.logger.critical(0) + sys.exit(1) + + def check_api(self, url, service): + self.logger.info("Trying '%s' on '%s'" % (service, url)) + try: + request = urllib2.Request(url, + headers={ + 'X-Auth-Token': self.token, + }) + urllib2.urlopen(request, timeout=self.get_timeout(service)) + except Exception as e: + self.logger.debug("Got exception from '%s' '%s'" % (service, e)) + self.logger.critical(0) + sys.exit(1) + self.logger.critical(1) + + +def main(): + config = ConfigParser.RawConfigParser() + config.read(CONF_FILE) + logger = get_logger(config.get('api', 'log_level')) + + API = OSAPI(logger, config) + + if len(sys.argv) < 5: + logger.critical('No argvs, dunno what to do') + sys.exit(1) + map = config.get('api', '%s_map' % sys.argv[1]) + + url = '%s://%s:%s/%s' % (sys.argv[2], sys.argv[3], sys.argv[4], map) + url = url % API.__dict__ + + API.check_api(url, sys.argv[1]) + +if __name__ == "__main__": + main() diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/check_rabbit.py b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/check_rabbit.py new file mode 100755 index 0000000..874da0b --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/check_rabbit.py @@ -0,0 +1,128 @@ +#!/usr/bin/python +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +import urllib2 +import simplejson as json +import sys +import base64 +import ConfigParser +from zabbix_checks_logger import get_logger + +CONF_FILE = '/etc/zabbix/check_rabbit.conf' + + +class RabbitmqAPI(object): + def __init__(self, logger, config): + self.logger = logger + self.login = config.get('rabbitmq', 'user') + self.password = config.get('rabbitmq', 'password') + self.host = config.get('rabbitmq', 'host') + self.auth_string = base64.encodestring('%s:%s' % + (self.login, + self.password) + ).replace('\n', '') + self.max_queues = int(config.get('rabbitmq', 'max_queues')) + + def get_http(self, url): + try: + request = urllib2.Request('%s/api/%s' % (self.host, url)) + request.add_header("Authorization", "Basic %s" % self.auth_string) + return json.loads(urllib2.urlopen(request, timeout=2).read()) + except urllib2.URLError as e: + self.logger.error("URL error: '%s'" % e) + sys.exit(1) + except ValueError as e: + self.logger.error("Value error: '%s'" % e) + sys.exit(1) + + def get_queues_items(self): + response = self.get_http('overview') + if 'queue_totals' in response: + self.logger.critical(response['queue_totals']['messages']) + else: + self.logger.error('No queue_totals in response') + + def get_missing_queues(self): + queues = 0 + response = self.get_http('queues') + for queue in response: + queues += 1 + self.logger.critical(self.max_queues-queues) + + def get_queues_without_consumers(self): + queues_without_consumers = 0 + response = self.get_http('queues') + for queue in response: + queues_without_consumers += 1 + if queue['consumers'] > 0: + queues_without_consumers -= 1 + self.logger.critical(queues_without_consumers) + + def get_missing_nodes(self): + missing_nodes = 0 + response = self.get_http('nodes') + for node in response: + if not node['running']: + missing_nodes += 1 + self.logger.critical(missing_nodes) + + def get_unmirror_queues(self): + response = self.get_http('queues') + unmirror_queues = 0 + for queue in response: + if 'x-ha-policy' in queue['arguments']: + unmirror_queues += 1 + if ('synchronised_slave_nodes' in queue and + len(queue['synchronised_slave_nodes']) > 0): + unmirror_queues -= 1 + self.logger.critical(unmirror_queues) + + +def usage(): + print("check_rabbit.py usage:\n \ + queues-items - item count in queues\n \ + queues-without-consumers - count queues without consumers\n \ + missing-nodes - count missing nodes from rabbitmq cluster\n \ + unmirror-queues - count unmirrored queues\n \ + missing-queues max_queues - compare queues count to max_queues\n") + + +def main(): + config = ConfigParser.RawConfigParser() + config.read(CONF_FILE) + logger = get_logger(config.get('rabbitmq', 'log_level')) + + API = RabbitmqAPI(logger, config) + + if len(sys.argv) < 2: + logger.critical('No argvs, dunno what to do') + sys.exit(1) + + if sys.argv[1] == 'missing-queues': + API.get_missing_queues() + elif sys.argv[1] == 'queues-items': + API.get_queues_items() + elif sys.argv[1] == 'queues-without-consumers': + API.get_queues_without_consumers() + elif sys.argv[1] == 'missing-nodes': + API.get_missing_nodes() + elif sys.argv[1] == 'unmirror-queues': + API.get_unmirror_queues() + else: + usage() + +if __name__ == "__main__": + main() diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/crm_node_check.sh b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/crm_node_check.sh new file mode 100755 index 0000000..eecbd03 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/crm_node_check.sh @@ -0,0 +1,12 @@ +#!/bin/bash +NODES=$(/usr/bin/sudo /usr/sbin/crm_resource --locate --quiet --resource $1) +HOSTNAME=$(/bin/hostname) + +for NODE in $NODES +do + if [ "$NODE" == "$HOSTNAME" ]; then + echo 1 + exit + fi +done +echo 0 diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/haproxy.sh b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/haproxy.sh new file mode 100755 index 0000000..22c607e --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/haproxy.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# This script is a wrapper to HAproxy statistics which are in a CSV format. +# Output format is compatible with Zabbix. +# It can be used for HAproxy frontends and/or backends discovery and for +# gathering statistics about particular frontend,backend or server. + +case $1 in + "-f") + OPER='discovery' + FESQ='grep FRONTEND' + ;; + "-b") + OPER='discovery' + FESQ='grep BACKEND' + ;; + "-s") + OPER='discovery' + FESQ='grep -v FRONTEND\|BACKEND\|^$\|^#' + ;; + "-v") + OPER='value' + IFS=$'.' + QA=($2) + unset IFS + HAPX=${QA[0]} + HASV=${QA[1]} + ITEM=${QA[2]} + FESQ="grep ^${HAPX},${HASV}," + ;; + *) + echo "Wrong arguments supplied, exiting... + + Usage: + $0 -f|-b|-s|-v .. + + -f frontend discovery + -b backend discovery + -s server discovery + -v .. get particular item value, for example: + + -v zabbix-agent.node-1.smax + will print smax item value for server node-1 in group zabbix-agent + -v zabbix-agent.FRONTEND.smax + will print smax item value for FRONTEND part of zabbix-agent group + -v zabbix-agent.BACKEND.smax + will print smax item value for BACKEND part of zabbix-agent group + " + exit 1 +esac +STATHEAD=( pxname svname qcur qmax scur smax slim stot bin bout dreq +dresp ereq econ eresp wretr wredis status weight act bck chkfail +chkdown lastchg downtime qlimit pid iid sid throttle lbtot tracked +type rate rate_lim rate_max check_status check_code check_duration +hrsp_1xx hrsp_2xx hrsp_3xx hrsp_4xx hrsp_5xx hrsp_other hanafail +req_rate req_rate_max req_tot cli_abrt srv_abrt ) + +FES=`echo "show stat" | sudo socat /var/lib/haproxy/stats stdio | sed 's/ /_/g' |grep -v -i 'zabbix-server' | $FESQ` +if [ "$OPER" == "discovery" ]; then + POSITION=1 + echo "{" + echo " \"data\":[" + for FE in $FES + do + IFS=$',' + FEA=($FE) + unset IFS + HAPX=${FEA[0]} + HASV=${FEA[1]} + HASTAT=${HAPX}-${HASV} + if [ $POSITION -gt 1 ] + then + echo "," + fi + echo -n " { \"{#HAPX}\": \"$HAPX\", \"{#HASTAT}\": \"$HASTAT\", \"{#HASV}\": \"$HASV\" }" + POSITION=$[POSITION+1] + done + echo "" + echo " ]" + echo "}" +elif [ "$OPER" == "value" ]; then + IFS=$',' + FEA=($FES) + unset IFS + cnt=0; for el in "${STATHEAD[@]}"; do + [[ "$el" == "$ITEM" ]] && echo ${FEA[$cnt]} && break + ((++cnt)) + done +fi diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/query_db.py b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/query_db.py new file mode 100755 index 0000000..b859425 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/query_db.py @@ -0,0 +1,57 @@ +#!/usr/bin/python +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +import ConfigParser +import sys +import sqlalchemy +from zabbix_checks_logger import get_logger + +CONF_FILE = '/etc/zabbix/check_db.conf' + + +def query_db(logger, connection_string, query_string): + try: + engine = sqlalchemy.create_engine(connection_string) + res = engine.execute(query_string).first() + except sqlalchemy.exc.OperationalError as e: + logger.critical("Operational error '%s'" % e) + except sqlalchemy.exc.ProgrammingError as e: + logger.critical("Programming error '%s'" % e) + else: + return res[0] + +config = ConfigParser.RawConfigParser() +config.read(CONF_FILE) + +logger = get_logger(config.get('query_db', 'log_level')) + +if __name__ == '__main__': + if len(sys.argv) < 2: + logger.critical('No argvs, dunno what to do') + sys.exit(1) + + item = sys.argv[1] + try: + sql_connection = config.get('query_db', '%s_connection' % item) + sql_query = config.get('query_db', '%s_query' % item) + except ConfigParser.NoOptionError as e: + logger.critical("Item '%s' not configured" % item) + sys.exit(2) + + logger.info("Get request for item '%s'" % item) + logger.debug("Sql connection: '%s', sql query: '%s'" % + (sql_connection, sql_query)) + logger.critical(query_db(logger, sql_connection, sql_query)) diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/vfs.dev.discovery.sh b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/vfs.dev.discovery.sh new file mode 100755 index 0000000..9cd7367 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/vfs.dev.discovery.sh @@ -0,0 +1,19 @@ +#!/bin/bash +#Zabbix vfs.dev.discovery implementation +#Send beer to +DEVS=`grep -v "major\|^$\|dm-\|[0-9]$" /proc/partitions | awk '{print $4}'` +POSITION=1 +echo "{" +echo " \"data\":[" +for DEV in $DEVS +do + if [ $POSITION -gt 1 ] + then + echo "," + fi + echo -n " { \"{#DEVNAME}\": \"$DEV\"}" + POSITION=$[POSITION+1] +done +echo "" +echo " ]" +echo "}" \ No newline at end of file diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/vfs.mdadm.discovery.sh b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/vfs.mdadm.discovery.sh new file mode 100755 index 0000000..bb0551e --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/vfs.mdadm.discovery.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +echo "{" +echo -e "\t\"data\":[\n" + +# we have to end each line with a comma except the last one (JSON SIC!) +# so we have to manage the line separator manually in awk :/ +awk ' + BEGIN{ORS="";n=0} + /md?/{ + if (n++) print ",\n"; + print "\t{ \"{#MDEVICE}\":\""$1"\" }" + } +' /proc/mdstat + +echo -e "\n\n\t]" +echo "}" diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/zabbix_checks_logger.py b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/zabbix_checks_logger.py new file mode 100644 index 0000000..0aed9a6 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/scripts/zabbix_checks_logger.py @@ -0,0 +1,32 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +import sys +import logging + +LOGGING_LEVELS = { + 'CRITICAL': logging.CRITICAL, + 'WARNING': logging.WARNING, + 'INFO': logging.INFO, + 'DEBUG': logging.DEBUG +} + + +def get_logger(level): + logger = logging.getLogger() + ch = logging.StreamHandler(sys.stdout) + logger.setLevel(LOGGING_LEVELS[level]) + logger.addHandler(ch) + return logger diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/sql/block_dev.sql b/deployment_scripts/puppet/modules/plugin_zabbix/files/sql/block_dev.sql new file mode 100644 index 0000000..e2eeccf --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/sql/block_dev.sql @@ -0,0 +1,2 @@ +INSERT INTO `regexps` (`regexpid`,`name`,`test_string`) values ('10','Block devices for discovery','vda'); +INSERT INTO `expressions` (`expressionid`,`regexpid`,`expression`,`expression_type`,`exp_delimiter`,`case_sensitive`) values ('10','10','^(vd.|sd.)$','3',',','0'); diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-server-mysql.conf b/deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-server-mysql.conf new file mode 100644 index 0000000..68254ab --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-server-mysql.conf @@ -0,0 +1,2 @@ +dbc_install='false' +dbc_upgrade='false' diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-server.ocf b/deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-server.ocf new file mode 100644 index 0000000..38bb5ad --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-server.ocf @@ -0,0 +1,249 @@ +#!/bin/sh +# +# Zabbix server OCF script +# +# Description: Manages Zabbix server process as a HA resource +# +# Authors: Mirantis inc. +# +# Support: openstack@lists.launchpad.net +# License: Apache Software License (ASL) 2.0 +# +# See usage() function below for more details ... +# +# OCF instance parameters: +# OCF_RESKEY_binary +# OCF_RESKEY_config +# OCF_RESKEY_user +# OCF_RESKEY_pid +# OCF_RESKEY_additional_parameters +####################################################################### +# Initialization: + +: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} +. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs + +####################################################################### + +# Fill in some defaults if no values are specified + +SERVICE_NAME="Zabbix-server" + +OCF_RESKEY_binary_default="/usr/sbin/zabbix_server" +OCF_RESKEY_pid_default="/var/run/zabbix/zabbix_server.pid" + +: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}} +: ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}} + +####################################################################### + +usage() { + cat < + + +1.0 + + +Manages Zabbix server daemon as a Pacemaker Resource. + +Manages Zabbix server + + + + +Name of zabbix-server file that will be run. + +zabbix-server binary file + + + + + +The pid file to use for this process + +zabbix-server pid file + + + + + + + + + + + + + + +END +} + +####################################################################### +# Functions invoked by resource manager actions + +service_validate() { + local rc + + check_binary $OCF_RESKEY_binary + + # A config file on shared storage that is not available + # during probes is OK. + #if [ ! -f $OCF_RESKEY_config ]; then + # if ! ocf_is_probe; then + # ocf_log err "Config $OCF_RESKEY_config doesn't exist" + # return $OCF_ERR_INSTALLED + # fi + # ocf_log_warn "Config $OCF_RESKEY_config not available during a probe" + #fi + + true +} + +service_status() { + local pid + local rc + + if [ ! -f $OCF_RESKEY_pid ]; then + ocf_log info "${SERVICE_NAME} is not running" + return $OCF_NOT_RUNNING + else + pid=`cat $OCF_RESKEY_pid` + fi + + ocf_run -warn kill -s 0 $pid + rc=$? + if [ $rc -eq 0 ]; then + return $OCF_SUCCESS + else + ocf_log info "Old PID file found, but ${SERVICE_NAME} is not running" + return $OCF_NOT_RUNNING + fi +} + +service_monitor() { + service_status +} + +service_start() { + local rc + + service_status + rc=$? + if [ $rc -eq $OCF_SUCCESS ]; then + ocf_log info "${SERVICE_NAME} is already running" + return $OCF_SUCCESS + fi + + ${OCF_RESKEY_binary} + + # Spin waiting for the server to come up. + # Let the CRM/LRM time us out if required + while true; do + service_monitor + rc=$? + [ $rc -eq $OCF_SUCCESS ] && break + if [ $rc -ne $OCF_NOT_RUNNING ]; then + ocf_log err "${SERVICE_NAME} start failed" + exit $OCF_ERR_GENERIC + fi + sleep 1 + done + + ocf_log info "${SERVICE_NAME} started" + return $OCF_SUCCESS +} + +service_stop() { + local rc + local pid + + service_status + rc=$? + if [ $rc -eq $OCF_NOT_RUNNING ]; then + ocf_log info "${SERVICE_NAME} is already stopped" + return $OCF_SUCCESS + fi + + # Try SIGTERM + pid=`cat $OCF_RESKEY_pid` + ocf_run kill -s TERM $pid + rc=$? + if [ $rc -ne 0 ]; then + ocf_log err "${SERVICE_NAME} couldn't be stopped" + exit $OCF_ERR_GENERIC + fi + + # stop waiting + shutdown_timeout=15 + if [ -n "$OCF_RESKEY_CRM_meta_timeout" ]; then + shutdown_timeout=$((($OCF_RESKEY_CRM_meta_timeout/1000)-5)) + fi + count=0 + while [ $count -lt $shutdown_timeout ]; do + service_status + rc=$? + if [ $rc -eq $OCF_NOT_RUNNING ]; then + break + fi + count=`expr $count + 1` + sleep 1 + ocf_log debug "${SERVICE_NAME} still hasn't stopped yet. Waiting ..." + done + + service_status + rc=$? + if [ "${rc}" -ne "${OCF_NOT_RUNNING}" ]; then + # SIGTERM didn't help either, try SIGKILL + ocf_log info "${SERVICE_NAME} failed to stop after ${shutdown_timeout}s using SIGTERM. Trying SIGKILL ..." + ocf_run kill -s KILL "${pid}" + fi + + ocf_log info "${SERVICE_NAME} stopped" + + rm -f "${OCF_RESKEY_pid}" + + return "${OCF_SUCCESS}" +} + +####################################################################### + +case "$1" in + meta-data) meta_data + exit $OCF_SUCCESS;; + usage|help) usage + exit $OCF_SUCCESS;; +esac + +# Anything except meta-data and help must pass validation +service_validate || exit $? + +# What kind of method was invoked? +case "$1" in + start) service_start;; + stop) service_stop;; + status) service_status;; + monitor) service_monitor;; + validate-all) ;; + *) usage + exit $OCF_ERR_UNIMPLEMENTED;; +esac + + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-sudo b/deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-sudo new file mode 100644 index 0000000..45f45c7 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/files/zabbix-sudo @@ -0,0 +1,5 @@ +Defaults:zabbix !requiretty +zabbix ALL = NOPASSWD: /usr/bin/socat /var/lib/haproxy/stats stdio +zabbix ALL = NOPASSWD: /usr/sbin/iptstate +zabbix ALL = NOPASSWD: /usr/sbin/crm_resource --locate --quiet --resource * +zabbix ALL = NOPASSWD: /usr/bin/ceph health diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/parser/functions/defined_in_state.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/parser/functions/defined_in_state.rb new file mode 100644 index 0000000..34c9acf --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/parser/functions/defined_in_state.rb @@ -0,0 +1,24 @@ +Puppet::Parser::Functions::newfunction( + :defined_in_state, + :type => :rvalue, + :doc => 'Returns True when resource is defined in state.yaml file' +) do |args| + + yaml_file = '/var/lib/puppet/state/state.yaml' + + raise(Puppet::ParseError, "defined_in_state(): Wrong number of arguments " + + "given (#{args.size} for 1)") if args.size != 1 + + resource = args[0] + + begin + yaml = YAML.load_file(yaml_file) + if ! yaml["#{resource}"].nil? + return true + end + rescue Exception => e + Puppet.warning("#{e}") + end + + return false +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/parser/functions/get_server_by_role.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/parser/functions/get_server_by_role.rb new file mode 100644 index 0000000..de9c38b --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/parser/functions/get_server_by_role.rb @@ -0,0 +1,15 @@ +Puppet::Parser::Functions::newfunction( + :get_server_by_role, + :type => :rvalue, + :doc => 'Returns server node hash by role' +) do |args| + fuel_nodes = args[0] + requested_roles = args[1] + server = "" + fuel_nodes.each do |node| + next unless requested_roles.include?(node['role']) + server = node + end + server +end + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix.rb new file mode 100644 index 0000000..99cf8e6 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix.rb @@ -0,0 +1,113 @@ +require 'json' +require 'net/http' +class Puppet::Provider::Plugin_zabbix < Puppet::Provider + + @@auth_hash = "" + + def self.message_json(body) + if body[:method] == "user.login" + message = { + :method => body[:method], + :params => body[:params], + :id => rand(9000), + :jsonrpc => '2.0' + } + else + message = { + :method => body[:method], + :params => body[:params], + :auth => auth_hash, + :id => rand(9000), + :jsonrpc => '2.0' + } + end + JSON.generate(message) + end + + def self.make_request(api, body) + uri = URI.parse(api["endpoint"]) + http = Net::HTTP.new(uri.host, uri.port) + request = Net::HTTP::Post.new(uri.request_uri) + request.add_field("Content-Type", "application/json-rpc") + request.body = message_json(body) + response = http.request(request) + puts "DEBUG request = #{request.body}" + puts "DEBUG response = #{response.body}" + response.value + result = JSON.parse(response.body) + result + end + + def self.api_request(api, body) + retries = 10 + cooldown = 1 + Puppet.info("Trying to make a request to zabbix server, will try #{retries} times with #{cooldown} seconds between tries") + retries.times do |r| + begin + Puppet.info("Retry ##{r}/#{retries}:") + result = make_request(api, body) + + if result.has_key? "error" + raise(Puppet::Error, "Zabbix API returned error code #{result["error"]["code"]}: #{result["error"]["message"]}, #{result["error"]["data"]}") + end + + return result["result"] + + rescue => e + if r == retries + Puppet.error("Out of retries to make a request to zabbix server (#{retries})") + raise e + else + Puppet.warning("Could not make request to zabbix: #{e}, sleeping #{cooldown*r} (retry (##{r}/#{retries}))") + sleep(cooldown*r) + end + end + end + end + + def self.auth(api) + body = {:method => "user.login", + :params => {:user => api["username"], + :password => api["password"]}} + @@auth_hash = api_request(api, body) + end + + def auth(api) + self.class.auth(api) + end + + def api_request(api, body) + self.class.api_request(api, body) + end + + def self.auth_hash + @@auth_hash + end + + def auth_hash + self.class.auth_hash + end + + def self.get_host(api, name) + puts "DEBUG gethost #{name}" + api_request(api, + {:method => "host.get", + :params => {:filter => {:name => [name]}}}) + end + + def self.get_hostgroup(api, name) + puts "DEBUG gethostgroup #{name}" + api_request(api, + {:method => "hostgroup.get", + :params => {:filter => {:name => [name]}}}) + end + + def get_host(api, name) + self.class.get_host(api, name) + end + + def get_hostgroup(api, name) + self.class.get_hostgroup(api, name) + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_configuration_import/ruby.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_configuration_import/ruby.rb new file mode 100644 index 0000000..a84a3e4 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_configuration_import/ruby.rb @@ -0,0 +1,100 @@ +$LOAD_PATH.push(File.join(File.dirname(__FILE__), '..', '..', '..')) +require 'puppet/provider/plugin_zabbix' +require 'digest/md5' + +Puppet::Type.type(:plugin_zabbix_configuration_import).provide(:ruby, + :parent => Puppet::Provider::Plugin_zabbix) do + + def exists? + auth(resource[:api]) + macroname = '{$TMPL_' + Pathname.new(resource[:xml_file]).basename.to_s.gsub('.', '_').upcase + '}' + macroid = nil + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {:globalmacro => true, + :output => 'extend'}}) + result.each { |macro| macroid = macro['globalmacroid'] if macro['macro'] == macroname } + not macroid.nil? + end + + def create + macroname = '{$TMPL_' + Pathname.new(resource[:xml_file]).basename.to_s.gsub('.', '_').upcase + '}' + xml_file_checksum = config_import(resource[:xml_file]) + api_request(resource[:api], + {:method => 'usermacro.createglobal', + :params => {:macro => macroname, + :value => xml_file_checksum}}) + end + + def destroy + macroname = '{$TMPL_' + Pathname.new(resource[:xml_file]).basename.to_s.gsub('.', '_').upcase + '}' + macroid = nil + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {:globalmacro => true, + :output => 'extend'}}) + result.each { |macro| macroid = macro['globalmacroid'] if macro['macro'] == macroname } + api_request(resource[:api], + {:method => 'usermacro.deleteglobal', + :params => [macroid]}) + end + + def xml_file + macrovalue = nil + macroname = '{$TMPL_' + Pathname.new(resource[:xml_file]).basename.to_s.gsub('.', '_').upcase + '}' + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {:globalmacro => true, + :output => 'extend'}}) + result.each { |macro| macrovalue = macro['value'] if macro['macro'] == macroname } + macrovalue + end + + def xml_file=(v) + macroid = nil + xml_file_checksum = config_import(resource[:xml_file]) + macroname = '{$TMPL_' + Pathname.new(resource[:xml_file]).basename.to_s.gsub('.', '_').upcase + '}' + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {:globalmacro => true, + :output => 'extend'}}) + result.each { |macro| macroid = macro['globalmacroid'] if macro['macro'] == macroname } + api_request(resource[:api], + {:method => 'usermacro.updateglobal', + :params => {:globalmacroid => macroid, + :value => xml_file_checksum}}) + end + + def config_import(xml_file) + xml_file_content = Puppet::Util::FileType.filetype(:flat).new(xml_file).read + xml_file_checksum = Digest::MD5.hexdigest(xml_file_content) + api_request(resource[:api], + {:method => 'configuration.import', + :params => {:format => 'xml', + :source => xml_file_content, + :rules => {:applications => {:createMissing => true, + :updateExisting => true}, + :discoveryRules => {:createMissing => true, + :updateExisting => true}, + :graphs => {:createMissing => true, + :updateExisting => true}, + :groups => {:createMissing => true, + :updateExisting => true}, + :images => {:createMissing => true, + :updateExisting => true}, + :items => {:createMissing => true, + :updateExisting => true}, + :maps => {:createMissing => true, + :updateExisting => true}, + :screens => {:createMissing => true, + :updateExisting => true}, + :templates => {:createMissing => true, + :updateExisting => true}, + :templateScreens => {:createMissing => true, + :updateExisting => true}, + :triggers => {:createMissing => true, + :updateExisting => true}}}}) + xml_file_checksum + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_host/ruby.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_host/ruby.rb new file mode 100644 index 0000000..9e6b82f --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_host/ruby.rb @@ -0,0 +1,52 @@ +$LOAD_PATH.push(File.join(File.dirname(__FILE__), '..', '..', '..')) +require 'puppet/provider/plugin_zabbix' + +Puppet::Type.type(:plugin_zabbix_host).provide(:ruby, + :parent => Puppet::Provider::Plugin_zabbix) do + + def exists? + auth(resource[:api]) + result = get_host(resource[:api], resource[:name]) + not result.empty? + end + + def create + groups = Array.new + resource[:groups].each do |group| + group_id = get_hostgroup(resource[:api], group) + raise(Puppet::Error, "Group #{group} does not exist") unless not group_id.empty? + groups.push({ + :groupid => group_id[0]["groupid"] + }) + end + + params = {:host => resource[:host], + :status => resource[:status], + :interfaces => [{:type => resource[:type] == nil ? "1" : resource[:type], + :main =>1, + :useip => resource[:ip] == nil ? 0 : 1, + :usedns => resource[:ip] == nil ? 1 : 0, + :dns => resource[:host], + :ip => resource[:ip] == nil ? "" : resource[:ip], + :port => resource[:port] == nil ? "10050" : resource[:port],}], + :proxy_hostid => resource[:proxy_hostid] == nil ? 0 : resource[:proxy_hostid], + :groups => groups} + + api_request(resource[:api], + {:method => "host.create", + :params => params}) + end + + def destroy + hostid = get_host(resource[:api], resource[:name])[0]["hostid"] + # deactivate before removing + api_request(resource[:api], + {:method => 'host.update', + :params => {:hostid => hostid, + :status => 1}}) + + api_request(resource[:api], + {:method => 'host.delete', + :params => [{:hostid => hostid}]}) + end +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_hostgroup/ruby.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_hostgroup/ruby.rb new file mode 100644 index 0000000..a27d671 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_hostgroup/ruby.rb @@ -0,0 +1,25 @@ +$LOAD_PATH.push(File.join(File.dirname(__FILE__), '..', '..', '..')) +require 'puppet/provider/plugin_zabbix' + +Puppet::Type.type(:plugin_zabbix_hostgroup).provide(:ruby, + :parent => Puppet::Provider::Plugin_zabbix) do + + def exists? + auth(resource[:api]) + result = get_hostgroup(resource[:api], resource[:name]) + not result.empty? + end + + def create + api_request(resource[:api], + {:method => "hostgroup.create", + :params => {:name => resource[:name]}}) + end + + def destroy + groupid = get_hostgroup(resource[:api], resource[:name])[0]["groupid"] + api_request(resource[:api], + {:method => "hostgroup.delete", + :params => [groupid]}) + end +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_template_link/ruby.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_template_link/ruby.rb new file mode 100644 index 0000000..b435668 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_template_link/ruby.rb @@ -0,0 +1,51 @@ +$LOAD_PATH.push(File.join(File.dirname(__FILE__), '..', '..', '..')) +require 'puppet/provider/plugin_zabbix' +require 'digest/md5' + +Puppet::Type.type(:plugin_zabbix_template_link).provide(:ruby, + :parent => Puppet::Provider::Plugin_zabbix) do + + def get_ids_by_host(hostid) + results = [] + api_request(resource[:api], + {:method => "template.get", + :params => {:hostids => [hostid]}}).each do |template| + results << template["templateid"] + end + results + end + + def exists? + auth(resource[:api]) + hostid = get_host(resource[:api], resource[:host]) + raise(Puppet::Error, "Host #{resource[:host]} does not exist") unless not hostid.empty? + templateid = api_request(resource[:api], + {:method => "template.get", + :params => {:filter => {:host => [resource[:template]]}}}) + raise(Puppet::Error, "Template #{resource[:template]} does not exist") unless not templateid.empty? + + get_ids_by_host(hostid[0]["hostid"]).include?(templateid[0]["templateid"]) + end + + def create + hostid = get_host(resource[:api], resource[:host]) + templateid = api_request(resource[:api], + {:method => "template.get", + :params => {:filter => {:host => [resource[:template]]}}}) + api_request(resource[:api], + {:method => "template.massAdd", + :params => {:hosts => [{:hostid => hostid[0]["hostid"]}], + :templates => [{:templateid => templateid[0]["templateid"]}]}}) + end + + def destroy + hostid = get_host(resource[:api], resource[:host]) + templateid = api_request(resource[:api], + {:method => "template.get", + :params => {:filter => {:host => [resource[:template]]}}}) + api_request(resource[:api], + {:method => "template.massRemove", + :params => {:hostids => [hostid[0]["hostid"]], + :templateids => templateid[0]["templateid"]}}) + end +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_usermacro/ruby.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_usermacro/ruby.rb new file mode 100644 index 0000000..d1ed507 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/provider/plugin_zabbix_usermacro/ruby.rb @@ -0,0 +1,116 @@ +$LOAD_PATH.push(File.join(File.dirname(__FILE__), '..', '..', '..')) +require 'puppet/provider/plugin_zabbix' + +Puppet::Type.type(:plugin_zabbix_usermacro).provide(:ruby, + :parent => Puppet::Provider::Plugin_zabbix) do + + def exists? + auth(resource[:api]) + macroid = nil + if resource[:global] == :true + result = api_request(resource[:api], + {:method => "usermacro.get", + :params => {:globalmacro => true, + :output => "extend"}}) + result.each { |macro| macroid = macro["globalmacroid"] if macro['macro'] == resource[:macro] } + else + hostid = get_host(resource[:api], resource[:host]) + raise(Puppet::Error, "Host #{resource[:host]} does not exist") unless not hostid.empty? + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {"hostids" => hostid[0]["hostid"], + :output => "extend"}}) + macroid = nil + result.each { |macro| macroid = macro['hostmacroid'] if macro['macro'] == resource[:macro] } + end + not macroid.nil? + end + + def create + if resource[:global] == :true + api_request(resource[:api], + {:method => 'usermacro.createglobal', + :params => {:macro => resource[:macro], + :value => resource[:value]}}) + else + hostid = get_host(resource[:api], resource[:host]) + api_request(resource[:api], + {:method => 'usermacro.create', + :params => {:macro => resource[:macro], + :value => resource[:value], + :hostid => hostid[0]["hostid"]}}) + end + end + + def destroy + macroid = nil + if resource[:global] == :true + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {:globalmacro => true, + :output => "extend"}}) + result.each { |macro| macroid = macro['globalmacroid'] if macro['macro'] == resource[:macro] } + api_request(resource[:api], + {:method => 'usermacro.deleteglobal', + :params => [macroid]}) + else + hostid = get_host(resource[:api], resource[:host]) + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {:hostids => hostid[0]["hostid"], + :output => "extend"}}) + result.each { |macro| macroid = macro['hostmacroid'] if macro['macro'] == resource[:macro] } + api_request(resource[:api], + {:method => 'usermacro.delete', + :params => [macroid]}) + end + end + + def value + #get value + macrovalue = nil + if resource[:global] == :true + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {:globalmacro => true, + :output => "extend"}}) + result.each { |macro| macrovalue = macro['value'] if macro['macro'] == resource[:macro] } + else + hostid = get_host(resource[:api], resource[:host]) + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {:hostids => hostid[0]["hostid"], + :output => "extend"}}) + result.each { |macro| macrovalue = macro['value'] if macro['macro'] == resource[:macro] } + end + macrovalue + end + + def value=(v) + #set value + macroid = nil + if resource[:global] == :true + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {:globalmacro => true, + :output => "extend"}}) + result.each { |macro| macroid = macro['globalmacroid'].to_i if macro['macro'] == resource[:macro] } + api_request(resource[:api], + {:method => 'usermacro.updateglobal', + :params => {:globalmacroid => macroid, + :value => resource[:value]}}) + else + hostid = get_host(resource[:api], resource[:host]) + result = api_request(resource[:api], + {:method => 'usermacro.get', + :params => {:hostids => hostid[0]["hostid"], + :output => "extend"}}) + result.each { |macro| macroid = macro['hostmacroid'].to_i if macro['macro'] == resource[:macro] } + api_request(resource[:api], + {:method => 'usermacro.update', + :params => {:hostmacroid => macroid, + :value => resource[:value]}}) + end + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_configuration_import.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_configuration_import.rb new file mode 100644 index 0000000..d4734b5 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_configuration_import.rb @@ -0,0 +1,59 @@ +require 'puppet/util/filetype' +require 'digest/md5' + +Puppet::Type.newtype(:plugin_zabbix_configuration_import) do + desc <<-EOT + Import Zabbix configuration from a file. + EOT + + ensurable + # do + # defaultvalues + # defaultto :present + # end + + newparam(:name, :namevar => true) do + desc 'Name of import.' + end + + newparam(:api) do + desc 'Zabbix api info: endpoint, username, password.' + isrequired + + validate do |value| + fail("api is not a hash") unless value.kind_of?(Hash) + fail("api hash does not contain username") unless value.has_key?("username") + fail("username is not valid") unless value['username'] =~ /.+/ + fail("api hash does not contain password") unless value.has_key?("password") + fail("password is not valid") unless value['password'] =~ /.+/ + fail("api hash does not contain endpoint") unless value.has_key?("endpoint") + fail("endpoint is not valid") unless value['endpoint'] =~ /http(s)?:\/\/.+/ + end + end + + newproperty(:xml_file) do + desc 'xml file' + isrequired + + validate do |value| + unless Pathname.new(value).absolute? + fail("Invalid xml_file path #{value}") + end + end + + def insync?(is) + xml_file_content = Puppet::Util::FileType.filetype(:flat).new(value).read + if is == Digest::MD5.hexdigest(xml_file_content) + true + else + false + end + end + + end + + autorequire(:file) do + [@parameters[:xml_file]] + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_host.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_host.rb new file mode 100644 index 0000000..0890960 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_host.rb @@ -0,0 +1,101 @@ + +Puppet::Type.newtype(:plugin_zabbix_host) do + desc <<-EOT + Manage a host in Zabbix + EOT + + ensurable do + defaultvalues + defaultto :present + end + + newparam(:host, :namevar => true) do + desc 'Technical name of the host.' + newvalues(/.+/) + end + + newparam(:ip) do + desc <<-EOT + IP of the host. + + Set this for the default interface to be + ip based. Use zabbix_host_interface to add + additional interfaces if you want dns on + the main agent and an ip for others. + EOT + isrequired + newvalues(/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/) + end + + newparam(:type) do + desc <<-EOT + Zabbix host type. + 1 - ip interface + 2 - snmp interface + ... + EOT + end + + newparam(:port) do + desc <<-EOT + Port of the host. + + EOT + newvalues(/^[0-9]{1,5}$/) + end + + newparam(:groups) do + desc 'Host groups to add the host to.' + isrequired + + validate do |value| + fail("groups is not an array") unless value.kind_of?(Array) or value.kind_of?(String) + fail("groups array is empty") if value.empty? + value.each do |item| + fail("group name is not a string") unless item.kind_of?(String) + fail("group name is empty") unless item =~ /.+/ + end + end + end + + newparam(:hostname) do + desc 'Visible name of the host.' + newvalues(/.+/) + end + + newparam(:proxy_hostid) do + desc 'ID of the proxy that is used to monitor the host.' + + validate do |value| + fail("proxy_hostid is not an integer or integer string") unless value.kind_of?(Integer) or value =~ /[0-9]+/ + end + end + + newparam(:status) do + desc <<-EOT + Status and function of the host. + + Possible values are: + * 0 - (default) monitored host; + * 1 - unmonitored host. + EOT + newvalues(0, 1) + defaultto 0 + end + + newparam(:api) do + desc 'Zabbix api info: endpoint, username, password.' + isrequired + + validate do |value| + fail("api is not a hash") unless value.kind_of?(Hash) + fail("api hash does not contain username") unless value.has_key?("username") + fail("username is not valid") unless value['username'] =~ /.+/ + fail("api hash does not contain password") unless value.has_key?("password") + fail("password is not valid") unless value['password'] =~ /.+/ + fail("api hash does not contain endpoint") unless value.has_key?("endpoint") + fail("endpoint is not valid") unless value['endpoint'] =~ /http(s)?:\/\/.+/ + end + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_hostgroup.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_hostgroup.rb new file mode 100644 index 0000000..bba3110 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_hostgroup.rb @@ -0,0 +1,31 @@ + +Puppet::Type.newtype(:plugin_zabbix_hostgroup) do + desc <<-EOT + Manage a host group in Zabbix + EOT + + ensurable do + defaultvalues + defaultto :present + end + + newparam(:name, :namevar => true) do + desc 'Name of the host group.' + newvalues(/.+/) + end + + newparam(:api) do + desc 'Zabbix api info: endpoint, username, password.' + isrequired + + validate do |value| + fail("api is not a hash") unless value.kind_of?(Hash) + fail("api hash does not contain username") unless value.has_key?("username") + fail("username is not valid") unless value['username'] =~ /.+/ + fail("api hash does not contain password") unless value.has_key?("password") + fail("password is not valid") unless value['password'] =~ /.+/ + fail("api hash does not contain endpoint") unless value.has_key?("endpoint") + fail("endpoint is not valid") unless value['endpoint'] =~ /http(s)?:\/\/.+/ + end + end +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_template_link.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_template_link.rb new file mode 100644 index 0000000..a71dcb2 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_template_link.rb @@ -0,0 +1,44 @@ + +Puppet::Type.newtype(:plugin_zabbix_template_link) do + desc <<-EOT + Manage a template link in Zabbix + EOT + + ensurable do + defaultvalues + defaultto :present + end + + newparam(:name, :namevar => true) do + desc 'Template link name.' + newvalues(/.+/) + end + + newparam(:host) do + desc 'Technical name of the host.' + newvalues(/.+/) + isrequired + end + + newparam(:template) do + desc 'Template name to link the host to.' + newvalues(/.+/) + isrequired + end + + newparam(:api) do + desc 'Zabbix api info: endpoint, username, password.' + isrequired + + validate do |value| + fail("api is not a hash") unless value.kind_of?(Hash) + fail("api hash does not contain username") unless value.has_key?("username") + fail("username is not valid") unless value['username'] =~ /.+/ + fail("api hash does not contain password") unless value.has_key?("password") + fail("password is not valid") unless value['password'] =~ /.+/ + fail("api hash does not contain endpoint") unless value.has_key?("endpoint") + fail("endpoint is not valid") unless value['endpoint'] =~ /http(s)?:\/\/.+/ + end + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_usermacro.rb b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_usermacro.rb new file mode 100644 index 0000000..45e80a2 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/lib/puppet/type/plugin_zabbix_usermacro.rb @@ -0,0 +1,64 @@ +Puppet::Type.newtype(:plugin_zabbix_usermacro) do + desc <<-EOT + Manage a macro in Zabbix. + EOT + + ensurable do + defaultvalues + defaultto :present + end + + newparam(:name, :namevar => true) do + desc 'namevar' + newvalues(/.+/) + end + + newparam(:api) do + desc 'Zabbix api info: endpoint, username, password.' + isrequired + + validate do |value| + fail("api is not a hash") unless value.kind_of?(Hash) + fail("api hash does not contain username") unless value.has_key?("username") + fail("username is not valid") unless value['username'] =~ /.+/ + fail("api hash does not contain password") unless value.has_key?("password") + fail("password is not valid") unless value['password'] =~ /.+/ + fail("api hash does not contain endpoint") unless value.has_key?("endpoint") + fail("endpoint is not valid") unless value['endpoint'] =~ /http(s)?:\/\/.+/ + end + end + + newparam(:macro) do + desc 'Macro name' + isrequired + newvalues(/.+/) + end + + newproperty(:value) do + desc 'Macro value' + isrequired + newvalues(/.+/) + end + + newparam(:global) do + desc <<-EOT + Macro global flag. If true macro is global. + If false macro belongs to host/template. + EOT + defaultto(:false) + newvalues(:true, :false) + end + + newparam(:host) do + desc 'Host' + newvalues(/.+/) + end + + validate do + fail('host should not be provided when global is true') if + self[:global] == :true and not self[:host].nil? + fail('host is required when global is false') if + self[:global] == :false and self[:host].nil? + end +end + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent.pp new file mode 100644 index 0000000..6f01fc0 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent.pp @@ -0,0 +1,66 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::agent( + $api_hash = undef, +) { + + include plugin_zabbix::params + + $zabbix_agent_port = $plugin_zabbix::params::zabbix_ports['backend_agent'] ? { unset=>$plugin_zabbix::params::zabbix_ports['agent'], default=>$plugin_zabbix::params::zabbix_ports['backend_agent'] } + + firewall { '997 zabbix agent': + port => $zabbix_agent_port, + proto => 'tcp', + action => 'accept' + } + + package { $plugin_zabbix::params::agent_pkg: + ensure => present + } + -> + file { $plugin_zabbix::params::agent_include: + ensure => directory, + mode => '0500', + owner => 'zabbix', + group => 'zabbix' + } + -> + file { $plugin_zabbix::params::agent_config: + ensure => present, + content => template($plugin_zabbix::params::agent_config_template), + notify => Service[$plugin_zabbix::params::agent_service] + } + -> + service { $plugin_zabbix::params::agent_service: + ensure => running, + enable => true, + } + + if defined_in_state(Class['openstack::controller']){ + $groups = union($plugin_zabbix::params::host_groups_base, $plugin_zabbix::params::host_groups_controller) + } elsif defined_in_state(Class['openstack::compute']) { + $groups = union($plugin_zabbix::params::host_groups_base, $plugin_zabbix::params::host_groups_compute) + } else { + $groups = $plugin_zabbix::params::host_groups_base + } + + plugin_zabbix_host { $plugin_zabbix::params::host_name: + host => $plugin_zabbix::params::host_name, + ip => $plugin_zabbix::params::host_ip, + groups => $groups, + api => $api_hash + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent/scripts.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent/scripts.pp new file mode 100644 index 0000000..12ddc4c --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent/scripts.pp @@ -0,0 +1,59 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::agent::scripts { + + include plugin_zabbix::params + + file { $plugin_zabbix::params::agent_scripts: + ensure => directory, + recurse => true, + purge => true, + force => true, + mode => '0755', + source => 'puppet:///modules/plugin_zabbix/scripts', + } + + file { '/etc/zabbix/check_api.conf': + ensure => present, + content => template('plugin_zabbix/check_api.conf.erb'), + } + + file { '/etc/zabbix/check_rabbit.conf': + ensure => present, + content => template('plugin_zabbix/check_rabbit.conf.erb'), + } + + file { '/etc/zabbix/check_db.conf': + ensure => present, + content => template('plugin_zabbix/check_db.conf.erb'), + } + + if ! defined(Package['sudo']) { + package { 'sudo': + ensure => installed + } + } + + file { 'zabbix_no_requiretty': + path => '/etc/sudoers.d/zabbix', + mode => '0440', + owner => root, + group => root, + source => 'puppet:///modules/plugin_zabbix/zabbix-sudo', + require => Package['sudo'], + } + +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent/userparameter.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent/userparameter.pp new file mode 100644 index 0000000..c7c5703 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/agent/userparameter.pp @@ -0,0 +1,47 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +define plugin_zabbix::agent::userparameter ( + $ensure = present, + $command = undef, + $key = undef, + $index = undef, + $file = undef, + $template = 'plugin_zabbix/zabbix_agent_userparam.conf.erb' +) { + + include plugin_zabbix::params + + $key_real = $key ? { + undef => $name, + default => $key + } + + $index_real = $index ? { + undef => '', + default => "${index}_", + } + + $file_real = $file ? { + undef => "${::plugin_zabbix::params::agent_include}/${index_real}${name}.conf", + default => $file, + } + + file { $file_real: + ensure => $ensure, + content => template($template), + notify => Service[$plugin_zabbix::params::agent_service] + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/controller.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/controller.pp new file mode 100644 index 0000000..14661fb --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/controller.pp @@ -0,0 +1,97 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::controller { + + include plugin_zabbix::params + + file { '/etc/dbconfig-common': + ensure => directory, + owner => 'root', + group => 'root', + mode => '0755', + } + + file { '/etc/dbconfig-common/zabbix-server-mysql.conf': + ensure => present, + require => File['/etc/dbconfig-common'], + mode => '0600', + source => 'puppet:///modules/plugin_zabbix/zabbix-server-mysql.conf', + } + + package { $plugin_zabbix::params::server_pkg: + ensure => present, + require => File['/etc/dbconfig-common/zabbix-server-mysql.conf'], + } + + file { $plugin_zabbix::params::server_config: + ensure => present, + require => Package[$plugin_zabbix::params::server_pkg], + content => template($plugin_zabbix::params::server_config_template), + } + + file { $plugin_zabbix::params::server_scripts: + ensure => directory, + require => Package[$plugin_zabbix::params::server_pkg], + recurse => true, + purge => true, + force => true, + mode => '0755', + source => 'puppet:///modules/plugin_zabbix/externalscripts', + } + + file { 'zabbix-server-ocf' : + ensure => present, + path => "${plugin_zabbix::params::ocf_scripts_dir}/${plugin_zabbix::params::ocf_scripts_provider}/${plugin_zabbix::params::server_service}", + mode => '0755', + owner => 'root', + group => 'root', + source => 'puppet:///modules/plugin_zabbix/zabbix-server.ocf', + } + service { "${plugin_zabbix::params::server_service}-init-stopped": + ensure => 'stopped', + name => $plugin_zabbix::params::server_service, + enable => false, + require => File[$plugin_zabbix::params::server_config], + } + + File['zabbix-server-ocf'] -> Service["${plugin_zabbix::params::server_service}-init-stopped"] + + cron { 'zabbix db_clean': + ensure => 'present', + require => File[$plugin_zabbix::params::server_scripts], + command => "${plugin_zabbix::params::server_scripts}/db_clean.sh", + user => 'root', + minute => '*/5', + } + + if $plugin_zabbix::params::frontend { + class { 'plugin_zabbix::frontend': + require => File[$plugin_zabbix::params::server_config], + before => Class['plugin_zabbix::ha::haproxy'], + } + } + + include plugin_zabbix::ha::haproxy + + $zabbix_server_port = $plugin_zabbix::params::zabbix_ports['backend_server'] ? { unset=>$plugin_zabbix::params::zabbix_ports['server'], default=>$plugin_zabbix::params::zabbix_ports['backend_server'] } + + firewall { '997 zabbix server': + proto => 'tcp', + action => 'accept', + port => $zabbix_server_port, + } + +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/db.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/db.pp new file mode 100644 index 0000000..3798f82 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/db.pp @@ -0,0 +1,26 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::db( + $db_ip = undef, + $db_password = 'zabbix', +) { + #stub for multiple possible db backends + class { 'plugin_zabbix::db::mysql': + db_ip => $db_ip, + db_password => $db_password, + } + contain 'plugin_zabbix::db::mysql' +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/db/mysql.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/db/mysql.pp new file mode 100644 index 0000000..7e1f328 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/db/mysql.pp @@ -0,0 +1,72 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::db::mysql( + $db_ip = undef, + $db_password = 'zabbix', +) { + + include plugin_zabbix::params + + file { '/tmp/zabbix': + ensure => directory, + mode => '0755', + } + + file { '/tmp/zabbix/parts': + ensure => directory, + purge => true, + force => true, + recurse => true, + mode => '0755', + source => 'puppet:///modules/plugin_zabbix/sql', + require => File['/tmp/zabbix'] + } + + file { '/tmp/zabbix/parts/data_clean.sql': + ensure => present, + require => File['/tmp/zabbix/parts'], + content => template('plugin_zabbix/data_clean.erb'), + } + + exec { 'prepare-schema-1': + command => $plugin_zabbix::params::prepare_schema_cmd, + creates => '/tmp/zabbix/schema.sql', + path => ['/usr/sbin', '/usr/bin', '/sbin', '/bin'], + require => [File['/tmp/zabbix'], Package[$plugin_zabbix::params::server_pkg]], + notify => Exec['prepare-schema-2'], + } + + exec { 'prepare-schema-2': + command => 'cat /tmp/zabbix/parts/*.sql >> /tmp/zabbix/schema.sql', + path => ['/usr/sbin', '/usr/bin', '/sbin', '/bin'], + refreshonly => true, + require => File['/tmp/zabbix/parts/data_clean.sql'], + } + + plugin_zabbix::db::mysql_db { $plugin_zabbix::params::db_name: + user => $plugin_zabbix::params::db_user, + password => $db_password, + host => $db_ip, + require => Exec['prepare-schema-2'], + } + + exec{ "${plugin_zabbix::params::db_name}-import": + command => "/usr/bin/mysql ${plugin_zabbix::params::db_name} < /tmp/zabbix/schema.sql && touch /tmp/zabbix/imported", + creates => '/tmp/zabbix/imported', + logoutput => true, + require => Database[$plugin_zabbix::params::db_name], + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/db/mysql_db.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/db/mysql_db.pp new file mode 100644 index 0000000..02d28a0 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/db/mysql_db.pp @@ -0,0 +1,58 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +define plugin_zabbix::db::mysql_db ( + $user, + $password, + $charset = 'utf8', + $host = 'localhost', + $grant = 'all', + $sql = '', + $enforce_sql = false +) { + + database { $name: + ensure => present, + charset => $charset, + provider => 'mysql', + } + + database_user { "${user}@${host}": + ensure => present, + password_hash => mysql_password($password), + provider => 'mysql', + require => Database[$name], + } + + database_grant { "${user}@${host}/${name}": + privileges => $grant, + provider => 'mysql', + require => Database_user["${user}@${host}"], + } + + $refresh = ! $enforce_sql + + if $sql { + exec{ "${name}-import": + command => "/usr/bin/mysql ${name} < ${sql}", + logoutput => true, + refreshonly => $refresh, + require => Database_grant["${user}@${host}/${name}"], + subscribe => Database[$name], + } + } + +} + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/frontend.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/frontend.pp new file mode 100644 index 0000000..f5d03e2 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/frontend.pp @@ -0,0 +1,95 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::frontend { + + include plugin_zabbix::params + + service { $plugin_zabbix::params::frontend_service: + ensure => 'running', + enable => true, + hasstatus => true, + hasrestart => true, + } + + package { $plugin_zabbix::params::frontend_pkg: + ensure => present, + } + + file { $plugin_zabbix::params::frontend_config: + ensure => present, + content => template($plugin_zabbix::params::frontend_config_template), + notify => Service[$plugin_zabbix::params::frontend_service], + require => Package[$plugin_zabbix::params::frontend_pkg], + } + + file_line { 'php timezone': + path => $plugin_zabbix::params::frontend_service_config, + line => ' php_value date.timezone UTC', + match => 'php_value date.timezone', + notify => Service[$plugin_zabbix::params::frontend_service], + require => Package[$plugin_zabbix::params::frontend_pkg], + } + + # disable worker MPM, use prefork MPM which is required by mod_php: + case $::osfamily { + 'RedHat': { + # default line: "HTTPD=/usr/sbin/httpd -W" + # target line: "HTTPD=/usr/sbin/httpd" + # we need to remove -W argument (disable mpm_worker) + # match parameter must match the common part of default and target lines + file_line { 'httpd_mpm_prefork': + path => '/etc/sysconfig/httpd', + line => 'HTTPD=/usr/sbin/httpd', + match => '^HTTPD=/usr/sbin/httpd', + notify => Service[$plugin_zabbix::params::frontend_service], + require => Package[$plugin_zabbix::params::frontend_pkg], + } + } + 'Debian': { + file { '/etc/apache2/mods-enabled/worker.conf': + ensure => absent, + notify => Service[$plugin_zabbix::params::frontend_service], + require => Package[$plugin_zabbix::params::frontend_pkg], + } + file { '/etc/apache2/mods-enabled/worker.load': + ensure => absent, + notify => Service[$plugin_zabbix::params::frontend_service], + require => Package[$plugin_zabbix::params::frontend_pkg], + } + } + default: {} + } + + # postinst script in zabbix-frontend-php package creates an invalid symlink + # hack: in debconf disable apache configuration and restarting + # and create the symlink manually then restart apache + case $::osfamily { + 'Debian': { + exec { 'configure zabbix-frontend-php package': + command => 'echo "zabbix-frontend-php zabbix-frontend-php/configure-apache boolean false\nzabbix-frontend-php zabbix-frontend-php/restart-webserver boolean false" | debconf-set-selections', + provider => 'shell', + before => Package[$plugin_zabbix::params::frontend_pkg], + } + file { '/etc/apache2/conf.d/zabbix.conf': + ensure => link, + target => $plugin_zabbix::params::frontend_service_config, + notify => Service[$plugin_zabbix::params::frontend_service], + require => Package[$plugin_zabbix::params::frontend_pkg], + } + } + default: {} + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/ha/haproxy.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/ha/haproxy.pp new file mode 100644 index 0000000..d99dae7 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/ha/haproxy.pp @@ -0,0 +1,97 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::ha::haproxy { + + Haproxy::Service { use_include => true } + Haproxy::Balancermember { use_include => true } + + $public_vip = hiera('public_vip') + $management_vip = hiera('management_vip') + $nodes_hash = hiera('nodes') + $primary_controller_nodes = filter_nodes($nodes_hash,'role','primary-controller') + $controllers = concat($primary_controller_nodes, filter_nodes($nodes_hash,'role','controller')) + + Plugin_zabbix::Ha::Haproxy_service { + server_names => filter_hash($controllers, 'name'), + ipaddresses => filter_hash($controllers, 'internal_address'), + public_virtual_ip => $public_vip, + internal_virtual_ip => $management_vip, + } + + plugin_zabbix::ha::haproxy_service { 'zabbix-agent': + order => '210', + listen_port => $plugin_zabbix::params::zabbix_ports['agent'], + balancermember_port => $plugin_zabbix::params::zabbix_ports['backend_agent'], + + haproxy_config_options => { + 'option' => ['tcpka'], + 'timeout client' => '48h', + 'timeout server' => '48h', + 'balance' => 'roundrobin', + 'mode' => 'tcp' + }, + + balancermember_options => 'check inter 5000 rise 2 fall 3', + } + + plugin_zabbix::ha::haproxy_service { 'zabbix-server': + order => '200', + listen_port => $plugin_zabbix::params::zabbix_ports['server'], + balancermember_port => $plugin_zabbix::params::zabbix_ports['backend_server'], + + haproxy_config_options => { + 'option' => ['tcpka'], + 'timeout client' => '48h', + 'timeout server' => '48h', + 'balance' => 'roundrobin', + 'mode' => 'tcp' + }, + + balancermember_options => 'check inter 5000 rise 2 fall 3', + } + + file_line { 'add binding to management VIP for horizon and zabbix': + path => '/etc/haproxy/conf.d/015-horizon.cfg', + after => 'listen horizon', + line => " bind ${management_vip}:80", + before => Exec['haproxy reload'], + } + + exec { 'haproxy reload': + command => 'export OCF_ROOT="/usr/lib/ocf"; (ip netns list | grep haproxy) && ip netns exec haproxy /usr/lib/ocf/resource.d/fuel/ns_haproxy reload', + path => '/usr/bin:/usr/sbin:/bin:/sbin', + logoutput => true, + provider => 'shell', + tries => 10, + try_sleep => 10, + returns => [0, ''], + } + + Haproxy::Listen <||> -> Exec['haproxy reload'] + Haproxy::Balancermember <||> -> Exec['haproxy reload'] + + firewall { '998 zabbix agent vip': + proto => 'tcp', + action => 'accept', + port => $plugin_zabbix::params::zabbix_ports['agent'], + } + + firewall { '998 zabbix server vip': + proto => 'tcp', + action => 'accept', + port => $plugin_zabbix::params::zabbix_ports['server'], + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/ha/haproxy_service.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/ha/haproxy_service.pp new file mode 100644 index 0000000..b7522d1 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/ha/haproxy_service.pp @@ -0,0 +1,78 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Register a service with HAProxy +define plugin_zabbix::ha::haproxy_service ( + $order, + $server_names, + $ipaddresses, + $listen_port, + $public_virtual_ip, + $internal_virtual_ip, + + $mode = undef, + $haproxy_config_options = { 'option' => ['httplog'], 'balance' => 'roundrobin' }, + $balancermember_options = 'check', + $balancermember_port = $listen_port, + $define_cookies = false, + + # use active-passive failover, mark all backends except the first one + # as backups + $define_backups = false, + + # by default, listen only on internal VIP + $public = false, + $internal = true, + + # if defined, restart this service before registering it with HAProxy + $require_service = undef, + + # if true, configure this service before starting the haproxy service; + # HAProxy will refuse to start with no listening services defined + $before_start = false, +) { + + if $public and $internal { + $virtual_ips = [$public_virtual_ip, $internal_virtual_ip] + } elsif $internal { + $virtual_ips = [$internal_virtual_ip] + } elsif $public { + $virtual_ips = [$public_virtual_ip] + } + + haproxy::listen { $name: + order => $order, + ipaddress => $virtual_ips, + ports => $listen_port, + options => $haproxy_config_options, + mode => $mode, + } + + haproxy::balancermember { $name: + order => $order, + listening_service => $name, + server_names => $server_names, + ipaddresses => $ipaddresses, + ports => $balancermember_port, + options => $balancermember_options, + define_cookies => $define_cookies, + define_backups => $define_backups, + } + + if $require_service { + Service[$require_service] -> Haproxy::Listen[$name] + Service[$require_service] -> Haproxy::Balancermember[$name] + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/init.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/init.pp new file mode 100644 index 0000000..29cb93a --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/init.pp @@ -0,0 +1,16 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix {} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring.pp new file mode 100644 index 0000000..24b0320 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring.pp @@ -0,0 +1,109 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring( + $server_ips = undef, +) { + + include plugin_zabbix::params + + $api_hash = $plugin_zabbix::params::api_hash + + if is_ip_address($::public_address) { + plugin_zabbix_usermacro { "${plugin_zabbix::params::host_name} IP_PUBLIC": + host => $plugin_zabbix::params::host_name, + macro => '{$IP_PUBLIC}', + value => $::public_address, + api => $api_hash, + } + } + + if is_ip_address($::internal_address) { + plugin_zabbix_usermacro { "${plugin_zabbix::params::host_name} IP_MANAGEMENT": + host => $plugin_zabbix::params::host_name, + macro => '{$IP_MANAGEMENT}', + value => $::internal_address, + api => $api_hash, + } + } + + if is_ip_address($::swift_address) { + plugin_zabbix_usermacro { "${plugin_zabbix::params::host_name} IP_STORAGE": + host => $plugin_zabbix::params::host_name, + macro => '{$IP_STORAGE}', + value => $::swift_address, + api => $api_hash, + } + } + + class { 'plugin_zabbix::agent': + api_hash => $api_hash, + before => Class['plugin_zabbix::agent::scripts'], + } + + class { 'plugin_zabbix::agent::scripts': } + + plugin_zabbix::agent::userparameter { + 'vfs.dev.discovery': + ensure => 'present', + command => '/etc/zabbix/scripts/vfs.dev.discovery.sh'; + 'vfs.mdadm.discovery': + ensure => 'present', + command => '/etc/zabbix/scripts/vfs.mdadm.discovery.sh'; + 'proc.vmstat': + key => 'proc.vmstat[*]', + command => 'grep \'$1\' /proc/vmstat | awk \'{print $$2}\''; + 'crm.node.check': + key => 'crm.node.check[*]', + command => '/etc/zabbix/scripts/crm_node_check.sh $1'; + } + + #Linux + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template Fuel OS Linux": + host => $plugin_zabbix::params::host_name, + template => 'Template Fuel OS Linux', + api => $api_hash, + } + + #Zabbix Agent + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App Zabbix Agent": + host => $plugin_zabbix::params::host_name, + template => 'Template App Zabbix Agent', + api => $api_hash, + } + + Plugin_zabbix_usermacro { require => Class['plugin_zabbix::agent'] } + Plugin_zabbix_template_link { require => Class['plugin_zabbix::agent'] } + + # Auto-registration + include plugin_zabbix::monitoring::nova_mon + include plugin_zabbix::monitoring::keystone_mon + include plugin_zabbix::monitoring::glance_mon + include plugin_zabbix::monitoring::cinder_mon + include plugin_zabbix::monitoring::swift_mon + include plugin_zabbix::monitoring::rabbitmq_mon + include plugin_zabbix::monitoring::horizon_mon + include plugin_zabbix::monitoring::mysql_mon + include plugin_zabbix::monitoring::memcached_mon + include plugin_zabbix::monitoring::haproxy_mon + include plugin_zabbix::monitoring::zabbixserver_mon + include plugin_zabbix::monitoring::openstack_virtual_mon + include plugin_zabbix::monitoring::neutron_mon + include plugin_zabbix::monitoring::openvswitch_mon + include plugin_zabbix::monitoring::ceilometer_mon + include plugin_zabbix::monitoring::ceilometer_compute_mon + include plugin_zabbix::monitoring::ceph_mon + include plugin_zabbix::monitoring::firewall_mon +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceilometer_compute_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceilometer_compute_mon.pp new file mode 100644 index 0000000..7f366fd --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceilometer_compute_mon.pp @@ -0,0 +1,28 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::ceilometer_compute_mon { + + include plugin_zabbix::params + + #Ceilometer + if defined_in_state(Class['Ceilometer::Agent::Compute']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Ceilometer Compute": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Ceilometer Compute', + api => $plugin_zabbix::monitoring::api_hash, + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceilometer_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceilometer_mon.pp new file mode 100644 index 0000000..0a82453 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceilometer_mon.pp @@ -0,0 +1,28 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::ceilometer_mon { + + include plugin_zabbix::params + + #Ceilometer + if defined_in_state(Class['Openstack::Ceilometer']) and defined_in_state(Class['Openstack::Controller']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Ceilometer": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Ceilometer', + api => $plugin_zabbix::monitoring::api_hash, + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceph_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceph_mon.pp new file mode 100644 index 0000000..148b433 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/ceph_mon.pp @@ -0,0 +1,32 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::ceph_mon { + + include plugin_zabbix::params + + if defined_in_state(Class['ceph::osds']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Ceph": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Ceph', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix::agent::userparameter { + 'ceph_health': + key => 'ceph.health', + command => '/etc/zabbix/scripts/ceph_health.sh' + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/cinder_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/cinder_mon.pp new file mode 100644 index 0000000..601c813 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/cinder_mon.pp @@ -0,0 +1,53 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::cinder_mon { + + include plugin_zabbix::params + + #Cinder + if defined_in_state(Class['cinder::api']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Cinder API": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Cinder API', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Cinder API check": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Cinder API check', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix::agent::userparameter { + 'cinder.api.status': + command => "/etc/zabbix/scripts/check_api.py cinder http ${::internal_address} 8776"; + } + } + + if defined_in_state(Class['cinder::scheduler']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Cinder Scheduler": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Cinder Scheduler', + api => $plugin_zabbix::monitoring::api_hash, + } + } + + if defined_in_state(Class['cinder::volume']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Cinder Volume": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Cinder Volume', + api => $plugin_zabbix::monitoring::api_hash, + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/firewall_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/firewall_mon.pp new file mode 100644 index 0000000..cafece6 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/firewall_mon.pp @@ -0,0 +1,34 @@ +class plugin_zabbix::monitoring::firewall_mon { + + include plugin_zabbix::params + + #Iptables stats + if defined_in_state(Class['firewall']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App Iptables Stats": + host => $plugin_zabbix::params::host_name, + template => 'Template App Iptables Stats', + api => $plugin_zabbix::monitoring::api_hash, + } + package { 'iptstate': + ensure => present; + } + plugin_zabbix::agent::userparameter { + 'iptstate.tcp': + command => 'sudo iptstate -1 | grep tcp | wc -l'; + 'iptstate.tcp.syn': + command => 'sudo iptstate -1 | grep SYN | wc -l'; + 'iptstate.tcp.timewait': + command => 'sudo iptstate -1 | grep TIME_WAIT | wc -l'; + 'iptstate.tcp.established': + command => 'sudo iptstate -1 | grep ESTABLISHED | wc -l'; + 'iptstate.tcp.close': + command => 'sudo iptstate -1 | grep CLOSE | wc -l'; + 'iptstate.udp': + command => 'sudo iptstate -1 | grep udp | wc -l'; + 'iptstate.icmp': + command => 'sudo iptstate -1 | grep icmp | wc -l'; + 'iptstate.other': + command => 'sudo iptstate -1 -t | head -2 |tail -1 | sed -e \'s/^.*Other: \(.*\) (.*/\1/\'' + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/glance_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/glance_mon.pp new file mode 100644 index 0000000..9b67806 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/glance_mon.pp @@ -0,0 +1,45 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::glance_mon { + + include plugin_zabbix::params + + #Glance + if defined_in_state(Class['glance::api']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Glance API": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Glance API', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Glance API check": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Glance API check', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix::agent::userparameter { + 'glance.api.status': + command => "/etc/zabbix/scripts/check_api.py glance http ${::internal_address} 9292"; + } + } + + if defined_in_state(Class['glance::registry']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Glance Registry": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Glance Registry', + api => $plugin_zabbix::monitoring::api_hash, + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/haproxy_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/haproxy_mon.pp new file mode 100644 index 0000000..783e6a1 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/haproxy_mon.pp @@ -0,0 +1,47 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::haproxy_mon { + + include plugin_zabbix::params + + if defined_in_state(Class[Cluster::Haproxy]) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App HAProxy": + host => $plugin_zabbix::params::host_name, + template => 'Template App HAProxy', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix::agent::userparameter { + 'haproxy.be.discovery': + key => 'haproxy.be.discovery', + command => '/etc/zabbix/scripts/haproxy.sh -b'; + 'haproxy.be': + key => 'haproxy.be[*]', + command => '/etc/zabbix/scripts/haproxy.sh -v $1'; + 'haproxy.fe.discovery': + key => 'haproxy.fe.discovery', + command => '/etc/zabbix/scripts/haproxy.sh -f'; + 'haproxy.fe': + key => 'haproxy.fe[*]', + command => '/etc/zabbix/scripts/haproxy.sh -v $1'; + 'haproxy.sv.discovery': + key => 'haproxy.sv.discovery', + command => '/etc/zabbix/scripts/haproxy.sh -s'; + 'haproxy.sv': + key => 'haproxy.sv[*]', + command => '/etc/zabbix/scripts/haproxy.sh -v $1'; + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/horizon_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/horizon_mon.pp new file mode 100644 index 0000000..7645953 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/horizon_mon.pp @@ -0,0 +1,28 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::horizon_mon { + + include plugin_zabbix::params + + #Horizon + if defined_in_state(Class['horizon']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Horizon": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Horizon', + api => $plugin_zabbix::monitoring::api_hash, + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/keystone_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/keystone_mon.pp new file mode 100644 index 0000000..f4c1b18 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/keystone_mon.pp @@ -0,0 +1,39 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::keystone_mon { + + include plugin_zabbix::params + + #Keystone + if defined_in_state(Class['keystone']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Keystone": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Keystone', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Keystone API check": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Keystone API check', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix::agent::userparameter { + 'keystone.api.status': + command => "/etc/zabbix/scripts/check_api.py keystone http ${::internal_address} 5000"; + 'keystone.service.api.status': + command => "/etc/zabbix/scripts/check_api.py keystone_service http ${::internal_address} 35357"; + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/memcached_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/memcached_mon.pp new file mode 100644 index 0000000..9450295 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/memcached_mon.pp @@ -0,0 +1,32 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::memcached_mon { + + include plugin_zabbix::params + + if defined_in_state(Class['memcached']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App Memcache": + host => $plugin_zabbix::params::host_name, + template => 'Template App Memcache', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix::agent::userparameter { + 'memcache': + key => 'memcache[*]', + command => "/bin/echo -e \"stats\\nquit\" | nc ${plugin_zabbix::params::host_ip} 11211 | grep \"STAT \$1 \" | awk \'{print \$\$3}\'" + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/mysql_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/mysql_mon.pp new file mode 100644 index 0000000..dffc096 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/mysql_mon.pp @@ -0,0 +1,52 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::mysql_mon { + + include plugin_zabbix::params + + if defined_in_state(Class['mysql::server']) { + + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App MySQL": + host => $plugin_zabbix::params::host_name, + template => 'Template App MySQL', + api => $plugin_zabbix::monitoring::api_hash, + } + + plugin_zabbix::agent::userparameter { + 'mysql.status': + key => 'mysql.status[*]', + command => 'echo "show global status where Variable_name=\'$1\';" | mysql -N | awk \'{print $$2}\''; + 'mysql.ping': + command => 'mysqladmin ping | grep -c alive'; + 'mysql.version': + command => 'mysql -V'; + } + + file { "${::plugin_zabbix::params::agent_include}/userparameter_mysql.conf": + ensure => absent, + } + + file { '/var/lib/zabbix': + ensure => directory, + } + + file { '/var/lib/zabbix/.my.cnf': + ensure => present, + content => template('plugin_zabbix/my.cnf.erb'), + require => File['/var/lib/zabbix'], + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/neutron_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/neutron_mon.pp new file mode 100644 index 0000000..67e8112 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/neutron_mon.pp @@ -0,0 +1,76 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::neutron_mon { + + include plugin_zabbix::params + + # Neutron server + if defined_in_state(Class['::neutron']) and !defined_in_state(Class['openstack::compute']) { + + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Neutron Server": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Neutron Server', + api => $plugin_zabbix::monitoring::api_hash, + } + + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Neutron API check": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Neutron API check', + api => $plugin_zabbix::monitoring::api_hash, + } + + plugin_zabbix::agent::userparameter { + 'neutron.api.status': + command => "/etc/zabbix/scripts/check_api.py neutron http ${::internal_address} 9696"; + } + } + + # Neutron OVS agent + if defined_in_state(Class[Neutron::Agents::Ml2::Ovs]) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Neutron OVS Agent": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Neutron OVS Agent', + api => $plugin_zabbix::monitoring::api_hash, + } + } + + # Neutron Metadata agent + if defined_in_state(Class['::neutron::agents::metadata']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Neutron Metadata Agent": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Neutron Metadata Agent', + api => $plugin_zabbix::monitoring::api_hash, + } + } + + # Neutron L3 agent + if defined_in_state(Class['::neutron::agents::l3']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Neutron L3 Agent": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Neutron L3 Agent', + api => $plugin_zabbix::monitoring::api_hash, + } + } + + # Neutron DHCP agent + if defined_in_state(Class['::neutron::agents::dhcp']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Neutron DHCP Agent": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Neutron DHCP Agent', + api => $plugin_zabbix::monitoring::api_hash, + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/nova_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/nova_mon.pp new file mode 100644 index 0000000..a431963 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/nova_mon.pp @@ -0,0 +1,109 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::nova_mon { + + include plugin_zabbix::params + + # Nova (controller) + if defined_in_state(Class['openstack::controller']) { + + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Nova API": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Nova API', + api => $plugin_zabbix::monitoring::api_hash, + } + + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Nova API OSAPI": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Nova API OSAPI', + api => $plugin_zabbix::monitoring::api_hash, + } + + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Nova API OSAPI check": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Nova API OSAPI check', + api => $plugin_zabbix::monitoring::api_hash, + } + + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Nova API EC2": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Nova API EC2', + api => $plugin_zabbix::monitoring::api_hash, + } + + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Nova Cert": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Nova Cert', + api => $plugin_zabbix::monitoring::api_hash, + } + + plugin_zabbix::agent::userparameter { + 'nova.api.status': + command => "/etc/zabbix/scripts/check_api.py nova_os http ${::internal_address} 8774"; + } + } + + #Nova (compute) + if defined_in_state(Class['openstack::compute']) { + + if ! hiera('quantum',false) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Nova API Metadata": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Nova API Metadata', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Nova Network": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Nova Network', + api => $plugin_zabbix::monitoring::api_hash, + } + } + } + + if defined_in_state(Class['nova::consoleauth']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Nova ConsoleAuth": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Nova ConsoleAuth', + api => $plugin_zabbix::monitoring::api_hash, + } + } + + if defined_in_state(Class['nova::scheduler']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Nova Scheduler": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Nova Scheduler', + api => $plugin_zabbix::monitoring::api_hash, + } + } + + #Nova compute + if defined_in_state(Class['nova::compute']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Nova Compute": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Nova Compute', + api => $plugin_zabbix::monitoring::api_hash, + } + } + + #Libvirt + if defined_in_state(Class['nova::compute::libvirt']) { + plugin_zabbix_template_link { "${::fqdn} Template App OpenStack Libvirt": + host => $::fqdn, + template => 'Template App OpenStack Libvirt', + api => $plugin_zabbix::monitoring::api_hash, + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/openstack_virtual_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/openstack_virtual_mon.pp new file mode 100644 index 0000000..51d06fc --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/openstack_virtual_mon.pp @@ -0,0 +1,52 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::openstack_virtual_mon { + + include plugin_zabbix::params + + if defined_in_state(Class['openstack::controller']) { + plugin_zabbix::agent::userparameter { + 'db.token.count.query': + command => '/etc/zabbix/scripts/query_db.py token_count'; + 'db.instance.error.query': + command => '/etc/zabbix/scripts/query_db.py instance_error'; + 'db.services.offline.nova.query': + command => '/etc/zabbix/scripts/query_db.py services_offline_nova'; + 'db.instance.count.query': + command => '/etc/zabbix/scripts/query_db.py instance_count'; + 'db.cpu.total.query': + command => '/etc/zabbix/scripts/query_db.py cpu_total'; + 'db.cpu.used.query': + command => '/etc/zabbix/scripts/query_db.py cpu_used'; + 'db.ram.total.query': + command => '/etc/zabbix/scripts/query_db.py ram_total'; + 'db.ram.used.query': + command => '/etc/zabbix/scripts/query_db.py ram_used'; + 'db.services.offline.cinder.query': + command => '/etc/zabbix/scripts/query_db.py services_offline_cinder'; + 'vip.nova.api.status': + command => "/etc/zabbix/scripts/check_api.py nova_os http ${::plugin_zabbix::params::openstack::nova_vip} 8774"; + 'vip.glance.api.status': + command => "/etc/zabbix/scripts/check_api.py glance http ${::plugin_zabbix::params::openstack::glance_vip} 9292"; + 'vip.keystone.api.status': + command => "/etc/zabbix/scripts/check_api.py keystone http ${::plugin_zabbix::params::openstack::keystone_vip} 5000"; + 'vip.keystone.service.api.status': + command => "/etc/zabbix/scripts/check_api.py keystone_service http ${::plugin_zabbix::params::openstack::keystone_vip} 35357"; + 'vip.cinder.api.status': + command => "/etc/zabbix/scripts/check_api.py cinder http ${::plugin_zabbix::params::openstack::cinder_vip} 8776"; + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/openvswitch_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/openvswitch_mon.pp new file mode 100644 index 0000000..c279828 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/openvswitch_mon.pp @@ -0,0 +1,27 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::openvswitch_mon { + + include plugin_zabbix::params + + # Open vSwitch + + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Open vSwitch": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Open vSwitch', + api => $plugin_zabbix::monitoring::api_hash, + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/rabbitmq_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/rabbitmq_mon.pp new file mode 100644 index 0000000..6230beb --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/rabbitmq_mon.pp @@ -0,0 +1,55 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::rabbitmq_mon { + + include plugin_zabbix::params + + #RabbitMQ server + if defined_in_state(Class['Rabbitmq']) { + + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack RabbitMQ": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack HA RabbitMQ', + api => $plugin_zabbix::monitoring::api_hash, + } + + exec { 'enable rabbitmq management plugin': + command => 'rabbitmq-plugins enable rabbitmq_management', + path => ['/usr/sbin', '/usr/bin', '/sbin', '/bin' ], + unless => 'rabbitmq-plugins list -m -E rabbitmq_management | grep -q rabbitmq_management', + environment => 'HOME=/root', + } + + firewall {'992 rabbitmq management': + port => '15672', + proto => 'tcp', + action => 'accept', + } + + plugin_zabbix::agent::userparameter { + 'rabbitmq.queue.items': + command => '/etc/zabbix/scripts/check_rabbit.py queues-items'; + 'rabbitmq.queues.without.consumers': + command => '/etc/zabbix/scripts/check_rabbit.py queues-without-consumers'; + 'rabbitmq.missing.nodes': + command => '/etc/zabbix/scripts/check_rabbit.py missing-nodes'; + 'rabbitmq.unmirror.queues': + command => '/etc/zabbix/scripts/check_rabbit.py unmirror-queues'; + 'rabbitmq.missing.queues': + command => '/etc/zabbix/scripts/check_rabbit.py missing-queues'; + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/swift_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/swift_mon.pp new file mode 100644 index 0000000..abab9b4 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/swift_mon.pp @@ -0,0 +1,46 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::swift_mon { + + include plugin_zabbix::params + + #Swift + if defined_in_state(Class['openstack::swift::storage_node']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Swift Account": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Swift Account', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Swift Container": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Swift Container', + api => $plugin_zabbix::monitoring::api_hash, + } + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Swift Object": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Swift Object', + api => $plugin_zabbix::monitoring::api_hash, + } + } + + if defined_in_state(Class['swift::proxy']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App OpenStack Swift Proxy": + host => $plugin_zabbix::params::host_name, + template => 'Template App OpenStack Swift Proxy', + api => $plugin_zabbix::monitoring::api_hash, + } + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/zabbixserver_mon.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/zabbixserver_mon.pp new file mode 100644 index 0000000..6350074 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/monitoring/zabbixserver_mon.pp @@ -0,0 +1,26 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::monitoring::zabbixserver_mon { + + if defined_in_state(Class['plugin_zabbix::controller']) { + plugin_zabbix_template_link { "${plugin_zabbix::params::host_name} Template App Zabbix Server": + host => $plugin_zabbix::params::host_name, + template => 'Template App Zabbix Server', + api => $plugin_zabbix::monitoring::api_hash, + } + } + +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/params.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/params.pp new file mode 100644 index 0000000..e527162 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/params.pp @@ -0,0 +1,125 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::params { + + include plugin_zabbix::params::openstack + + $zabbix_hash = hiera('zabbix_monitoring') + + $zabbix_ports = { + server => '10051', + backend_server => '10052', + agent => '10049', + backend_agent => '10050', + api => '80', + } + + 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/zabbix_server.log' + + $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' + $frontend_service_config = '/etc/zabbix/apache.conf' + $frontend_config = '/etc/zabbix/web/zabbix.conf.php' + } + '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' + + $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' + $frontend_service_config = '/etc/httpd/conf.d/zabbix.conf' + $frontend_config = '/etc/zabbix/web/zabbix.conf.php' + } + default: { + fail("unsuported osfamily ${::osfamily}, currently Debian and Redhat are the only supported platforms") + } + } + + $agent_listen_ip = $::internal_address + $agent_source_ip = $::internal_address + + $agent_config_template = 'plugin_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' + $has_userparameters = true + + #server parameters + $server_ip = hiera('management_vip') + $server_config = '/etc/zabbix/zabbix_server.conf' + $server_scripts = '/etc/zabbix/externalscripts' + $server_config_template = 'plugin_zabbix/zabbix_server.conf.erb' + $server_node_id = 0 + $server_ensure = present + $ocf_scripts_dir = '/usr/lib/ocf/resource.d' + $ocf_scripts_provider = 'fuel' + + #frontend parameters + $frontend = true + $frontend_ensure = present + $frontend_base = '/zabbix' + $frontend_config_template = 'plugin_zabbix/zabbix.conf.php.erb' + + #common parameters + $db_type = 'MYSQL' + $db_ip = hiera('management_vip') + $db_port = '3306' + $db_name = 'zabbix' + $db_user = 'zabbix' + $db_password = $zabbix_hash['db_password'] + + #zabbix hosts params + $host_name = $::fqdn + $host_ip = $::internal_address + $host_groups = ['ManagedByPuppet', 'Controllers', 'Computes'] + $host_groups_base = ['ManagedByPuppet', 'Linux servers'] + $host_groups_controller = ['Controllers'] + $host_groups_compute = ['Computes'] + + #zabbix admin + $zabbix_admin_username = $zabbix_hash['username'] + $zabbix_admin_password = $zabbix_hash['password'] + $zabbix_admin_password_md5 = md5($zabbix_hash['password']) + + #api + $api_url = "http://${server_ip}:${zabbix_ports['api']}${frontend_base}/api_jsonrpc.php" + $api_hash = { endpoint => $api_url, + username => $zabbix_admin_username, + password => $zabbix_admin_password, } + +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/params/openstack.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/params/openstack.pp new file mode 100644 index 0000000..9951512 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/params/openstack.pp @@ -0,0 +1,47 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::params::openstack { + + $virtual_cluster_name = 'OpenStackCluster' + + $keystone_vip = hiera('management_vip') + $db_vip = hiera('management_vip') + $nova_vip = hiera('management_vip') + $glance_vip = hiera('management_vip') + $cinder_vip = hiera('management_vip') + $rabbit_vip = hiera('management_vip') + + $access_hash = hiera('access') + $keystone_hash = hiera('keystone') + $nova_hash = hiera('nova') + $cinder_hash = hiera('cinder') + $rabbit_hash = hiera('rabbit') + + $access_user = $access_hash['user'] + $access_password = $access_hash['password'] + $access_tenant = $access_hash['tenant'] + $keystone_db_password = $keystone_hash['db_password'] + $nova_db_password = $nova_hash['db_password'] + $cinder_db_password = $cinder_hash['db_password'] + $rabbit_password = $rabbit_hash['password'] + $rabbitmq_service_name = 'rabbitmq-server' + + if !$rabbit_hash['user'] { + $rabbit_user = 'nova' + } else { + $rabbit_user = $rabbit_hash['user'] + } +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/primary_controller.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/primary_controller.pp new file mode 100644 index 0000000..ac04450 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/primary_controller.pp @@ -0,0 +1,62 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::primary_controller { + + include plugin_zabbix::controller + + class { 'plugin_zabbix::db': + db_ip => $plugin_zabbix::params::db_ip, + db_password => $plugin_zabbix::params::db_password, + require => Package[$plugin_zabbix::params::server_pkg], + before => [ Class['plugin_zabbix::frontend'], Cs_resource["p_${plugin_zabbix::params::server_service}"] ], + } + + cs_resource { "p_${plugin_zabbix::params::server_service}": + primitive_class => 'ocf', + provided_by => $plugin_zabbix::params::ocf_scripts_provider, + primitive_type => $plugin_zabbix::params::server_service, + operations => { + 'monitor' => { 'interval' => '5s', 'timeout' => '30s' }, + 'start' => { 'interval' => '0', 'timeout' => '30s' } + }, + metadata => { + 'migration-threshold' => '3', + 'failure-timeout' => '120', + }, + } + + cs_colocation { 'vip_management-with-zabbix-server': + ensure => present, + score => 'INFINITY', + primitives => [ + 'vip__management', + "p_${plugin_zabbix::params::server_service}" + ], + } + + service { "${plugin_zabbix::params::server_service}-started": + ensure => running, + name => "p_${plugin_zabbix::params::server_service}", + enable => true, + provider => 'pacemaker', + } + + File[$plugin_zabbix::params::server_config] -> File['zabbix-server-ocf'] -> Cs_resource["p_${plugin_zabbix::params::server_service}"] + Service["${plugin_zabbix::params::server_service}-init-stopped"] -> Cs_resource["p_${plugin_zabbix::params::server_service}"] + Cs_resource["p_${plugin_zabbix::params::server_service}"] -> Cs_colocation['vip_management-with-zabbix-server'] + Cs_resource["p_${plugin_zabbix::params::server_service}"] -> Service["${plugin_zabbix::params::server_service}-started"] + +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/manifests/server/config.pp b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/server/config.pp new file mode 100644 index 0000000..0febd50 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/manifests/server/config.pp @@ -0,0 +1,318 @@ +# +# Copyright 2015 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +class plugin_zabbix::server::config { + + include plugin_zabbix::params + + $api_hash = $plugin_zabbix::params::api_hash + + plugin_zabbix_hostgroup { $plugin_zabbix::params::host_groups: + ensure => present, + api => $api_hash, + } + + file { '/etc/zabbix/import': + ensure => directory, + recurse => true, + purge => true, + force => true, + source => 'puppet:///modules/plugin_zabbix/import' + } + + Plugin_zabbix_configuration_import { + require => File['/etc/zabbix/import'], + } + + plugin_zabbix_configuration_import { 'Template_App_Zabbix_Agent.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_Zabbix_Agent.xml', + api => $api_hash, + } + + plugin_zabbix_configuration_import { 'Template_Fuel_OS_Linux.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_Fuel_OS_Linux.xml', + api => $api_hash, + } + + # Nova templates + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_API_EC2.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Nova_API_EC2.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_API.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Nova_API.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_API_Metadata.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Nova_API_Metadata.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_API_OSAPI.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Nova_API_OSAPI.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_API_OSAPI_check.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Nova_API_OSAPI_check.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_Cert.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Nova_Cert.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_ConsoleAuth.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Nova_ConsoleAuth.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_Scheduler.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Nova_Scheduler.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_Compute.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Nova_Compute.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Libvirt.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Libvirt.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Nova_Network.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Nova_Network.xml', + api => $api_hash, + } + + # Keystone templates + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Keystone.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Keystone.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Keystone_API_check.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Keystone_API_check.xml', + api => $api_hash, + } + + # Glance templates + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Glance_API.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Glance_API.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Glance_API_check.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Glance_API_check.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Glance_Registry.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Glance_Registry.xml', + api => $api_hash, + } + + # Cinder templates + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Cinder_API.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Cinder_API.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Cinder_API_check.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Cinder_API_check.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Cinder_Scheduler.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Cinder_Scheduler.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Cinder_Volume.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Cinder_Volume.xml', + api => $api_hash, + } + + # Swift templates + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Swift_Account.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Swift_Account.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Swift_Container.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Swift_Container.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Swift_Object.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Swift_Object.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Swift_Proxy.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Swift_Proxy.xml', + api => $api_hash, + } + + # Ceph template + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Ceph.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Ceph.xml', + api => $api_hash, + } + + # RabbitMQ template + plugin_zabbix_configuration_import { 'Template_App_OpenStack_RabbitMQ_ha.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_RabbitMQ_ha.xml', + api => $api_hash, + } + + # Horizon + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Horizon.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Horizon.xml', + api => $api_hash, + } + + # MySQL + plugin_zabbix_configuration_import { 'Template_App_MySQL.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_MySQL.xml', + api => $api_hash, + } + + # memcached + plugin_zabbix_configuration_import { 'Template_App_Memcache.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_Memcache.xml', + api => $api_hash, + } + + # HAProxy + plugin_zabbix_configuration_import { 'Template_App_HAProxy.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_HAProxy.xml', + api => $api_hash, + } + + # Zabbix server + plugin_zabbix_configuration_import { 'Template_App_Zabbix_Server.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_Zabbix_Server.xml', + api => $api_hash, + } + + + # Neutron + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Neutron_Server.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Neutron_Server.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Neutron_OVS_Agent.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Neutron_OVS_Agent.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Neutron_Metadata_Agent.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Neutron_Metadata_Agent.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Neutron_L3_Agent.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Neutron_L3_Agent.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Neutron_DHCP_Agent.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Neutron_DHCP_Agent.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Neutron_API_check.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Neutron_API_check.xml', + api => $api_hash, + } + + # Open vSwitch + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Open_vSwitch.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Open_vSwitch.xml', + api => $api_hash, + } + + # Ceilometer + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Ceilometer.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Ceilometer.xml', + api => $api_hash, + } + plugin_zabbix_configuration_import { 'Template_App_OpenStack_Ceilometer_Compute.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_OpenStack_Ceilometer_Compute.xml', + api => $api_hash, + } + + # Firewall + plugin_zabbix_configuration_import { 'Template_App_Iptables_Stats.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_App_Iptables_Stats.xml', + api => $api_hash, + } + + # Virtual OpenStack Cluster + plugin_zabbix_configuration_import { 'Template_OpenStack_Cluster.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Template_OpenStack_Cluster.xml', + api => $api_hash, + } + -> + plugin_zabbix_host { $plugin_zabbix::params::openstack::virtual_cluster_name: + host => $plugin_zabbix::params::openstack::virtual_cluster_name, + ip => $plugin_zabbix::params::server_ip, + port => $plugin_zabbix::params::zabbix_ports['agent'], + groups => $plugin_zabbix::params::host_groups_base, + api => $plugin_zabbix::params::api_hash, + } + -> + plugin_zabbix_template_link { "${plugin_zabbix::params::openstack::virtual_cluster_name} Template OpenStack Cluster": + host => $plugin_zabbix::params::openstack::virtual_cluster_name, + template => 'Template OpenStack Cluster', + api => $plugin_zabbix::params::api_hash, + } + -> + plugin_zabbix_configuration_import { 'Template_Screens_OpenStack_Cluster.xml Import': + ensure => present, + xml_file => '/etc/zabbix/import/Screens_OpenStack_Cluster.xml', + api => $plugin_zabbix::params::api_hash, + } + + Plugin_zabbix_hostgroup<||> -> Plugin_zabbix_host <||> + +} diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/spec/spec_helper.rb b/deployment_scripts/puppet/modules/plugin_zabbix/spec/spec_helper.rb new file mode 100644 index 0000000..2c6f566 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/spec/spec_helper.rb @@ -0,0 +1 @@ +require 'puppetlabs_spec_helper/module_spec_helper' diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_host/ruby_spec.rb b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_host/ruby_spec.rb new file mode 100644 index 0000000..4124918 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_host/ruby_spec.rb @@ -0,0 +1,21 @@ +require 'puppet' +require 'spec_helper' +require 'puppet/provider/plugin_zabbix_host/ruby' + +cls = Puppet::Type.type(:plugin_zabbix_host).provider(:ruby) +fake_api = {"username" => "username", + "password" => "password", + "endpoint" => "http://endpoint"} +resource = Puppet::Type.type(:plugin_zabbix_host).new(:name => 'test', :host => 'test', :groups => ['test'], :ip => '192.168.0.1', :api => fake_api) +provider = resource.provider + +describe cls do + + it 'should fail to create a zabbix host if any of provided groups do not exist' do + provider.expects(:get_hostgroup).returns([]) + expect { + provider.create + }.to raise_error(Puppet::Error, /Group.+?does not exist/) + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_spec.rb b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_spec.rb new file mode 100644 index 0000000..b04bed1 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_spec.rb @@ -0,0 +1,39 @@ +require 'puppet' +require 'spec_helper' +require 'puppet/provider/plugin_zabbix' + +cls = Puppet::Provider::Plugin_zabbix + +describe Puppet::Provider::Plugin_zabbix do + + describe 'when making an API request' do + + it 'should fail if Zabbix returns error' do + mock = {'error' => {'code' => 0, + 'message' => 'test error', + 'data' => 'not a real error'}} + Puppet::Provider::Plugin_zabbix.expects(:make_request).returns(mock) + fake_api = {'endpoint' => 'http://localhost', + 'username' => 'Admin', + 'password' => 'zabbix'} + expect { + cls.api_request(fake_api, {}) + }.to raise_error(Puppet::Error, /Zabbix API returned/) + end + + it 'should return "result" sub-hash from json returned by API' do + mock = {'result' => {'code' => 0, + 'message' => 'test result', + 'data' => 'just a test'}} + Puppet::Provider::Plugin_zabbix.expects(:make_request).returns(mock) + fake_api = {'endpoint' => 'http://localhost', + 'username' => 'Admin', + 'password' => 'zabbix'} + cls.api_request(fake_api, {}) == {'code' => 0, + 'message' => 'test result', + 'data' => 'just a test'} + end + + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_template_link/ruby_spec.rb b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_template_link/ruby_spec.rb new file mode 100644 index 0000000..736577b --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_template_link/ruby_spec.rb @@ -0,0 +1,33 @@ +require 'puppet' +require 'spec_helper' +require 'puppet/provider/plugin_zabbix_template_link/ruby' + +cls = Puppet::Type.type(:plugin_zabbix_template_link).provider(:ruby) +fake_api = {"username" => "username", + "password" => "password", + "endpoint" => "http://endpoint"} +resource = Puppet::Type.type(:plugin_zabbix_template_link).new(:name => 'test link', :host => 'test', :template => 'test', :api => fake_api) +provider = resource.provider + +describe cls do + + it 'should fail if provided host does not exist' do + provider.expects(:auth).with(fake_api).returns("auth_hash") + provider.expects(:get_host).returns([]) + expect { + provider.exists? + }.to raise_error(Puppet::Error, /Host.+?does not exist/) + end + + it 'should fail if provided template does not exist' do + provider.expects(:auth).with(fake_api).returns("auth_hash") + provider.expects(:get_host).returns(['0']) + provider.expects(:api_request).with(fake_api, + {:method => "template.get", + :params => {:filter => {:host => [resource[:template]]}}}).returns([]) + expect { + provider.exists? + }.to raise_error(Puppet::Error, /Template.+?does not exist/) + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_usermacro/ruby_spec.rb b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_usermacro/ruby_spec.rb new file mode 100644 index 0000000..6b9a105 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/provider/plugin_zabbix_usermacro/ruby_spec.rb @@ -0,0 +1,33 @@ +require 'puppet' +require 'spec_helper' +require 'puppet/provider/plugin_zabbix_usermacro/ruby' + +cls = Puppet::Type.type(:plugin_zabbix_usermacro).provider(:ruby) +fake_api = {"username" => "username", + "password" => "password", + "endpoint" => "http://endpoint"} +resource = Puppet::Type.type(:plugin_zabbix_usermacro).new(:name => 'test', :host => 'test', :macro => 'test', :value => 'test', :api => fake_api) +provider = resource.provider + +describe cls do + + it 'should fail if it is not global and provided host does not exist' do + resource[:global] = :false + provider.expects(:auth).with(fake_api).returns("auth_hash") + provider.expects(:get_host).returns([]) + expect { + provider.exists? + }.to raise_error(Puppet::Error, /Host.+?does not exist/) + end + + it 'should get a list of global macros when global is true' do + resource[:global] = :true + body = {:method => "usermacro.get", + :params => {:globalmacro => true, + :output => "extend"}} + provider.expects(:auth).with(fake_api).returns("auth_hash") + provider.expects(:api_request).with(fake_api, body).returns([{"macro" => "macro"}]) + provider.exists? + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_configuration_import_spec.rb b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_configuration_import_spec.rb new file mode 100644 index 0000000..0d14b82 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_configuration_import_spec.rb @@ -0,0 +1,78 @@ +require 'puppet' +require 'puppet/type/plugin_zabbix_configuration_import' + + +describe 'Puppet::Type.type(:plugin_zabbix_configuration_import)' do + + before :each do + @type_instance = Puppet::Type.type(:plugin_zabbix_configuration_import).new(:name => 'testimport') + end + + # type validation checks for path rather than file contents + it 'should accept absolute pathname for xml_file' do + @type_instance[:xml_file] = '/here/be/dragon' + @type_instance[:xml_file] == '/here/be/dragon' + end + + it 'should not accept non-absolute path for xml_file' do + expect { + @type_instance[:xml_file] = 'here/be/dragon' + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept valid api hash' do + @type_instance[:api] = {"username" => "user", + "password" => "password", + "endpoint" => "http://endpoint"} + end + + it 'should not accept non-hash objects for api hash' do + expect { + @type_instance[:api] = "qwerty" + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept api hash without any of required keys' do + expect { + @type_instance[:api] = {"password" => "password", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept api hash with invalid keys' do + expect { + @type_instance[:api] = {"username" => [], + "password" => "password", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => [], + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password", + "endpoint" => "endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password", + "endpoint" => []} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_host_spec.rb b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_host_spec.rb new file mode 100644 index 0000000..63161ff --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_host_spec.rb @@ -0,0 +1,167 @@ +require 'puppet' +require 'puppet/type/plugin_zabbix_host' + + +describe 'Puppet::Type.type(:plugin_zabbix_host)' do + + before :each do + @zabbix_host = Puppet::Type.type(:plugin_zabbix_host).new(:name => 'testhost', :host => 'testhost', :groups => ['testgroup']) + end + + it 'should accept valid IP address' do + @zabbix_host[:ip] = '192.168.10.1' + @zabbix_host[:ip] == '192.168.10.1' + end + + it 'should not accept IP address with more than 3 digits per octet' do + expect { + @zabbix_host[:ip] = '1921.168.10.1' + }.to raise_error(Puppet::Error, /Invalid value/) + end + + it 'should not accept random strings for IP address' do + expect { + @zabbix_host[:ip] = 'hello' + }.to raise_error(Puppet::Error, /Invalid value/) + end + + it 'should accept valid namevar' do + @zabbix_host[:host] = 'host name' + @zabbix_host[:ip] == 'host name' + end + + it 'should not accept empty namevar' do + expect { + @zabbix_host[:host] = '' + }.to raise_error(Puppet::Error, /Invalid value/) + end + + it 'should accept valid group list' do + @zabbix_host[:groups] = ['ManagedByPuppet', 'OpenStack9000'] + end + + it 'should accept string for group list' do + @zabbix_host[:groups] = 'ManagedByPuppet' + end + + it 'should not accept non-array non-string object for groups list' do + expect { + @zabbix_host[:groups] = 123 + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept empty array for groups' do + expect { + @zabbix_host[:groups] = [] + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept array with non-string items for groups' do + expect { + @zabbix_host[:groups] = ['hello', 123, nil] + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept array with empty strings for groups' do + expect { + @zabbix_host[:groups] = ['hello', ""] + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept valid hostname' do + @zabbix_host[:hostname] = 'node-1' + @zabbix_host[:hostname] == 'node-1' + end + + it 'should not accept non-string hostname' do + expect { + @zabbix_host[:hostname] = [] + }.to raise_error(Puppet::Error, /Invalid value/) + end + + it 'should accept valid proxy_id' do + @zabbix_host[:proxy_hostid] = '1' + @zabbix_host[:proxy_hostid] == '1' + @zabbix_host[:proxy_hostid] = 1 + @zabbix_host[:proxy_hostid] == 1 + end + + it 'should not accept invalid proxyid' do + expect { + @zabbix_host[:proxy_hostid] = [] + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @zabbix_host[:proxy_hostid] = "qwerty" + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept valid status' do + @zabbix_host[:status] = 1 + @zabbix_host[:status] == 1 + @zabbix_host[:status] = 0 + @zabbix_host[:status] == 0 + end + + it 'should not accept invalid proxyid' do + expect { + @zabbix_host[:status] = "qwerty" + }.to raise_error(Puppet::Error, /Invalid value/) + end + + it 'should accept valid api hash' do + @zabbix_host[:api] = {"username" => "user", + "password" => "password", + "endpoint" => "http://endpoint"} + end + + it 'should not accept non-hash objects for api hash' do + expect { + @zabbix_host[:api] = "qwerty" + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept api hash without any of required keys' do + expect { + @zabbix_host[:api] = {"password" => "password", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @zabbix_host[:api] = {"username" => "username", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @zabbix_host[:api] = {"username" => "username", + "password" => "password"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept api hash with invalid keys' do + expect { + @zabbix_host[:api] = {"username" => [], + "password" => "password", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @zabbix_host[:api] = {"username" => "username", + "password" => [], + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @zabbix_host[:api] = {"username" => "username", + "password" => "password", + "endpoint" => "endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @zabbix_host[:api] = {"username" => "username", + "password" => "password", + "endpoint" => []} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_hostgroup_spec.rb b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_hostgroup_spec.rb new file mode 100644 index 0000000..a87eb97 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_hostgroup_spec.rb @@ -0,0 +1,77 @@ +require 'puppet' +require 'puppet/type/plugin_zabbix_hostgroup' + + +describe 'Puppet::Type.type(:plugin_zabbix_hostgroup)' do + + before :each do + @type_instance = Puppet::Type.type(:plugin_zabbix_hostgroup).new(:name => 'testimport') + end + + it 'should accept non-empty name' do + @type_instance[:name] = 'ManagedByPuppet' + @type_instance[:name] == 'ManagedByPuppet' + end + + it 'should not accept empty name' do + expect { + @type_instance[:name] = '' + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept valid api hash' do + @type_instance[:api] = {"username" => "user", + "password" => "password", + "endpoint" => "http://endpoint"} + end + + it 'should not accept non-hash objects for api hash' do + expect { + @type_instance[:api] = "qwerty" + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept api hash without any of required keys' do + expect { + @type_instance[:api] = {"password" => "password", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept api hash with invalid keys' do + expect { + @type_instance[:api] = {"username" => [], + "password" => "password", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => [], + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password", + "endpoint" => "endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password", + "endpoint" => []} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_template_link_spec.rb b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_template_link_spec.rb new file mode 100644 index 0000000..f05b73a --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_template_link_spec.rb @@ -0,0 +1,99 @@ +require 'puppet' +require 'puppet/type/plugin_zabbix_template_link' + + +describe 'Puppet::Type.type(:plugin_zabbix_template_link)' do + + before :each do + @type_instance = Puppet::Type.type(:plugin_zabbix_template_link).new(:name => 'testimport') + end + + it 'should accept non-empty name' do + @type_instance[:name] = 'New link' + @type_instance[:name] == 'New link' + end + + it 'should not accept empty name' do + expect { + @type_instance[:name] = '' + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept non-empty host' do + @type_instance[:host] = 'node-1' + @type_instance[:host] == 'node-1' + end + + it 'should not accept empty host' do + expect { + @type_instance[:host] = '' + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept non-empty template name' do + @type_instance[:template] = 'template' + @type_instance[:template] == 'template' + end + + it 'should not accept empty template name' do + expect { + @type_instance[:template] = '' + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept valid api hash' do + @type_instance[:api] = {"username" => "user", + "password" => "password", + "endpoint" => "http://endpoint"} + end + + it 'should not accept non-hash objects for api hash' do + expect { + @type_instance[:api] = "qwerty" + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept api hash without any of required keys' do + expect { + @type_instance[:api] = {"password" => "password", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept api hash with invalid keys' do + expect { + @type_instance[:api] = {"username" => [], + "password" => "password", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => [], + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password", + "endpoint" => "endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password", + "endpoint" => []} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_usermacro_spec.rb b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_usermacro_spec.rb new file mode 100644 index 0000000..7663c6d --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/spec/unit/type/plugin_zabbix_usermacro_spec.rb @@ -0,0 +1,122 @@ +require 'puppet' +require 'puppet/type/plugin_zabbix_usermacro' + + +describe 'Puppet::Type.type(:plugin_zabbix_usermacro)' do + + before :each do + @type_instance = Puppet::Type.type(:plugin_zabbix_usermacro).new(:name => 'testimport', :host => "host") + end + + it 'should fail with global = true and specified host' do + expect { + Puppet::Type.type(:plugin_zabbix_usermacro).new(:name => "new", :global => :true, :host => "host") + }.to raise_error(Puppet::Error, /should not be provided/) + end + + it 'should fail with global = false and unspecified host' do + expect { + Puppet::Type.type(:plugin_zabbix_usermacro).new(:name => "new") + }.to raise_error(Puppet::Error, /host is required/) + end + + it 'should accept non-empty name' do + @type_instance[:name] = 'New macro' + @type_instance[:name] == 'New macro' + end + + it 'should not accept empty name' do + expect { + @type_instance[:name] = '' + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept non-empty host' do + @type_instance[:host] = 'node-1' + @type_instance[:host] == 'node-1' + end + + it 'should not accept empty host' do + expect { + @type_instance[:host] = '' + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept non-empty macro name' do + @type_instance[:macro] = 'macro' + @type_instance[:macro] == 'macro' + end + + it 'should not accept empty macro name' do + expect { + @type_instance[:macro] = '' + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept non-empty macro value' do + @type_instance[:value] = 'value' + @type_instance[:value] == 'value' + end + + it 'should not accept empty macro value' do + expect { + @type_instance[:value] = '' + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should accept valid api hash' do + @type_instance[:api] = {"username" => "user", + "password" => "password", + "endpoint" => "http://endpoint"} + end + + it 'should not accept non-hash objects for api hash' do + expect { + @type_instance[:api] = "qwerty" + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept api hash without any of required keys' do + expect { + @type_instance[:api] = {"password" => "password", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + + it 'should not accept api hash with invalid keys' do + expect { + @type_instance[:api] = {"username" => [], + "password" => "password", + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => [], + "endpoint" => "http://endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password", + "endpoint" => "endpoint"} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + + expect { + @type_instance[:api] = {"username" => "username", + "password" => "password", + "endpoint" => []} + }.to raise_error(Puppet::Error, /Parameter.+failed/) + end + +end diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/templates/check_api.conf.erb b/deployment_scripts/puppet/modules/plugin_zabbix/templates/check_api.conf.erb new file mode 100644 index 0000000..fb7d707 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/templates/check_api.conf.erb @@ -0,0 +1,18 @@ +[api] +log_level=CRITICAL +user=<%= scope.lookupvar('plugin_zabbix::params::openstack::access_user') %> +password=<%= scope.lookupvar('plugin_zabbix::params::openstack::access_password') %> +tenant=<%= scope.lookupvar('plugin_zabbix::params::openstack::access_tenant') %> +keystone_endpoints=http://<%= scope.lookupvar('plugin_zabbix::params::openstack::keystone_vip') %>:5000/v2.0 +nova_os_map=v2/%(tenant_id)s/flavors +glance_map=v1/images +keystone_service_map=v2.0/tenants +keystone_map=v2.0/tenants +cinder_map=v1/%(tenant_id)s/volumes +neutron_map= +nova_os_timeout=5 +glance_timeout=5 +keystone_service_timeout=5 +keystone_timeout=5 +cinder_timeout=5 +neutron_timeout=5 diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/templates/check_db.conf.erb b/deployment_scripts/puppet/modules/plugin_zabbix/templates/check_db.conf.erb new file mode 100644 index 0000000..04de0cd --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/templates/check_db.conf.erb @@ -0,0 +1,37 @@ +[query_db] +log_level=CRITICAL +#Count tokens in keystone db +token_count_connection=mysql://keystone:<%= scope.lookupvar('plugin_zabbix::params::openstack::keystone_db_password') %>@<%= scope.lookupvar('plugin_zabbix::params::openstack::db_vip') %>/keystone +token_count_query=select count(*) from token + +#Count instances in error state +instance_error_connection=mysql://nova:<%= scope.lookupvar('plugin_zabbix::params::openstack::nova_db_password') %>@<%= scope.lookupvar('plugin_zabbix::params::openstack::db_vip') %>/nova +instance_error_query=select count(*) from instances where vm_state='error' and deleted=0 + +#Count offline services - nova +services_offline_nova_connection=mysql://nova:<%= scope.lookupvar('plugin_zabbix::params::openstack::nova_db_password') %>@<%= scope.lookupvar('plugin_zabbix::params::openstack::db_vip') %>/nova +services_offline_nova_query=select count(*) from services where disabled=0 and deleted=0 and timestampdiff(SECOND,updated_at,utc_timestamp())>60 + +#Count running instances +instance_count_connection=mysql://nova:<%= scope.lookupvar('plugin_zabbix::params::openstack::nova_db_password') %>@<%= scope.lookupvar('plugin_zabbix::params::openstack::db_vip') %>/nova +instance_count_query=select count(*) from instances where deleted=0 and vm_state='active' + +#Sum all vcpus in cluster +cpu_total_connection=mysql://nova:<%= scope.lookupvar('plugin_zabbix::params::openstack::nova_db_password') %>@<%= scope.lookupvar('plugin_zabbix::params::openstack::db_vip') %>/nova +cpu_total_query=select ifnull(sum(vcpus), 0) from compute_nodes where deleted=0 + +#Sum used vcpus in cluster +cpu_used_connection=mysql://nova:<%= scope.lookupvar('plugin_zabbix::params::openstack::nova_db_password') %>@<%= scope.lookupvar('plugin_zabbix::params::openstack::db_vip') %>/nova +cpu_used_query=select ifnull(sum(vcpus), 0) from instances where deleted=0 and vm_state='active' + +#Sum all memory in cluster +ram_total_connection=mysql://nova:<%= scope.lookupvar('plugin_zabbix::params::openstack::nova_db_password') %>@<%= scope.lookupvar('plugin_zabbix::params::openstack::db_vip') %>/nova +ram_total_query=select ifnull(sum(memory_mb), 0) from compute_nodes where deleted=0 + +#Sum used memory in cluster +ram_used_connection=mysql://nova:<%= scope.lookupvar('plugin_zabbix::params::openstack::nova_db_password') %>@<%= scope.lookupvar('plugin_zabbix::params::openstack::db_vip') %>/nova +ram_used_query=select ifnull(sum(memory_mb), 0) from instances where deleted=0 and vm_state='active' + +#Count offline services - cinder +services_offline_cinder_connection=mysql://cinder:<%= scope.lookupvar('plugin_zabbix::params::openstack::cinder_db_password') %>@<%= scope.lookupvar('plugin_zabbix::params::openstack::db_vip') %>/cinder +services_offline_cinder_query=select count(*) from services where disabled=0 and deleted=0 and timestampdiff(SECOND,updated_at,utc_timestamp())>60 diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/templates/check_rabbit.conf.erb b/deployment_scripts/puppet/modules/plugin_zabbix/templates/check_rabbit.conf.erb new file mode 100644 index 0000000..12c0af8 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/templates/check_rabbit.conf.erb @@ -0,0 +1,7 @@ +[rabbitmq] +log_level=DEBUG +user=<%= scope.lookupvar('plugin_zabbix::params::openstack::rabbit_user') %> +password=<%= scope.lookupvar('plugin_zabbix::params::openstack::rabbit_password') %> +host=http://<%= scope.lookupvar('plugin_zabbix::params::host_ip') %>:15672 +#OpenStack queues, Y - number of service types, N - count of *this* service, max_queues=Y*(2*N+1) +max_queues=128 diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/templates/data_clean.erb b/deployment_scripts/puppet/modules/plugin_zabbix/templates/data_clean.erb new file mode 100644 index 0000000..fc6f281 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/templates/data_clean.erb @@ -0,0 +1,50 @@ +START TRANSACTION; +INSERT INTO `groups` (`groupid`, `name`, `internal`) VALUES (1,'Templates',0); +INSERT INTO `groups` (`groupid`, `name`, `internal`) VALUES (2,'Linux servers',0); +INSERT INTO `groups` (`groupid`, `name`, `internal`) VALUES (5,'Discovered hosts',1); +INSERT INTO `drules` (`druleid`, `proxy_hostid`, `name`, `iprange`, `delay`, `nextcheck`, `status`) VALUES (2,NULL,'Local network','192.168.1.1-255',3600,0,1); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (1,'Service state'); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (2,'Host status'); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (3,'Windows service state'); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (4,'APC Battery Replacement Status'); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (5,'APC Battery Status'); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (6,'HP Insight System Status'); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (7,'Dell Open Manage System Status'); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (8,'SNMP interface status (ifOperStatus)'); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (9,'SNMP device status (hrDeviceStatus)'); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (10,'Zabbix agent ping status'); +INSERT INTO `valuemaps` (`valuemapid`, `name`) VALUES (11,'SNMP interface status (ifAdminStatus)'); +INSERT INTO `media_type` (`mediatypeid`, `type`, `description`, `smtp_server`, `smtp_helo`, `smtp_email`, `exec_path`, `gsm_modem`, `username`, `passwd`, `status`) VALUES (1,0,'Email','mail.company.com','company.com','zabbix@company.com','','','','',0); +INSERT INTO `media_type` (`mediatypeid`, `type`, `description`, `smtp_server`, `smtp_helo`, `smtp_email`, `exec_path`, `gsm_modem`, `username`, `passwd`, `status`) VALUES (2,3,'Jabber','','','','','','jabber@company.com','zabbix',0); +INSERT INTO `media_type` (`mediatypeid`, `type`, `description`, `smtp_server`, `smtp_helo`, `smtp_email`, `exec_path`, `gsm_modem`, `username`, `passwd`, `status`) VALUES (3,2,'SMS','','','','','/dev/ttyS0','','',0); +INSERT INTO `users` (`userid`, `alias`, `name`, `surname`, `passwd`, `url`, `autologin`, `autologout`, `lang`, `refresh`, `type`, `theme`, `attempt_failed`, `attempt_ip`, `attempt_clock`, `rows_per_page`) VALUES (1,'<%= scope.lookupvar('plugin_zabbix::params::zabbix_admin_username') %>','User','Administrator','<%= scope.lookupvar('plugin_zabbix::params::zabbix_admin_password_md5') %>','',1,0,'en_GB',30,3,'default',0,'',0,50); +INSERT INTO `users` (`userid`, `alias`, `name`, `surname`, `passwd`, `url`, `autologin`, `autologout`, `lang`, `refresh`, `type`, `theme`, `attempt_failed`, `attempt_ip`, `attempt_clock`, `rows_per_page`) VALUES (2,'guest','Default','User','d41d8cd98f00b204e9800998ecf8427e','',0,900,'en_GB',30,1,'default',0,'',0,50); +INSERT INTO `usrgrp` (`usrgrpid`, `name`, `gui_access`, `users_status`, `debug_mode`) VALUES (7,'Zabbix administrators',0,0,0); +INSERT INTO `usrgrp` (`usrgrpid`, `name`, `gui_access`, `users_status`, `debug_mode`) VALUES (8,'Guests',0,0,0); +INSERT INTO `usrgrp` (`usrgrpid`, `name`, `gui_access`, `users_status`, `debug_mode`) VALUES (9,'Disabled',0,1,0); +INSERT INTO `usrgrp` (`usrgrpid`, `name`, `gui_access`, `users_status`, `debug_mode`) VALUES (11,'Enabled debug mode',0,0,1); +INSERT INTO `usrgrp` (`usrgrpid`, `name`, `gui_access`, `users_status`, `debug_mode`) VALUES (12,'No access to the frontend',2,0,0); +INSERT INTO `scripts` (`scriptid`, `name`, `command`, `host_access`, `usrgrpid`, `groupid`, `description`, `confirmation`, `type`, `execute_on`) VALUES (1,'Ping','/bin/ping -c 3 {HOST.CONN} 2>&1',2,NULL,NULL,'','',0,1); +INSERT INTO `scripts` (`scriptid`, `name`, `command`, `host_access`, `usrgrpid`, `groupid`, `description`, `confirmation`, `type`, `execute_on`) VALUES (2,'Traceroute','/bin/traceroute {HOST.CONN} 2>&1',2,NULL,NULL,'','',0,1); +INSERT INTO `actions` (`actionid`, `name`, `eventsource`, `evaltype`, `status`, `esc_period`, `def_shortdata`, `def_longdata`, `recovery_msg`, `r_shortdata`, `r_longdata`) VALUES (2,'Auto discovery. Linux servers.',1,0,1,0,'','',0,'',''); +INSERT INTO `actions` (`actionid`, `name`, `eventsource`, `evaltype`, `status`, `esc_period`, `def_shortdata`, `def_longdata`, `recovery_msg`, `r_shortdata`, `r_longdata`) VALUES (3,'Report problems to Zabbix administrators',0,0,1,3600,'{TRIGGER.STATUS}: {TRIGGER.NAME}','Trigger: {TRIGGER.NAME}\r\nTrigger status: {TRIGGER.STATUS}\r\nTrigger severity: {TRIGGER.SEVERITY}\r\nTrigger URL: {TRIGGER.URL}\r\n\r\nItem values:\r\n\r\n1. {ITEM.NAME1} ({HOST.NAME1}:{ITEM.KEY1}): {ITEM.VALUE1}\r\n2. {ITEM.NAME2} ({HOST.NAME2}:{ITEM.KEY2}): {ITEM.VALUE2}\r\n3. {ITEM.NAME3} ({HOST.NAME3}:{ITEM.KEY3}): {ITEM.VALUE3}',1,'{TRIGGER.STATUS}: {TRIGGER.NAME}','Trigger: {TRIGGER.NAME}\r\nTrigger status: {TRIGGER.STATUS}\r\nTrigger severity: {TRIGGER.SEVERITY}\r\nTrigger URL: {TRIGGER.URL}\r\n\r\nItem values:\r\n\r\n1. {ITEM.NAME1} ({HOST.NAME1}:{ITEM.KEY1}): {ITEM.VALUE1}\r\n2. {ITEM.NAME2} ({HOST.NAME2}:{ITEM.KEY2}): {ITEM.VALUE2}\r\n3. {ITEM.NAME3} ({HOST.NAME3}:{ITEM.KEY3}): {ITEM.VALUE3}'); +INSERT INTO `operations` (`operationid`, `actionid`, `operationtype`, `esc_period`, `esc_step_from`, `esc_step_to`, `evaltype`) VALUES (2,2,4,0,1,1,0); +INSERT INTO `operations` (`operationid`, `actionid`, `operationtype`, `esc_period`, `esc_step_from`, `esc_step_to`, `evaltype`) VALUES (3,3,0,0,1,1,0); +INSERT INTO `opmessage` (`operationid`, `default_msg`, `subject`, `message`, `mediatypeid`) VALUES (3,1,'{TRIGGER.STATUS}: {TRIGGER.NAME}','Trigger: {TRIGGER.NAME}\r\nTrigger status: {TRIGGER.STATUS}\r\nTrigger severity: {TRIGGER.SEVERITY}\r\nTrigger URL: {TRIGGER.URL}\r\n\r\nItem values:\r\n\r\n1. {ITEM.NAME1} ({HOST.NAME1}:{ITEM.KEY1}): {ITEM.VALUE1}\r\n2. {ITEM.NAME2} ({HOST.NAME2}:{ITEM.KEY2}): {ITEM.VALUE2}\r\n3. {ITEM.NAME3} ({HOST.NAME3}:{ITEM.KEY3}): {ITEM.VALUE3}',NULL); +INSERT INTO `opgroup` (`opgroupid`, `operationid`, `groupid`) VALUES (1,2,2); +INSERT INTO `conditions` (`conditionid`, `actionid`, `conditiontype`, `operator`, `value`) VALUES (2,2,10,0,'0'); +INSERT INTO `conditions` (`conditionid`, `actionid`, `conditiontype`, `operator`, `value`) VALUES (3,2,8,0,'9'); +INSERT INTO `conditions` (`conditionid`, `actionid`, `conditiontype`, `operator`, `value`) VALUES (4,2,12,2,'Linux'); +INSERT INTO `conditions` (`conditionid`, `actionid`, `conditiontype`, `operator`, `value`) VALUES (5,3,16,7,''); +INSERT INTO `conditions` (`conditionid`, `actionid`, `conditiontype`, `operator`, `value`) VALUES (6,3,5,0,'1'); +INSERT INTO `config` (`configid`,`refresh_unsupported`,`work_period`,`alert_usrgrpid`,`discovery_groupid`) values ('1','600','1-5,09:00-18:00;','7','5'); +INSERT INTO `graph_theme` (`graphthemeid`, `description`, `theme`, `backgroundcolor`, `graphcolor`, `graphbordercolor`, `gridcolor`, `maingridcolor`, `gridbordercolor`, `textcolor`, `highlightcolor`, `leftpercentilecolor`, `rightpercentilecolor`, `nonworktimecolor`, `gridview`, `legendview`) VALUES (1,'Original Blue','originalblue','F0F0F0','FFFFFF','333333','CCCCCC','AAAAAA','000000','222222','AA4444','11CC11','CC1111','E0E0E0',1,1); +INSERT INTO `graph_theme` (`graphthemeid`, `description`, `theme`, `backgroundcolor`, `graphcolor`, `graphbordercolor`, `gridcolor`, `maingridcolor`, `gridbordercolor`, `textcolor`, `highlightcolor`, `leftpercentilecolor`, `rightpercentilecolor`, `nonworktimecolor`, `gridview`, `legendview`) VALUES (2,'Black & Blue','darkblue','333333','0A0A0A','888888','222222','4F4F4F','EFEFEF','0088FF','CC4444','1111FF','FF1111','1F1F1F',1,1); +INSERT INTO `graph_theme` (`graphthemeid`, `description`, `theme`, `backgroundcolor`, `graphcolor`, `graphbordercolor`, `gridcolor`, `maingridcolor`, `gridbordercolor`, `textcolor`, `highlightcolor`, `leftpercentilecolor`, `rightpercentilecolor`, `nonworktimecolor`, `gridview`, `legendview`) VALUES (3,'Dark orange','darkorange','333333','0A0A0A','888888','222222','4F4F4F','EFEFEF','DFDFDF','FF5500','FF5500','FF1111','1F1F1F',1,1); +INSERT INTO `graph_theme` (`graphthemeid`, `description`, `theme`, `backgroundcolor`, `graphcolor`, `graphbordercolor`, `gridcolor`, `maingridcolor`, `gridbordercolor`, `textcolor`, `highlightcolor`, `leftpercentilecolor`, `rightpercentilecolor`, `nonworktimecolor`, `gridview`, `legendview`) VALUES (4,'Classic','classic','F0F0F0','FFFFFF','333333','CCCCCC','AAAAAA','000000','222222','AA4444','11CC11','CC1111','E0E0E0',1,1); +INSERT INTO `globalmacro` (`globalmacroid`, `macro`, `value`) VALUES (2,'{$SNMP_COMMUNITY}','public'); +INSERT INTO `sysmaps` (`sysmapid`, `name`, `width`, `height`, `backgroundid`, `label_type`, `label_location`, `highlight`, `expandproblem`, `markelements`, `show_unack`, `grid_size`, `grid_show`, `grid_align`, `label_format`, `label_type_host`, `label_type_hostgroup`, `label_type_trigger`, `label_type_map`, `label_type_image`, `label_string_host`, `label_string_hostgroup`, `label_string_trigger`, `label_string_map`, `label_string_image`, `iconmapid`, `expand_macros`) VALUES (1,'Local network',680,200,NULL,0,0,1,1,1,0,50,1,1,0,2,2,2,2,2,'','','','','',NULL,1); +INSERT INTO `regexps` (`regexpid`, `name`, `test_string`) VALUES (1,'File systems for discovery','ext3'); +INSERT INTO `regexps` (`regexpid`, `name`, `test_string`) VALUES (2,'Network interfaces for discovery','eth0'); +INSERT INTO `regexps` (`regexpid`, `name`, `test_string`) VALUES (3,'Storage devices for SNMP discovery','/boot'); +COMMIT; diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/templates/my.cnf.erb b/deployment_scripts/puppet/modules/plugin_zabbix/templates/my.cnf.erb new file mode 100644 index 0000000..71cdfa4 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/templates/my.cnf.erb @@ -0,0 +1,4 @@ +[client] +user=<%= scope.lookupvar('plugin_zabbix::params::db_user') %> +host=<%= scope.lookupvar('plugin_zabbix::params::db_ip') %> +password=<%= scope.lookupvar('plugin_zabbix::params::db_password') %> diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix.conf.php.erb b/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix.conf.php.erb new file mode 100644 index 0000000..d78164f --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix.conf.php.erb @@ -0,0 +1,18 @@ +'; +$DB["SERVER"] = '<%= scope.lookupvar('plugin_zabbix::params::db_ip') %>'; +$DB["PORT"] = '<%= scope.lookupvar('plugin_zabbix::params::db_port') %>'; +$DB["DATABASE"] = '<%= scope.lookupvar('plugin_zabbix::params::db_name') %>'; +$DB["USER"] = '<%= scope.lookupvar('plugin_zabbix::params::db_user') %>'; +$DB["PASSWORD"] = '<%= scope.lookupvar('plugin_zabbix::params::db_password') %>'; +// SCHEMA is relevant only for IBM_DB2 database +$DB["SCHEMA"] = ''; + +$ZBX_SERVER = '<%= scope.lookupvar('plugin_zabbix::params::server_ip') %>'; +$ZBX_SERVER_PORT = '<%= scope.lookupvar('plugin_zabbix::params::zabbix_ports')['server'] %>'; +$ZBX_SERVER_NAME = '<%= scope.lookupvar('plugin_zabbix::params::server_name') %>'; + +$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG; diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_agent_userparam.conf.erb b/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_agent_userparam.conf.erb new file mode 100644 index 0000000..70a8fbd --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_agent_userparam.conf.erb @@ -0,0 +1 @@ +UserParameter=<%= @key_real %>,<%= @command %> diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_agentd.conf.erb b/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_agentd.conf.erb new file mode 100644 index 0000000..1367b59 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_agentd.conf.erb @@ -0,0 +1,37 @@ +### Managed by Puppet ### + +# Fake server declaration to enforce running agent without +# separate server declaration in /etc/zabbix/zabbix_agent.d/server.conf +Server=<%= scope.lookupvar('plugin_zabbix::params::server_ip') %>,<%= scope.lookupvar('plugin_zabbix::monitoring::server_ips').join(',') %> +ServerActive=<%= scope.lookupvar('plugin_zabbix::params::server_ip') %> + +Hostname=<%= @fqdn %> + +ListenPort=<%= if scope.lookupvar('plugin_zabbix::params::zabbix_ports')['backend_agent'].nil?; scope.lookupvar('plugin_zabbix::params::zabbix_ports')['agent']; else scope.lookupvar('plugin_zabbix::params::zabbix_ports')['backend_agent']; end %> + +#ListenIP=<%= scope.lookupvar('plugin_zabbix::params::agent_listen_ip') %> + +#SourceIP=<%= scope.lookupvar('plugin_zabbix::params::agent_source_ip') %> + +StartAgents=5 + +#RefreshActiveChecks=120 + +#DisableActive=1 + +#EnableRemoteCommands=1 + +DebugLevel=3 + +PidFile=<%= scope.lookupvar('plugin_zabbix::params::agent_pid_file') %> + +LogFile=<%= scope.lookupvar('plugin_zabbix::params::agent_log_file') %> + +LogFileSize=0 + +Timeout=10 + +<% if scope.lookupvar('plugin_zabbix::params::has_userparameters') %> +Include=<%= scope.lookupvar('plugin_zabbix::params::agent_include') %> +<% end %> + diff --git a/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_server.conf.erb b/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_server.conf.erb new file mode 100644 index 0000000..dfdc184 --- /dev/null +++ b/deployment_scripts/puppet/modules/plugin_zabbix/templates/zabbix_server.conf.erb @@ -0,0 +1,160 @@ +### Managed by Puppet ### +# This is config file for ZABBIX server process +# To get more information about ZABBIX, +# go http://www.zabbix.com + +############ GENERAL PARAMETERS ################# + +# This defines unique NodeID in distributed setup, +# Default value 0 (standalone server) +# This parameter must be between 0 and 999 +#NodeID=<%= scope.lookupvar('plugin_zabbix::params::server_node_id') %> + +# Number of pre-forked instances of pollers +# Default value is 5 +# This parameter must be between 0 and 255 +StartPollers=10 + +# Number of pre-forked instances of IPMI pollers +# Default value is 0 +# This parameter must be between 0 and 255 +#StartIPMIPollers=0 + +# Number of pre-forked instances of pollers for unreachable hosts +# Default value is 1 +# This parameter must be between 0 and 255 +#StartPollersUnreachable=1 + +# Number of pre-forked instances of trappers +# Default value is 5 +# This parameter must be between 0 and 255 +#StartTrappers=5 + +# Number of pre-forked instances of ICMP pingers +# Default value is 1 +# This parameter must be between 0 and 255 +#StartPingers=1 + +# Number of pre-forked instances of discoverers +# Default value is 1 +# This parameter must be between 0 and 255 +#StartDiscoverers=1 + +# Number of pre-forked instances of HTTP pollers +# Default value is 1 +# This parameter must be between 0 and 255 +#StartHTTPPollers=1 + +# Listen port for trapper. Default port number is 10051. This parameter +# must be between 1024 and 32767 + +ListenPort=<%= if scope.lookupvar('plugin_zabbix::params::zabbix_ports')['backend_server'].nil?; scope.lookupvar('plugin_zabbix::params::zabbix_ports')['server']; else scope.lookupvar('plugin_zabbix::params::zabbix_ports')['backend_server']; end %> + +# Source IP address for outgouing connections +#SourceIP= + +# Listen interface for trapper. Trapper will listen all network interfaces +# if this parameter is missing. + +#ListenIP=127.0.0.1 + +# How often ZABBIX will perform housekeeping procedure +# (in hours) +# Default value is 1 hour +# Housekeeping is removing unnecessary information from +# tables history, alert, and alarms +# This parameter must be between 1 and 24 + +#HousekeepingFrequency=1 + +# How often ZABBIX will try to send unsent alerts +# (in seconds) +# Default value is 30 seconds +SenderFrequency=30 + +# Uncomment this line to disable housekeeping procedure +#DisableHousekeeping=1 + +# Specifies debug level +# 0 - debug is not created +# 1 - critical information +# 2 - error information +# 3 - warnings (default) +# 4 - for debugging (produces lots of information) + +DebugLevel=3 + +# Specifies how long we wait for agent response (in sec) +# Must be between 1 and 30 +Timeout=5 + +#SNMP Trapper +#StartSNMPTrapper=1 +#SNMPTrapperFile=/tmp/snmptt.log + +# Specifies how many seconds trapper may spend processing new data +# Must be between 1 and 30 +#TrapperTimeout=5 + +# After how many seconds of unreachability treat a host as unavailable +#UnreachablePeriod=45 + +# How ofter check host for availability during the unreachability period +#UnavailableDelay=15 + +# How ofter check host for availability during the unavailability period +#UnavailableDelay=60 + +# Name of PID file + +PidFile=/var/run/zabbix/zabbix_server.pid + +# Name of log file +# If not set, syslog is used + +LogFile=<%= scope.lookupvar('plugin_zabbix::params::server_log_file') %> + +# Maximum size of log file in MB. Set to 0 to disable automatic log rotation. +LogFileSize=0 + +# Location for custom alert scripts +AlertScriptsPath=/home/zabbix/bin/ + +# Location of external scripts +ExternalScripts=<%= scope.lookupvar('plugin_zabbix::params::server_scripts') %> + +# Location of fping. Default is /usr/sbin/fping +# Make sure that fping binary has root permissions and SUID flag set +#FpingLocation=/usr/sbin/fping + +# Location of fping6. Default is /usr/sbin/fping6 +# Make sure that fping binary has root permissions and SUID flag set +#Fping6Location=/usr/sbin/fping6 + +# Temporary directory. Default is /tmp +#TmpDir=/tmp + +# Frequency of ICMP pings (item keys 'icmpping' and 'icmppingsec'). Defauls is 60 seconds. +#PingerFrequency=60 + +# Database host name +# Default is localhost + +DBHost=<%= scope.lookupvar('plugin_zabbix::params::db_ip') %> + +# Database name +# SQLite3 note: path to database file must be provided. DBUser and DBPassword are ignored. +DBName=<%= scope.lookupvar('plugin_zabbix::params::db_name') %> + +# Database user + +DBUser=<%= scope.lookupvar('plugin_zabbix::params::db_user') %> + +# Database password +# Comment this line if no password used + +DBPassword=<%= scope.lookupvar('plugin_zabbix::params::db_password') %> + +# Connect to MySQL using Unix socket? + +#DBSocket=/var/run/mysqld/mysqld.sock diff --git a/environment_config.yaml b/environment_config.yaml new file mode 100644 index 0000000..83a14cc --- /dev/null +++ b/environment_config.yaml @@ -0,0 +1,19 @@ +attributes: + username: + value: "admin" + label: "username" + description: "Username for Zabbix Administrator" + weight: 10 + type: "text" + password: + value: "zabbix" + label: "password" + description: "Password for Zabbix Administrator" + weight: 20 + type: "password" + db_password: + value: "fae2oom_aeR6" + label: "database password" + description: "Password for Zabbix Database" + weight: 30 + type: "password" diff --git a/metadata.yaml b/metadata.yaml new file mode 100644 index 0000000..33e360c --- /dev/null +++ b/metadata.yaml @@ -0,0 +1,33 @@ +# Plugin name +name: zabbix_monitoring +title: Zabbix for Fuel +# Plugin version +version: 1.0.0 +# Description +description: Enables Zabbix Monitoring. For information how to access Zabbix UI refer to Zabbix plugin User Guide. Zabbix URL schema is http:///zabbix +# Required fuel version +fuel_version: ['6.1'] +# Groups +groups: ['monitoring'] +# Licenses +licenses: ['Apache License, Version 2.0'] +# Homepage +homepage: 'https://github.com/stackforge/fuel-plugin-external-zabbix' +# Authors +authors: ['Dmitry Klenov ', 'Piotr Misiak ', 'Szymon Banka ', 'Alexander Zatserklyany '] + +# The plugin is compatible with releases in the list +releases: + - os: ubuntu + version: 2014.2-6.1 + mode: ['ha'] + deployment_scripts_path: deployment_scripts/ + repository_path: repositories/ubuntu + - os: centos + version: 2014.2-6.1 + mode: ['ha'] + deployment_scripts_path: deployment_scripts/ + repository_path: repositories/centos + +# Version of plugin package +package_version: '2.0.0' diff --git a/pre_build_hook b/pre_build_hook new file mode 100755 index 0000000..f0000d9 --- /dev/null +++ b/pre_build_hook @@ -0,0 +1,34 @@ +#!/bin/bash +set -eux + +ROOT="$(dirname `readlink -f $0`)" +RPM_REPO="${ROOT}"/repositories/centos/ +DEB_REPO="${ROOT}"/repositories/ubuntu/ +mkdir -p $RPM_REPO +mkdir -p $DEB_REPO + +# Downloads needed RPM or DEB packages +function download { + case "$1" in + deb) REPO=$DEB_REPO;; + rpm) REPO=$RPM_REPO;; + esac + shift + + while [ $# -gt 0 ]; do + FILE=$(basename "$1") + wget -qO - $1 > "$REPO/$FILE" + shift + done +} + +download deb http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-agent_2.4.4-1+trusty_amd64.deb \ + http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-frontend-php_2.4.4-1+trusty_all.deb \ + http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-server-mysql_2.4.4-1+trusty_amd64.deb + +download rpm http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-agent-2.4.4-1.el6.x86_64.rpm \ + http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-server-2.4.4-1.el6.x86_64.rpm \ + http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-server-mysql-2.4.4-1.el6.x86_64.rpm \ + http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-web-2.4.4-1.el6.noarch.rpm \ + http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-web-mysql-2.4.4-1.el6.noarch.rpm \ + http://mirror.centos.org/centos/6/os/x86_64/Packages/iptstate-2.2.2-4.el6.x86_64.rpm diff --git a/repositories/centos/.gitkeep b/repositories/centos/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/repositories/ubuntu/.gitkeep b/repositories/ubuntu/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tasks.yaml b/tasks.yaml new file mode 100644 index 0000000..739782e --- /dev/null +++ b/tasks.yaml @@ -0,0 +1,28 @@ +- role: ['primary-controller'] + stage: post_deployment/8100 + type: puppet + parameters: + puppet_manifest: puppet/manifests/primary_controller.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 1200 +- role: ['controller'] + stage: post_deployment/8101 + type: puppet + parameters: + puppet_manifest: puppet/manifests/controller.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 1200 +- role: ['primary-controller'] + stage: post_deployment/8102 + type: puppet + parameters: + puppet_manifest: puppet/manifests/zabbix_server_config.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 600 +- role: '*' + stage: post_deployment/8103 + type: puppet + parameters: + puppet_manifest: puppet/manifests/agent.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 600