├── MANIFEST.in ├── src ├── .gitignore └── txsshclient-1.0.0 │ ├── sshclient │ ├── test │ │ ├── __init__.py │ │ ├── keys │ │ │ ├── id_test_rsa.pub │ │ │ ├── id_test_rsa_insecure.pub │ │ │ ├── server_key_no_passphrase.pub │ │ │ ├── id_test_rsa_insecure │ │ │ ├── server_key_no_passphrase │ │ │ ├── id_test_rsa │ │ │ ├── server_key │ │ │ └── notes │ │ └── test_timeouts.py │ ├── connection │ │ └── __init__.py │ └── transport │ │ └── __init__.py │ ├── MANIFEST.in │ ├── .gitignore │ ├── Makefile │ ├── COPYRIGHT.txt │ ├── tools │ └── client.py │ ├── README │ └── setup.py ├── ZenPacks ├── zenoss │ ├── OpenStackInfrastructure │ │ ├── lib │ │ │ ├── __init__.py │ │ │ ├── sshclient │ │ │ │ └── .gitignore │ │ │ ├── .gitignore │ │ │ └── progresslog.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ ├── test_apiclients.py │ │ │ └── data │ │ │ │ └── model │ │ │ │ └── pickle_to_json.py │ │ ├── .gitignore │ │ ├── datasources │ │ │ ├── __init__.py │ │ │ ├── QueueSizeDataSource.py │ │ │ ├── EventsAMQPDataSource.py │ │ │ └── PerfAMQPDataSource.py │ │ ├── migrate │ │ │ ├── __init__.py │ │ │ ├── RemoveOldZProps.py │ │ │ ├── RemoveOldProducts.py │ │ │ ├── DefaultZProps.py │ │ │ ├── RebuildTenantRelations.py │ │ │ ├── RebuildInstanceRelations.py │ │ │ └── RebuildRouterPortRelations.py │ │ ├── services │ │ │ ├── __init__.py │ │ │ └── OpenStackConfig.py │ │ ├── bin │ │ │ ├── .gitignore │ │ │ └── openstack_amqp_config │ │ ├── resources │ │ │ ├── icon │ │ │ │ ├── Cell.png │ │ │ │ ├── Host.png │ │ │ │ ├── Port.png │ │ │ │ ├── Vnic.png │ │ │ │ ├── Region.png │ │ │ │ ├── Router.png │ │ │ │ ├── Subnet.png │ │ │ │ ├── Tenant.png │ │ │ │ ├── Volume.png │ │ │ │ ├── CinderApi.png │ │ │ │ ├── Endpoint.png │ │ │ │ ├── Instance.png │ │ │ │ ├── Network.png │ │ │ │ ├── NovaApi.png │ │ │ │ ├── ApiEndpoint.png │ │ │ │ ├── Hypervisor.png │ │ │ │ ├── NovaService.png │ │ │ │ ├── VolSnapshot.png │ │ │ │ ├── CinderService.png │ │ │ │ ├── NeutronAgent.png │ │ │ │ ├── AvailabilityZone.png │ │ │ │ └── SoftwareComponent.png │ │ │ └── Endpoint.js │ │ ├── analytics │ │ │ └── analytics-bundle.zip │ │ ├── meta.zcml │ │ ├── apiclients │ │ │ ├── __init__.py │ │ │ ├── exceptions.py │ │ │ ├── utils.py │ │ │ └── base.py │ │ ├── modeler │ │ │ ├── __init__.py │ │ │ └── plugins │ │ │ │ ├── __init__.py │ │ │ │ └── zenoss │ │ │ │ ├── __init__.py │ │ │ │ └── cmd │ │ │ │ ├── __init__.py │ │ │ │ └── linux │ │ │ │ ├── __init__.py │ │ │ │ └── openstack │ │ │ │ ├── __init__.py │ │ │ │ └── hostfqdn.py │ │ ├── parsers │ │ │ ├── __init__.py │ │ │ └── endpoint.py │ │ ├── Volume.py │ │ ├── daemons │ │ │ └── zenopenstack │ │ ├── Port.py │ │ ├── Vnic.py │ │ ├── patches │ │ │ └── __init__.py │ │ ├── ssh.py │ │ ├── ApiEndpoint.py │ │ ├── dynamicview.py │ │ ├── protocols │ │ │ └── openstack_amqp.qjs │ │ ├── service_definition │ │ │ ├── -CONFIGS- │ │ │ │ └── opt │ │ │ │ │ └── zenoss │ │ │ │ │ ├── etc │ │ │ │ │ └── proxy-zenopenstack.conf │ │ │ │ │ └── bin │ │ │ │ │ └── proxy-zenopenstack │ │ │ └── proxy-zenopenstack.json │ │ ├── reportable.zcml │ │ ├── deviceloaders.py │ │ ├── SoftwareComponent.py │ │ ├── dsplugins.py │ │ ├── Hypervisor.py │ │ ├── service_migration.py │ │ ├── objects │ │ │ └── objects.xml │ │ ├── callhome.py │ │ ├── libexec │ │ │ └── openstack_helper.py │ │ ├── reportable.py │ │ ├── manhole.py │ │ ├── cinder_integration.py │ │ └── neutron_integration.py │ └── __init__.py └── __init__.py ├── .clocignore ├── impact.png ├── README.markdown ├── docs ├── images │ ├── flavors.png │ ├── hosts.png │ ├── images.png │ ├── impact.png │ ├── ports.png │ ├── regions.png │ ├── routers.png │ ├── subnets.png │ ├── tenants.png │ ├── vnics.png │ ├── volumes.png │ ├── instances.png │ ├── networks.png │ ├── novaapis.png │ ├── overview.png │ ├── devicegraphs.png │ ├── floatingips.png │ ├── hypervisors.png │ ├── impact_ports.png │ ├── novaservices.png │ ├── volsnapshots.png │ ├── cinderservices.png │ ├── impact_region.png │ ├── impact_tenant.png │ ├── ip_assignment.png │ ├── neutronagents.png │ ├── availabilityzones.png │ ├── ceilometer_arch.png │ ├── ceilometer_urls.png │ ├── impact_instance.png │ ├── openstackVictoria.PNG │ └── openstackcomponentview.png ├── kb │ ├── overview1.png │ ├── overview2.png │ ├── header.md │ ├── Makefile │ └── template.html ├── template.html ├── Makefile ├── releases.md ├── header.md └── ceilometer.md ├── analytics ├── resources │ ├── public │ │ ├── .folder.xml │ │ └── OpenStackInfrastructure_ZenPack │ │ │ ├── .folder.xml │ │ │ ├── OpenStackInfrastructure_Domain.xml │ │ │ └── OpenStack_Instance_List.xml │ └── organizations │ │ ├── .folder.xml │ │ └── zenoss │ │ ├── .folder.xml │ │ └── Data_Sources │ │ ├── .folder.xml │ │ └── zenoss_reporting.xml └── index.xml ├── vagrant ├── README.txt ├── rdo-pike │ ├── Vagrantfile │ └── bootstrap.sh ├── rdo-mitaka │ ├── Vagrantfile │ └── bootstrap.sh ├── rdo-newton │ ├── Vagrantfile │ └── bootstrap.sh └── rdo-queens │ ├── Vagrantfile │ └── bootstrap.sh ├── .gitignore ├── COPYRIGHT.txt ├── strip_instances.py ├── loadtest └── README.txt ├── GNUmakefile ├── migrate └── DefaultZProps.py ├── impact.yuml ├── setup.py └── event_definitions ├── README.txt └── event_definitions.py /MANIFEST.in: -------------------------------------------------------------------------------- 1 | graft ZenPacks 2 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | */requirements.txt 2 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/test/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/.gitignore: -------------------------------------------------------------------------------- 1 | note.rst 2 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/datasources/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/migrate/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/services/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include sshclient/test/keys/* -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | dist/ 3 | *.egg-info/ 4 | -------------------------------------------------------------------------------- /.clocignore: -------------------------------------------------------------------------------- 1 | ZenPacks/zenoss/OpenStackInfrastructure/zenpacklib.py 2 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/bin/.gitignore: -------------------------------------------------------------------------------- 1 | easy_install* 2 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/lib/sshclient/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | -------------------------------------------------------------------------------- /ZenPacks/__init__.py: -------------------------------------------------------------------------------- 1 | __import__('pkg_resources').declare_namespace(__name__) 2 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/__init__.py: -------------------------------------------------------------------------------- 1 | __import__('pkg_resources').declare_namespace(__name__) 2 | -------------------------------------------------------------------------------- /impact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/impact.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/lib/.gitignore: -------------------------------------------------------------------------------- 1 | easy-install.pth 2 | setuptools.pth 3 | site.py 4 | -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | Documentation can be found [on the Zenoss wiki](http://wiki.zenoss.org/ZenPack:OpenStackInfrastructure). 2 | -------------------------------------------------------------------------------- /docs/images/flavors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/flavors.png -------------------------------------------------------------------------------- /docs/images/hosts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/hosts.png -------------------------------------------------------------------------------- /docs/images/images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/images.png -------------------------------------------------------------------------------- /docs/images/impact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/impact.png -------------------------------------------------------------------------------- /docs/images/ports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/ports.png -------------------------------------------------------------------------------- /docs/images/regions.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/regions.png -------------------------------------------------------------------------------- /docs/images/routers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/routers.png -------------------------------------------------------------------------------- /docs/images/subnets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/subnets.png -------------------------------------------------------------------------------- /docs/images/tenants.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/tenants.png -------------------------------------------------------------------------------- /docs/images/vnics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/vnics.png -------------------------------------------------------------------------------- /docs/images/volumes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/volumes.png -------------------------------------------------------------------------------- /docs/kb/overview1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/kb/overview1.png -------------------------------------------------------------------------------- /docs/kb/overview2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/kb/overview2.png -------------------------------------------------------------------------------- /docs/images/instances.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/instances.png -------------------------------------------------------------------------------- /docs/images/networks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/networks.png -------------------------------------------------------------------------------- /docs/images/novaapis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/novaapis.png -------------------------------------------------------------------------------- /docs/images/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/overview.png -------------------------------------------------------------------------------- /docs/images/devicegraphs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/devicegraphs.png -------------------------------------------------------------------------------- /docs/images/floatingips.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/floatingips.png -------------------------------------------------------------------------------- /docs/images/hypervisors.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/hypervisors.png -------------------------------------------------------------------------------- /docs/images/impact_ports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/impact_ports.png -------------------------------------------------------------------------------- /docs/images/novaservices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/novaservices.png -------------------------------------------------------------------------------- /docs/images/volsnapshots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/volsnapshots.png -------------------------------------------------------------------------------- /docs/images/cinderservices.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/cinderservices.png -------------------------------------------------------------------------------- /docs/images/impact_region.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/impact_region.png -------------------------------------------------------------------------------- /docs/images/impact_tenant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/impact_tenant.png -------------------------------------------------------------------------------- /docs/images/ip_assignment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/ip_assignment.png -------------------------------------------------------------------------------- /docs/images/neutronagents.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/neutronagents.png -------------------------------------------------------------------------------- /docs/images/availabilityzones.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/availabilityzones.png -------------------------------------------------------------------------------- /docs/images/ceilometer_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/ceilometer_arch.png -------------------------------------------------------------------------------- /docs/images/ceilometer_urls.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/ceilometer_urls.png -------------------------------------------------------------------------------- /docs/images/impact_instance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/impact_instance.png -------------------------------------------------------------------------------- /docs/images/openstackVictoria.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/openstackVictoria.PNG -------------------------------------------------------------------------------- /docs/images/openstackcomponentview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/docs/images/openstackcomponentview.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Cell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Cell.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Host.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Host.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Port.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Vnic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Vnic.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Region.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Region.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Router.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Subnet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Subnet.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Tenant.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Tenant.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Volume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Volume.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/CinderApi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/CinderApi.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Endpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Endpoint.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Instance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Instance.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Network.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/NovaApi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/NovaApi.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/analytics/analytics-bundle.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/analytics/analytics-bundle.zip -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/ApiEndpoint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/ApiEndpoint.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Hypervisor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/Hypervisor.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/NovaService.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/NovaService.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/VolSnapshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/VolSnapshot.png -------------------------------------------------------------------------------- /analytics/resources/public/.folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | / 4 | public 5 | 6 | 7 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/CinderService.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/CinderService.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/NeutronAgent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/NeutronAgent.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/AvailabilityZone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/AvailabilityZone.png -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/SoftwareComponent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zenoss/ZenPacks.zenoss.OpenStackInfrastructure/HEAD/ZenPacks/zenoss/OpenStackInfrastructure/resources/icon/SoftwareComponent.png -------------------------------------------------------------------------------- /analytics/resources/organizations/.folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | / 4 | organizations 5 | 6 | 7 | -------------------------------------------------------------------------------- /analytics/resources/organizations/zenoss/.folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /organizations 4 | zenoss 5 | 6 | 7 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/bin/openstack_amqp_config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CURRENTDIR="$(dirname "$(which "$0")")" 4 | PARENTDIR=$(dirname $CURRENTDIR) 5 | 6 | # Create any required exchanges 7 | $PARENTDIR/libexec/openstack_amqp_init.py 8 | -------------------------------------------------------------------------------- /analytics/resources/organizations/zenoss/Data_Sources/.folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /organizations/zenoss 4 | Data_Sources 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/test/keys/id_test_rsa.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC3A/hrYFlJ1kL4IDcpuFDzy+1FE3c/lIY0sHO/be+znXWlyJj3Y/+m0FOPnzcsvakYYDLKXtHtmxolGS738s6ldXC3hGzicgFw48oq0VVvHRqgj9hYmzQ9jLqRSC+4NVH5pcfgSRPeQk7dv9OEGNM+M383FLqxMbZSYv+TDvl4bQ== 2 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/test/keys/id_test_rsa_insecure.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC3A/hrYFlJ1kL4IDcpuFDzy+1FE3c/lIY0sHO/be+znXWlyJj3Y/+m0FOPnzcsvakYYDLKXtHtmxolGS738s6ldXC3hGzicgFw48oq0VVvHRqgj9hYmzQ9jLqRSC+4NVH5pcfgSRPeQk7dv9OEGNM+M383FLqxMbZSYv+TDvl4bQ== 2 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/test/keys/server_key_no_passphrase.pub: -------------------------------------------------------------------------------- 1 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDwzJDCRGHSt6EUw2kTyvGUm0GYFNgcFjTLrXbQIlsoHak9ShUtXxP2cbHy2T9FBG1CBIOpTprnP9aZP0E6+JEVIT7kkwG1tFr9CarFzBVJnXEv8itX8IIbN+vgDxGfdW/8JFP3GVjahLhSeG46wvP0LbigZ/0Sl05vxYFrWWc5Rw== 2 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/meta.zcml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /analytics/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | /public/OpenStackInfrastructure_ZenPack 7 | 8 | 9 | -------------------------------------------------------------------------------- /vagrant/README.txt: -------------------------------------------------------------------------------- 1 | These are copies of vagrant machines that I have used for zenpack development. 2 | 3 | They are provided for reference and as a starting point for setting up small, 4 | minmal openstack environments for basic testing. They are not suitable for 5 | actual testing, since the packstack deployment style is not typical at this 6 | point. 7 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/Makefile: -------------------------------------------------------------------------------- 1 | default: egg 2 | 3 | egg: 4 | python setup.py bdist_egg 5 | 6 | develop: 7 | python setup.py develop 8 | 9 | test: 10 | find . -name *.pyc -print -exec rm {} \; 11 | PYTHONPATH="${PYTHONPATH}:`pwd`/sshclient" trial --temp-directory=/tmp/_trial_tmp sshclient.test 12 | 13 | clean: 14 | rm -rf build lib dist *.egg-info 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info 3 | build 4 | dist 5 | src/python-novaclient/build 6 | src/python-novaclient/dist 7 | ZenPacks.zenoss.OpenStackInfrastructure/bin/nova 8 | ZenPacks.zenoss.OpenStackInfrastructure/lib/easy-install.pth 9 | ZenPacks.zenoss.OpenStackInfrastructure/lib/*.egg 10 | ZenPacks.zenoss.OpenStackInfrastructure/lib/site.py 11 | .DS_Store 12 | .idea 13 | setup.cfg 14 | -------------------------------------------------------------------------------- /analytics/resources/public/OpenStackInfrastructure_ZenPack/.folder.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /public 4 | OpenStackInfrastructure_ZenPack 5 | 6 | OpenStack_Instance_List 7 | OpenStackInfrastructure_Domain 8 | 9 | -------------------------------------------------------------------------------- /docs/kb/header.md: -------------------------------------------------------------------------------- 1 | Applies To 2 | ---------- 3 | 4 | * Zenoss Resource Manager 5.x< 5 | * Zenoss Resource Manager 4.x< 6 | * OpenStackInfrastructure ZenPack 7 | * OpenStack Ceilometer 8 | 9 | **(Note: This document is deprecated and applies only to the OpenStackInfrastructure 2.4.2 ZenPack and prior versions.)** 10 | 11 | Summary 12 | ------- 13 | 14 | This KB concerns troubleshooting OpenStack Ceilometer integration with Zenoss. 15 | It includes the following sections: 16 | -------------------------------------------------------------------------------- /docs/kb/Makefile: -------------------------------------------------------------------------------- 1 | DISTDIR = ../../dist 2 | 3 | # Publish to https://support.zenoss.com/hc/en-us/articles/115001165446-Understanding-and-Troubleshooting-OpenStack-Ceilometer-Integration-with-Zenoss-Resource-Manager 4 | 5 | docs: 6 | [ -d $(DISTDIR) ] || mkdir $(DISTDIR) 7 | pandoc header.md --template=template.html > $(DISTDIR)/ceilometer.html 8 | pandoc ceilometer.md --template=template.html --table-of-contents >> $(DISTDIR)/ceilometer.html 9 | cp $(DISTDIR)/ceilometer.html /tmp/ceilometer.html 10 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/connection/__init__.py: -------------------------------------------------------------------------------- 1 | from twisted.conch.ssh import connection 2 | import logging 3 | log = logging.getLogger('txsshclient.connection') 4 | 5 | 6 | class Connection(connection.SSHConnection): 7 | def __init__(self, factory, deferred): 8 | self.factory = factory 9 | self.deferred = deferred 10 | connection.SSHConnection.__init__(self) 11 | 12 | def serviceStarted(self): 13 | log.debug('Connection serviceStarted') 14 | self.deferred.callback(self) 15 | -------------------------------------------------------------------------------- /docs/kb/template.html: -------------------------------------------------------------------------------- 1 | $for(include-before)$ 2 | $include-before$ 3 | $endfor$ 4 | $if(title)$ 5 |
6 |

$title$

7 | $if(subtitle)$ 8 |

$subtitle$

9 | $endif$ 10 | $for(author)$ 11 |

$author$

12 | $endfor$ 13 | $if(date)$ 14 |

$date$

15 | $endif$ 16 |
17 | $endif$ 18 | $if(toc)$ 19 |
20 | $toc$ 21 |
22 | $endif$ 23 | $body$ 24 | $for(include-after)$ 25 | $include-after$ 26 | $endfor$ 27 | -------------------------------------------------------------------------------- /docs/template.html: -------------------------------------------------------------------------------- 1 | $for(include-before)$ 2 | $include-before$ 3 | $endfor$ 4 | $if(title)$ 5 |
6 |

$title$

7 | $if(subtitle)$ 8 |

$subtitle$

9 | $endif$ 10 | $for(author)$ 11 |

$author$

12 | $endfor$ 13 | $if(date)$ 14 |

$date$

15 | $endif$ 16 |
17 | $endif$ 18 | $if(toc)$ 19 |

Contents

20 |
21 | $toc$ 22 |
23 | $endif$ 24 | $body$ 25 | $for(include-after)$ 26 | $include-after$ 27 | $endfor$ 28 | -------------------------------------------------------------------------------- /vagrant/rdo-pike/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Note: Ensure that vagrant is version 1.6.5 or newer for centos 7 support. 5 | # It is also recommended that you install the vagrant-vbguest plugin, if using 6 | # virtualbox. 7 | 8 | Vagrant.configure('2') do |config| 9 | 10 | config.vm.hostname = "rdo-pike" 11 | config.vm.box = "centos/7" 12 | 13 | config.vm.network :private_network, ip: "192.168.2.15" 14 | 15 | config.vm.provider :virtualbox do |vb| 16 | vb.customize ["modifyvm", :id, "--memory", "5120"] 17 | end 18 | 19 | config.vm.provision :shell, :path => 'bootstrap.sh' 20 | end 21 | -------------------------------------------------------------------------------- /vagrant/rdo-mitaka/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Note: Ensure that vagrant is version 1.6.5 or newer for centos 7 support. 5 | # It is also recommended that you install the vagrant-vbguest plugin, if using 6 | # virtualbox. 7 | 8 | Vagrant.configure('2') do |config| 9 | 10 | config.vm.hostname = "rdo-mitaka" 11 | config.vm.box = "centos/7" 12 | 13 | config.vm.network :private_network, ip: "192.168.2.15" 14 | 15 | config.vm.provider :virtualbox do |vb| 16 | vb.customize ["modifyvm", :id, "--memory", "5120"] 17 | end 18 | 19 | config.vm.provision :shell, :path => 'bootstrap.sh' 20 | end 21 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/apiclients/__init__.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/modeler/__init__.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/parsers/__init__.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/modeler/plugins/__init__.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/modeler/plugins/zenoss/__init__.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/modeler/plugins/zenoss/cmd/__init__.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/modeler/plugins/zenoss/cmd/linux/__init__.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/modeler/plugins/zenoss/cmd/linux/openstack/__init__.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/Volume.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2018, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | 11 | from . import schema 12 | 13 | class Volume(schema.Volume): 14 | 15 | def host(self): 16 | hosts = self.device().hosts() 17 | for host in hosts: 18 | if self.backend and host.hostname == self.backend.split('@')[0]: 19 | return host 20 | -------------------------------------------------------------------------------- /analytics/resources/organizations/zenoss/Data_Sources/zenoss_reporting.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /organizations/zenoss/Data_Sources 4 | zenoss_reporting 5 | 0 6 | 7 | The Zenoss Datawarehouse. Choose this as the datasource for all domains, ad-hoc views and reports. 8 | com.mysql.jdbc.Driver 9 | jdbc:mysql://localhost:13306/reporting?useUnicode=true&characterEncoding=UTF-8 10 | reporting_read 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/daemons/zenopenstack: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | ############################################################################## 3 | # 4 | # Copyright (C) Zenoss, Inc. 2018-2019, all rights reserved. 5 | # 6 | # This content is made available according to terms specified in 7 | # License.zenoss under the directory where your Zenoss product is installed. 8 | # 9 | ############################################################################## 10 | 11 | DAEMON_NAME="zenopenstack" 12 | 13 | . $ZENHOME/bin/zenfunctions 14 | 15 | MYPATH=`python -c "import os.path; print os.path.realpath('$0')"` 16 | THISDIR=`dirname $MYPATH` 17 | PRGHOME=`dirname $THISDIR` 18 | PRGNAME=zenopenstack.py 19 | CFGFILE=$CFGDIR/zenopenstack.conf 20 | 21 | generic "$@" 22 | -------------------------------------------------------------------------------- /vagrant/rdo-newton/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Note: Ensure that vagrant is version 1.6.5 or newer for centos 7 support. 5 | # It is also recommended that you install the vagrant-vbguest plugin, if using 6 | # virtualbox. 7 | 8 | Vagrant.configure('2') do |config| 9 | 10 | config.vm.hostname = "rdo-newton" 11 | config.vm.box = "centos-7.0-x86_64" 12 | config.vm.box_url = "https://f0fff3908f081cb6461b407be80daf97f07ac418.googledrive.com/host/0BwtuV7VyVTSkUG1PM3pCeDJ4dVE/centos7.box" 13 | 14 | config.vm.network :private_network, ip: "192.168.2.15" 15 | 16 | config.vm.provider :virtualbox do |vb| 17 | vb.customize ["modifyvm", :id, "--memory", "5120"] 18 | end 19 | 20 | config.vm.provision :shell, :path => 'bootstrap.sh' 21 | end 22 | -------------------------------------------------------------------------------- /vagrant/rdo-queens/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Note: Ensure that vagrant is version 1.6.5 or newer for centos 7 support. 5 | # It is also recommended that you install the vagrant-vbguest plugin, if using 6 | # virtualbox. 7 | 8 | Vagrant.configure('2') do |config| 9 | 10 | config.vm.hostname = "rdo-queens" 11 | config.vm.box = "centos/7" 12 | 13 | #config.vm.network :private_network, ip: "192.168.2.15" 14 | config.vm.network "public_network", ip: "192.168.1.45" 15 | 16 | config.vm.provider :virtualbox do |vb| 17 | vb.customize ["modifyvm", :id, "--memory", "6144"] 18 | # vb.customize ["modifyvm", :id, "--memory", "5120"] 19 | # vb.customize ["modifyvm", :id, "--memory", "4000"] 20 | end 21 | 22 | config.vm.provision :shell, :path => 'bootstrap.sh' 23 | end 24 | -------------------------------------------------------------------------------- /COPYRIGHT.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2011,2012,2014 Zenoss, Inc. 2 | # 3 | # This program is free software; you can redistribute it and/or modify it 4 | # under the terms of the GNU General Public License version 2 or (at your 5 | # option) any later version as published by the Free Software Foundation. 6 | # 7 | # This program is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public License 13 | # along with this program; if not, write to the Free Software 14 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 15 | # USA. 16 | # 17 | # For complete information please visit: http://www.zenoss.com/oss/ 18 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/COPYRIGHT.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2014, Zenoss, Inc. 2 | # 3 | # This program is free software; you can redistribute it and/or modify it 4 | # under the terms of the GNU General Public License version 2 or (at your 5 | # option) any later version as published by the Free Software Foundation. 6 | # 7 | # This program is distributed in the hope that it will be useful, 8 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | # GNU General Public License for more details. 11 | # 12 | # You should have received a copy of the GNU General Public License 13 | # along with this program; if not, write to the Free Software 14 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 15 | # USA. 16 | # 17 | # For complete information please visit: http://www.zenoss.com/oss/ 18 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/Port.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2016, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | from . import schema 10 | 11 | import logging 12 | LOG = logging.getLogger('zen.OpenStackInfrastructurePort') 13 | 14 | 15 | class Port(schema.Port): 16 | 17 | def vnic(self): 18 | '''Return the vnic that corresponds to this Port''' 19 | if not self.instance(): 20 | return 21 | 22 | for vnic in self.instance().vnics(): 23 | if vnic.mac_address.lower() == self.mac_address.lower(): 24 | return vnic 25 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/Vnic.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2016, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | from . import schema 10 | 11 | import logging 12 | LOG = logging.getLogger('zen.OpenStackInfrastructureVnic') 13 | 14 | 15 | class Vnic(schema.Vnic): 16 | 17 | def port(self): 18 | '''Return the port that corresponds to this Vnic''' 19 | if not self.instance(): 20 | return 21 | 22 | for port in self.instance().ports(): 23 | if port.mac_address.lower() == self.macaddress.lower(): 24 | return port 25 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/patches/__init__.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2014, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | from importlib import import_module 11 | 12 | 13 | def optional_import(module_name, patch_module_name): 14 | ''' 15 | Import patch_module_name only if module_name is importable. 16 | ''' 17 | try: 18 | import_module(module_name) 19 | except ImportError: 20 | pass 21 | else: 22 | import_module( 23 | '.{0}'.format(patch_module_name), 24 | 'ZenPacks.zenoss.OpenStackInfrastructure.patches') 25 | 26 | 27 | optional_import('Products.ZenModel', 'platform') 28 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | DISTDIR = ../dist 2 | LOCAL_OUTPUT_HTML = $(DISTDIR)/openstackinfrastructure_local.html 3 | OUTPUT_HTML = $(DISTDIR)/openstackinfrastructure.html 4 | default: test 5 | 6 | docs: 7 | [ -d $(DISTDIR) ] || mkdir $(DISTDIR) 8 | pandoc header.md --template=template.html > $(LOCAL_OUTPUT_HTML) 9 | pandoc releases.md --template=template.html >> $(LOCAL_OUTPUT_HTML) 10 | pandoc body.md --template=template.html --table-of-contents >> $(LOCAL_OUTPUT_HTML) 11 | # pandoc body.md -f markdown_strict --template=template.html --table-of-contents >> $(LOCAL_OUTPUT_HTML) 12 | cp $(LOCAL_OUTPUT_HTML) $(OUTPUT_HTML) 13 | perl -p -i -e 's@../docs/images/@https://www.zenoss.com/sites/default/files/zenpack/OpenStack%20(Provider%20View)/@g' $(OUTPUT_HTML) 14 | 15 | make -C kb 16 | 17 | test: docs 18 | echo "" > /tmp/osi.html 19 | cat $(LOCAL_OUTPUT_HTML) >> /tmp/osi.html 20 | cp -a images /tmp/ 21 | perl -p -i -e 's@../docs/images/@images/@g' /tmp/osi.html 22 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/test/keys/id_test_rsa_insecure: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXAIBAAKBgQC3A/hrYFlJ1kL4IDcpuFDzy+1FE3c/lIY0sHO/be+znXWlyJj3 3 | Y/+m0FOPnzcsvakYYDLKXtHtmxolGS738s6ldXC3hGzicgFw48oq0VVvHRqgj9hY 4 | mzQ9jLqRSC+4NVH5pcfgSRPeQk7dv9OEGNM+M383FLqxMbZSYv+TDvl4bQIDAQAB 5 | AoGAAZPqL1rMSkOrniIA974cDI4EhKTvUUABjDC9Prg+6ciAvCYnk3JsQM7o+YMA 6 | 4cTc0VX6+h2pJ6g/qHQ4IHEacPT+1Y3/sbsqa/eE2WlArHf4OBubiFFWfTvGGQ6t 7 | vJaSohdx8Siquv4RgRugfJTZvy+z8wLPzUByos/rc9BZAGECQQDiZ6YJm4L1YFFy 8 | P1vize5tkM7t/b7tclQ1jd473oJHDBZrez4iTj/okXUrFIW8NtJxzSopUR03NSjN 9 | hnfd914ZAkEAzvBaDQ413YXgfWfzliMKlsJrw4vLlAS2BXeJduNwsXUpbB/0ytfl 10 | k/bfO6tqf83KtAqIuTQVc4hLUHt+DqgPdQJBAKsMVaQCioEpwL7I4XnLzWuXsM6b 11 | G2k3LCm9wf2HUPOuTS3s0XeHmL7zTgs7GQKmhH2X3FeUwbbZAbes9NiMr9kCQFMA 12 | GD5QSs6VGdtyzEKVv3OEe5CtC3RNB2zd6ybiRpsGsRyLHLYXLh/Qzuyx7j9gnULl 13 | Tr1p5Ii4S+z1+zOJuNkCQGEsWHLZ9aKcNxoE/QzYdouTvMFGob3ArJr2SYjqACbY 14 | 2Ec0cStsNSG2HteJMjVqO+b/xBSE2RgA0c2HWDIDYtY= 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/test/keys/server_key_no_passphrase: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXQIBAAKBgQDwzJDCRGHSt6EUw2kTyvGUm0GYFNgcFjTLrXbQIlsoHak9ShUt 3 | XxP2cbHy2T9FBG1CBIOpTprnP9aZP0E6+JEVIT7kkwG1tFr9CarFzBVJnXEv8itX 4 | 8IIbN+vgDxGfdW/8JFP3GVjahLhSeG46wvP0LbigZ/0Sl05vxYFrWWc5RwIDAQAB 5 | AoGBAM1BIfdmAJh0DCs9sji72ZaZjJ0Mz3WJfDFNSCR71IXqWpMyrcCB9esw2MUv 6 | Z132Owd1/6B2r1WEtfDk2T5iGI9p6rFKsIETIiA/nhudcd2aQqxrmqk+mBWemw00 7 | 86LdD/vRf3FGd/zfR/j0nmrQam/uaxtL0WafkszdDyXRGv1ZAkEA/bg3Tcq0LNng 8 | D0OHHRgkW44n4FrtZAgvG6Kx4JrEOBAujV0uJwNuM46FQ5j98r7yMmYJTuqqaD7u 9 | 1QYiNPoDBQJBAPL2nt/ibN7Bw2lf93B2C2We+ehv5bhB3dGTm5/EJLp0GHaXToM8 10 | TK1hZaeDBeQhmBY1c1XaU8JV4u0QGSy1VNsCQHFP1XsrnV4ui++lM/Gdd5dgHJUJ 11 | Zt32/br05UYvOJTlPTUrOVJ5KL1j2EaBTGEeQCKcCWoySZq3CIkg7SQFyFUCQQDM 12 | SB3XAmsldGdYLy8+KJJ2lA9tpr/Qh9j4wJJF58Y12y1CcP+7ijSyRsUQ7jJC2Rgl 13 | /DUIR3TLXilZx4JTO/enAkBIBRReP2yGSJercfTcrL6zSQ0TLAV0mQf1UGLxSGCb 14 | vjFsehaZG5++PJWrK5d+/wzjTBfOXtS78BAHQQyOKMDo 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/ssh.py: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) Zenoss, Inc. 2016, all rights reserved. 3 | # 4 | # This content is made available according to terms specified in 5 | # License.zenoss under the directory where your Zenoss product is installed. 6 | # 7 | ############################################################################## 8 | 9 | from Products.ZenUtils.Utils import unused 10 | 11 | 12 | # use platform-provided version of sshclient if it's exists and is new 13 | # enough. 14 | try: 15 | from pkg_resources import parse_version 16 | from sshclient import __version__ as platform_version 17 | from .lib.sshclient import __version__ as local_version 18 | 19 | if parse_version(platform_version) < parse_version(local_version): 20 | # platform version is too old- force use of locally packaged 21 | # version 22 | raise ImportError 23 | 24 | from sshclient import SSHClient 25 | except ImportError, e: 26 | from .lib.sshclient import SSHClient 27 | 28 | 29 | unused(SSHClient) 30 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/ApiEndpoint.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2017, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | 11 | from . import schema 12 | 13 | import logging 14 | log = logging.getLogger('zen.OpenStackInfrastructureApiEndpoint') 15 | 16 | from Products.AdvancedQuery import Eq, Or 17 | 18 | 19 | class ApiEndpoint(schema.ApiEndpoint): 20 | 21 | def region_if_public_keystone(self): 22 | # if this is the public-facing api endpoint, it impacts the region. 23 | if self.id == 'apiendpoint-zOpenStackAuthUrl': 24 | try: 25 | return self.device().getDeviceComponents(type='OpenStackInfrastructureRegion')[0] 26 | except IndexError: 27 | return None 28 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/test/keys/id_test_rsa: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | Proc-Type: 4,ENCRYPTED 3 | DEK-Info: DES-EDE3-CBC,F14D2D259FC7A299 4 | 5 | cYAIV67gLCvu7G6ZVF9j0Jtv8xonWqvjdKOMmGlHrvS7ceWNo0PyaamCaEzzHJK9 6 | 15CQy16rcZKA56dYiwnVGiYIAWKkUpCiKquqeq4jiYemDyfAV8gHtUlTHtq7FbEt 7 | Fbhn3b+eBC5I5+KPfrs0rrqOv0ljHjfNBjyKaIJ0gMfb7f7+u3hjC+w8S6TfGUC3 8 | l+hwgIUtgDZhWUqfZ13K26vkZP/XCFQahTdWp2GW8PcKaGfdjELPFz9HVUobghqm 9 | KzDfleBFVl6ucq4Nifl1yAhAo0ei476LHHV0JZMbq/Ci3RHNhs/OJEo8ExVUXzDI 10 | 8itWUOVP/HK2MAzqcZg2UvFRCjejpNU+8PpObbMml0sV/iosK0JQKcJuccsV5IN/ 11 | NKSD4Tm0j/2uywGJ7JtlXleDXRjO6ocIi+ShI0ETO9WByeVLM/GJNat1im/TZems 12 | BQ/GGFgL0OzxKOtGO04v22O1ghMabEDlhXZ8NmHgoXOpYOjrDbGSCBiUwtWeB9j7 13 | 7TdHAqzlfu+saCr0AzQXKeosG9pCJfR2rAyx3R1UEcCa+WT5AFXy7rfzhlXdclA/ 14 | ebiZcMHnkHMoUmUXpPMO3y9vRq3FKYv9J2mlM72w/3ohPRmLSP7ClOobKCPjfN/M 15 | huM4kBaQ87aYsnn0i16fQ4vCO6E+Vr4MJmFzP7qa9QbEDVta0e+VfkCaEnCrDaro 16 | 3lGi2kXpmPADnQrHIXoMk0KS9MzApeo/hpfrEGpMQSvyYHvQQXRqd1ozIhYvYuHR 17 | yo6y9SoUwqiEXwwMxw3md4UWcdYv/U6SZhLlIbbF+TlicgyYLKjW+Q== 18 | -----END RSA PRIVATE KEY----- 19 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/test/keys/server_key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | Proc-Type: 4,ENCRYPTED 3 | DEK-Info: DES-EDE3-CBC,B980EDFD117130FF 4 | 5 | gg6URn3oj6P6vrrWI7n3y9KVcGI7BCVhCyCbFMl2//CHi+I59lXUVj/W5/p7wTyX 6 | 7aMayZ9y1IbOpx4MJlE163PRYw2DBqt3nRzSbGxsi+tgfgzDAOzBbSsTeqVgdbkm 7 | no8lHPV0sN7S2/+fMGJfahHb8MXeRelghEDoTip1D8nLFZq39H1vZiI7oJ89vAff 8 | /cJWjHyPS1ccNhuG/FT1nEGdDwpYvjE6lIQ7dZ87mfBm94qaVGyeEeXzhKb1yAfL 9 | s8dRp0MC5tgtXm7uDPNEkLJojMMc9pVdhgx0ECw2Zir/CaeZi0HI/SbQEsMuQ18K 10 | wmfPuKsNov0a/FIz4Rq5WZzEw41JiFt8zgWyDxUJBp6hBdii53HLpFZyxFBLvBUG 11 | ItNe5F6+rfqY5GT9V/K3vXeF5bsw1FRh0Hx+QB8abMp2u95CsooV/ZsPKnbricz/ 12 | J1SZ3OhrNmhjxmzQfaDLg69TGhIMBGbL75bFMvOpKNiUWQs58OtOeFZ5vZ/F2W/Q 13 | 958UCR+1ZChoGPNEQZ3au/O3YQRcprC/zG1h71iOIUZmJhbEW9Nrjn5YeC/tTxfm 14 | rvqg6EOiNHXeeuiizVegdq1UW3up98tI/JwXF4STPBNqrBmgKdWUnEyW9pmmu3H7 15 | t39K25ucTqVUKGeLynFvvUqnUIh7W3VxX7NQVI7hut1VudoSiaBtKdQcGyknKUrv 16 | 0eCRtsQ4XEku+rC/b5i6B+ZQv6pa6rypFLHTemyNKAcwehtSe213k4R0FDsxctUo 17 | zThrWAMzHJmvBqTt/m2TYiXwKCFyHXTw3/DzUdUNkzEITqfnyMF3qA== 18 | -----END RSA PRIVATE KEY----- 19 | -------------------------------------------------------------------------------- /analytics/resources/public/OpenStackInfrastructure_ZenPack/OpenStackInfrastructure_Domain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | /public/OpenStackInfrastructure_ZenPack 4 | OpenStackInfrastructure_Domain 5 | 1 6 | 7 | 8 | 9 | /public/OpenStackInfrastructure_ZenPack/OpenStackInfrastructure_Domain_files 10 | schema.xml 11 | 0 12 | 13 | schema 14 | xml 15 | 16 | 17 | 18 | zenoss_reporting 19 | 20 | /organizations/zenoss/Data_Sources/zenoss_reporting 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/transport/__init__.py: -------------------------------------------------------------------------------- 1 | from twisted.internet import defer 2 | from twisted.conch.ssh import transport 3 | from twisted.cred.error import UnauthorizedLogin 4 | 5 | import logging 6 | log = logging.getLogger('txsshclient.SSHTransport') 7 | 8 | 9 | class SSHTransport(transport.SSHClientTransport): 10 | def __init__(self): 11 | log.debug('Initialized the Transport Protocol') 12 | 13 | def verifyHostKey(self, hostKey, fingerprint): 14 | 'Assume all host keys are valid even if they changed' 15 | return defer.succeed(True) 16 | 17 | def connectionSecure(self): 18 | log.debug('Transport connectionSecure setting dTransport') 19 | 20 | # We are connected to the otherside. 21 | self.factory.dTransport.callback(self) 22 | 23 | def sendDisconnect(self, reason, desc): 24 | log.debug('sending transport disconnect [%s]' % reason) 25 | transport.SSHClientTransport.sendDisconnect(self, reason, desc) 26 | 27 | # Tell the factory we had an unauthorized login exception 28 | if reason == transport.DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE: 29 | self.factory.resetConnection(UnauthorizedLogin('Authentication Failure')) 30 | -------------------------------------------------------------------------------- /docs/releases.md: -------------------------------------------------------------------------------- 1 | Releases 2 | -------- 3 | 4 | Version 4.0.1 - Download 5 | : Released on 2024/08/06 6 | : Requires PythonCollector ZenPack,OpenStack (Tenant View) ZenPack,Linux Monitor ZenPack 7 | : Requires PythonCollector ZenPack,OpenStack (Tenant View) ZenPack,Linux Monitor ZenPack 8 | : Compatible with Zenoss 6.x and Zenoss Cloud 9 | 10 | Version 4.0.0 - Download 11 | : Released on 2021/06/04 12 | : Requires PythonCollector ZenPack,OpenStack (Tenant View) ZenPack,Linux Monitor ZenPack 13 | : Requires PythonCollector ZenPack,OpenStack (Tenant View) ZenPack,Linux Monitor ZenPack 14 | : Compatible with Zenoss 6.x and Zenoss Cloud 15 | -------------------------------------------------------------------------------- /docs/header.md: -------------------------------------------------------------------------------- 1 | OpenStack (Provider View) ZenPack 2 | ================================= 3 | 4 | This ZenPack provides monitoring of OpenStack from a service provider 5 | perspective. In addition to the user-oriented components (instances, flavors, images), 6 | the underlying OpenStack servers and software are monitored. 7 | 8 | Features 9 | -------- 10 | 11 | - Monitors overall OpenStack state, including all tenants. 12 | - Monitors Nova, Neutron and Cinder health 13 | - Models and monitors Nova Services and components 14 | - Models and monitors Neutron Agents and components 15 | - Models and monitors Cinder Services and components 16 | - Impact and Root-Cause (Requires Zenoss Service Dynamics) 17 | 18 | Support 19 | ------- 20 | 21 | This is an Open Source ZenPack developed by Zenoss, Inc. Enterprise support for 22 | this ZenPack is available to commercial customers with an active subscription. 23 | 24 | OpenStackInfrstructure 3.0.0 supports only Pike, Queens, and Rocky releases of OpenStack. 25 |
OpenStack releases, prior to the Pike release, are not verified to 26 | work with the OpenStackInfrastrucure 3.0.0 ZenPack. 27 |
Although the 3.0.0 ZenPack will work with the older AMQP based Ceilometer integration, those versions of 28 | Ceilometer are not supported by Zenoss. 29 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/tools/client.py: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/python 2 | from twisted.internet import reactor 3 | from twisted.python import failure 4 | 5 | from sshclient import SSHClient 6 | 7 | import logging 8 | logging.basicConfig(level=logging.DEBUG) 9 | #logging.basicConfig(level=logging.INFO) 10 | from twisted.python import log as twistedlog 11 | observer = twistedlog.PythonLoggingObserver() 12 | observer.start() 13 | log = logging.getLogger('txsshclient.client') 14 | 15 | options = {'hostname': '127.0.0.1', 16 | 'port': 2222, 17 | 'user': 'eedgar', 18 | 'password': 'foo', 19 | 'buffersize': 32768} 20 | 21 | client = SSHClient(options) 22 | client.connect() 23 | 24 | 25 | def retry(): 26 | log.debug('retrying') 27 | d = client.run('sleep 5 && ls') 28 | 29 | def failed_or_success(result): 30 | if isinstance(result, failure.Failure): 31 | log.info("Failed %s" % (result, )) 32 | else: 33 | log.info("Success %s" % (result, )) 34 | 35 | d.addBoth(failed_or_success) 36 | 37 | d2 = client.run('sleep 5 && ls', timeout=6) 38 | d2.addBoth(failed_or_success) 39 | reactor.callLater(6, retry) 40 | 41 | reactor.callLater(1, retry) 42 | reactor.callLater(20, reactor.stop) 43 | reactor.run() 44 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/apiclients/exceptions.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2017, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | 14 | 15 | class APIClientError(Exception): 16 | """Parent class of all exceptions raised by api clients.""" 17 | pass 18 | 19 | 20 | class BadRequestError(APIClientError): 21 | """Wrapper for HTTP 400 Bad Request error.""" 22 | pass 23 | 24 | 25 | class UnauthorizedError(APIClientError): 26 | """Wrapper for HTTP 401 Unauthorized error.""" 27 | pass 28 | 29 | 30 | class NotFoundError(APIClientError): 31 | """Wrapper for HTTP 400 Bad Request error.""" 32 | pass 33 | 34 | 35 | class NotSupported(APIClientError): 36 | """Client tried to call an API method that is not supported by the client""" 37 | pass 38 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/test/keys/notes: -------------------------------------------------------------------------------- 1 | # Update test_common and test_auth auth keys. 2 | # these are less secure due to a bug in older versions of twisted. 3 | # these are using DES3 instead of AES that newer versions 4 | # of ssh-keygen would generate. 5 | # https://twistedmatrix.com/trac/ticket/5496 6 | 7 | # Use 'foo' for passphrase 8 | openssl genrsa -des3 -out server_key 1024 9 | 10 | # strip the passphase used before 11 | #'foo' when prompted 12 | openssl rsa -in server_key -out server_key_no_passphrase 13 | 14 | # change the permissions 15 | chmod 600 server_key* 16 | 17 | # Create the pub key file 18 | ssh-keygen -y -f server_key_no_passphrase > server_key_no_passphrase.pub 19 | 20 | 21 | #Create the testUser key 22 | # passphrase 'test1' 23 | openssl genrsa -des3 -out id_test_rsa 1024 24 | 25 | # change the permissions 26 | chmod 600 server_key* 27 | 28 | # enter test1 to decrypt the key and create the pubfile 29 | ssh-keygen -y -f id_test_rsa > id_test_rsa.pub 30 | 31 | 32 | # Create the testUser2 key which is the testUser1 key but without the 33 | # passphrase 34 | 35 | # enter 'test1' to decrypt the key 36 | openssl rsa -in id_test_rsa id_test_rsa_insecure 37 | 38 | # change the permissions 39 | chmod 600 server_key* 40 | 41 | ssh-keygen -y -f id_test_rsa_insecure > id_test_rsa_insecure.pub 42 | 43 | 44 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/parsers/endpoint.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | 14 | import json 15 | 16 | from Products.ZenRRD.CommandParser import CommandParser 17 | 18 | 19 | class endpoint(CommandParser): 20 | def processResults(self, cmd, result): 21 | data = json.loads(cmd.result.output) 22 | dp_map = dict([(dp.id, dp) for dp in cmd.points]) 23 | 24 | for name, dp in dp_map.items(): 25 | if name in data: 26 | result.values.append((dp, data[name])) 27 | 28 | if 'events' in data: 29 | for event in data['events']: 30 | # Keys must be converted from unicode to str. 31 | event = dict((str(k), v) for k, v in event.iteritems()) 32 | result.events.append(event) 33 | -------------------------------------------------------------------------------- /docs/ceilometer.md: -------------------------------------------------------------------------------- 1 | Ceilometer Configuration Example for Pike and Later 2 | ------------------------------------------------------- 3 | 4 | This file should be part of your custom-network-configuration.yaml: 5 | 6 | ManagePipeline: true 7 | PipelinePublishers: 8 | - https://:8342/ceilometer/v1/samples/?verify_ssl=False 9 | - https://:8342/ceilometer/v1/samples/?verify_ssl=False 10 | - 11 | ManageEventPipeline: true 12 | EventPipelinePublishers: 13 | - https://:8342/ceilometer/v1/events/?verify_ssl=False 14 | - https://:8342/ceilometer/v1/events/?verify_ssl=False 15 | - 16 | 17 | 18 | From bash you can populate your ip address and device name, 19 | then execute the following: 20 | 21 | ipaddress=10.0.0.20 22 | device=TripleO411 23 | 24 | echo " 25 | ManagePipeline: true 26 | PipelinePublishers: 27 | - https://$ipaddress:8342/ceilometer/v1/samples/$device?verify_ssl=False 28 | ManageEventPipeline: true 29 | EventPipelinePublishers: 30 | - https://$ipaddress:8342/ceilometer/v1/events/$device?verify_ssl=False 31 | " 32 | 33 | Make sure your resulting YAML is valid. 34 | -------------------------------------------------------------------------------- /strip_instances.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # 4 | # Copyright (C) Zenoss, Inc. 2008, all rights reserved. 5 | # 6 | # This content is made available according to terms specified in 7 | # License.zenoss under the directory where your Zenoss product is installed. 8 | # 9 | # 10 | 11 | """Remove product instances from objects.xml file. 12 | 13 | A bug in Zenoss' ZenPack export causes it to export individual instances 14 | of product classes to the objects.xml file. These instances are related to 15 | devices added to the running Zenoss system, and are not applicable to anyone 16 | else who would install the ZenPack. 17 | 18 | It is expected that this script would be located, and executed from the 19 | top-level directory of the ZenPack. 20 | 21 | """ 22 | 23 | objects_filename = 'ZenPacks/zenoss/OpenStackInfrastructure/objects/objects.xml' 24 | 25 | print "Stripping product instances from objects.xml." 26 | 27 | lines = [] 28 | 29 | with open(objects_filename, 'r') as f: 30 | in_instances = False 31 | for line in f: 32 | if line.startswith(""): 33 | in_instances = True 34 | continue 35 | 36 | if in_instances and line.startswith(""): 37 | in_instances = False 38 | continue 39 | 40 | if not in_instances: 41 | lines.append(line) 42 | 43 | with open(objects_filename, 'w') as f: 44 | for line in lines: 45 | f.write(line) 46 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/migrate/RemoveOldZProps.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2017, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | 11 | import logging 12 | log = logging.getLogger("zen.migrate") 13 | 14 | import Globals 15 | from Products.ZenModel.migrate.Migrate import Version 16 | from Products.ZenModel.ZenPack import ZenPackMigration 17 | from Products.ZenUtils.Utils import unused 18 | unused(Globals) 19 | 20 | # in previous versions of the zenpack, these zproperties were created, but 21 | # they are no longer needed. 22 | 23 | remove_zproperties = [ 24 | 'zOpenStackCeilometerUrl' 25 | ] 26 | 27 | 28 | class RemoveOldZProps(ZenPackMigration): 29 | version = Version(2, 4, 0) 30 | 31 | def migrate(self, pack): 32 | dmd = pack.dmd 33 | 34 | count = 0 35 | for prop in remove_zproperties: 36 | if dmd.Devices.hasProperty(prop): 37 | dmd.Devices._delProperty(prop) 38 | count += 1 39 | 40 | if count == 1: 41 | log.info("Removed %d obsolete zProperty", count) 42 | elif count: 43 | log.info("Removed %d obsolete zProperties", count) 44 | 45 | RemoveOldZProps() 46 | -------------------------------------------------------------------------------- /analytics/resources/public/OpenStackInfrastructure_ZenPack/OpenStack_Instance_List.xml: -------------------------------------------------------------------------------- 1 | 2 | /public/OpenStackInfrastructure_ZenPackOpenStack_Instance_List02014-10-08T20:04:57.000-05:002014-10-08T20:04:57.000-05:00/public/OpenStackInfrastructure_ZenPack/OpenStackInfrastructure_Domain/public/OpenStackInfrastructure_ZenPack/OpenStack_Instance_List_filestopicJRXML02014-10-08T20:04:57.000-05:002014-10-08T20:04:57.000-05:00jrxml/public/OpenStackInfrastructure_ZenPack/OpenStack_Instance_List_filesstateXML02014-10-08T20:04:57.000-05:002014-10-08T20:04:57.000-05:00xmlfalse1 -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/dynamicview.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2016, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | from ZenPacks.zenoss.DynamicView import TAG_ALL, TAG_IMPACTED_BY, TAG_IMPACTS 11 | from ZenPacks.zenoss.DynamicView.model.adapters import BaseRelationsProvider 12 | 13 | 14 | class LinuxDeviceRelationsProvider_OSI(BaseRelationsProvider): 15 | def relations(self, type=TAG_ALL): 16 | if type in (TAG_ALL, TAG_IMPACTED_BY): 17 | instance = self._adapted.openstackInstance() 18 | if instance: 19 | yield self.constructRelationTo(instance, TAG_IMPACTED_BY) 20 | 21 | if type in (TAG_ALL, TAG_IMPACTS): 22 | host = self._adapted.openstack_hostComponent() 23 | if host: 24 | yield self.constructRelationTo(host, TAG_IMPACTS) 25 | 26 | 27 | class OSProcessRelationsProvider_OSI(BaseRelationsProvider): 28 | def relations(self, type=TAG_ALL): 29 | if type in (TAG_ALL, TAG_IMPACTS): 30 | software_component = self._adapted.openstack_softwareComponent() 31 | if software_component: 32 | # impact the corresponding software software component 33 | yield self.constructRelationTo(software_component, TAG_IMPACTS) 34 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/migrate/RemoveOldProducts.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2017, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | 11 | import logging 12 | log = logging.getLogger("zen.migrate") 13 | 14 | import Globals 15 | from Products.ZenModel.migrate.Migrate import Version 16 | from Products.ZenModel.ZenPack import ZenPackMigration 17 | from Products.ZenUtils.Utils import unused 18 | unused(Globals) 19 | 20 | # in previous versions of the zenpack, these products were created, but 21 | # they are no longer needed. 22 | 23 | remove_products = [ 24 | '2016.1', 25 | '2016.2', 26 | '2017.1', 27 | '2017.2', 28 | 'Newton (2016.2)', 29 | 'Newton (2017.1)', 30 | 'Ocata (2017.1)' 31 | ] 32 | 33 | 34 | class RemoveOldProducts(ZenPackMigration): 35 | version = Version(2, 4, 0) 36 | 37 | def migrate(self, pack): 38 | dmd = pack.dmd 39 | 40 | count = 0 41 | current_products = dmd.Manufacturers.OpenStack.products.objectIds() 42 | for product in remove_products: 43 | if product in current_products: 44 | dmd.Manufacturers.OpenStack.manage_deleteProducts(ids=[product]) 45 | count += 1 46 | 47 | if count: 48 | log.info("Removed %d obsolete product objects", count) 49 | 50 | RemoveOldProducts() 51 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/protocols/openstack_amqp.qjs: -------------------------------------------------------------------------------- 1 | { 2 | "content_types" : { 3 | }, 4 | "exchanges" : { 5 | "$OpenStackInbound" : { 6 | "name" : "zenoss.openstack.ceilometer", 7 | "type" : "topic", 8 | "durable" : true, 9 | "auto_delete" : false, 10 | "description" : "Perf and Event messages are sent from OpenStack Ceilometer to this exchange for zenoss collectors to process", 11 | "content_types" : [] 12 | } 13 | }, 14 | "queues" : { 15 | "$OpenStackInboundPerf" : { 16 | "name" : "zenoss.queues.openstack.ceilometer.{device}.perf", 17 | "durable" : true, 18 | "exclusive" : false, 19 | "auto_delete" : false, 20 | "description" : "Queue for Zenoss collectors to consume messages from Openstack Ceilometer", 21 | "bindings" : [ 22 | { 23 | "exchange" : "$OpenStackInbound", 24 | "routing_key": "zenoss.openstack.{device}.meter.#" 25 | } 26 | ] 27 | }, 28 | "$OpenStackInboundEvent" : { 29 | "name" : "zenoss.queues.openstack.ceilometer.{device}.event", 30 | "durable" : true, 31 | "exclusive" : false, 32 | "auto_delete" : false, 33 | "description" : "Queue for Zenoss collectors to consume messages from Openstack Ceilometer", 34 | "bindings" : [ 35 | { 36 | "exchange" : "$OpenStackInbound", 37 | "routing_key": "zenoss.openstack.{device}.event.#" 38 | } 39 | ] 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /loadtest/README.txt: -------------------------------------------------------------------------------- 1 | To use: 2 | 3 | 1) Generate a fake device in zenoss, with a large number of components 4 | 5 | Run load_model.py 6 | This will create a model in the database with a specified number of controller, compute nodes, tenants, and instances. The default size parameters can be overridden with command line arguments: 7 | -d DEVICE Device Name (default: test_ostack) 8 | --controllers=CONTROLLERS Number of Controller Nodes to create (3) 9 | --computes=COMPUTES Number of Compute Nodes to create (30) 10 | --tenants=TENANTS Number of tenants to create (50) 11 | --instances=INSTANCES Number of Instances to create (2250) 12 | 13 | 2) Start zenpython (for data collection) 14 | Run zenpython run -c -d -v10 15 | 16 | 3) Generate simulated perf messages (over amqp) 17 | Run sim_perf.py -d --nottl 18 | 19 | The nottl option causes the AMQP messages being generated to not have 20 | time to live values, so they will not auto-expire from the rabbit queue. 21 | This will give a more reaslistic indication of whether the system is 22 | consuming messages fast enough, as it will allow the queue to get backed up. 23 | 24 | 4) Generate simulated model change events (over amqp) 25 | Run sim_events.py -d -v10 26 | 27 | By default, this will perform 4 operations every 60 seconds (staggered): 28 | delete and re-create a random instance 29 | power cycle a random instance 30 | suspend and resume a random instance 31 | reboot a random instance 32 | 33 | The interval for each may be controlled with command-line arguments. 34 | 35 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/README: -------------------------------------------------------------------------------- 1 | Description 2 | 3 | This is a twisted python asynchronous library for issueing commands and 4 | receiving or sending files over ssh. 5 | 6 | Usage 7 | 8 | options = {'hostname': '127.0.0.1', 9 | 'port': 22, 10 | 'user': 'user', 11 | 'password': 'password', 12 | 'identities': ['~/.ssh/id_rsa', '~/.ssh/id_dsa'], 13 | 'buffersize': 32768} 14 | 15 | from sshclient import SSHClient 16 | c = SSHClient(options) 17 | 18 | options is a dictionary containing the keys for hostname, port, user, password, 19 | identies, and buffersize. The password, identities, and buffersize fields are 20 | optional. 21 | 22 | 23 | #options = {'hostname': '127.0.0.1', 24 | # 'port': 22, 25 | # 'user': 'user', 26 | # 'password': 'password', 27 | # 'identities': ['~/.ssh/id_rsa', '~/.ssh/id_dsa'], 28 | # 'buffersize': 32768} 29 | 30 | self.connectionTimeout = 100 # Connection timeout in seconds 31 | self.commandTimeout = None # Timeout for the commands in seconds 32 | self.maxDelay = 200 # Maximum delay in seconds before retrying to 33 | # connect. 34 | 35 | from sshclient import SSHClient 36 | c = SSHClient(options) 37 | 38 | # ls a remote directory. 39 | d=c.ls('/tmp') 40 | display(data): 41 | print data 42 | c.disconnect() 43 | d.addBoth(display) 44 | 45 | # ***** WARNING ****** 46 | # This library uses the twisted reconnecting client factory. It will not disconnect unless you tell it to. 47 | # It is also very aggressive in reconnecting. If you do not disconnect you will have connections increment 48 | # and may flood your remote system. 49 | 50 | for more help see the builtin sshclient help. 51 | from sshclient import SSHClient 52 | help(SSHClient) 53 | -------------------------------------------------------------------------------- /GNUmakefile: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | 14 | PYTHON=python 15 | SRC_DIR=$(PWD)/src 16 | TXSSHCLIENT_DIR=$(SRC_DIR)/txsshclient-1.0.0 17 | ZP_NAME=OpenStackInfrastructure 18 | ZP_DIR=$(PWD)/ZenPacks/zenoss/$(ZP_NAME) 19 | BIN_DIR=$(ZP_DIR)/bin 20 | LIB_DIR=$(ZP_DIR)/lib 21 | 22 | default: egg 23 | 24 | egg: 25 | # setup.py will call 'make build' before creating the egg 26 | python setup.py bdist_egg 27 | 28 | .PHONY: build analytics 29 | 30 | build: 31 | # Now build all the build dependencies for this zenpack. 32 | rm -rf $(TXSSHCLIENT_DIR)/build 33 | cd $(TXSSHCLIENT_DIR); python setup.py build --build-lib build/lib 34 | mkdir -p $(ZP_DIR)/lib/sshclient 35 | cp -r $(TXSSHCLIENT_DIR)/build/lib/sshclient/* $(ZP_DIR)/lib/sshclient/ 36 | 37 | clean: 38 | rm -rf build dist *.egg-info 39 | cd $(TXSSHCLIENT_DIR) ; rm -rf build dist *.egg-info ; cd $(SRC_DIR) 40 | cd $(LIB_DIR) ; rm -Rf *.egg site.py easy-install.pth ; cd $(SRC_DIR) 41 | find . -name '*.pyc' | xargs rm -f 42 | 43 | # Make sure you have set an environment var for OSI $device. 44 | analytics: 45 | rm -f ZenPacks/zenoss/$(ZP_NAME)/analytics/analytics-bundle.zip 46 | ./create-analytics-bundle \ 47 | --folder="$(ZP_NAME) ZenPack" \ 48 | --domain="$(ZP_NAME) Domain" \ 49 | --device="$(device)" 50 | cd analytics; zip -r ../ZenPacks/zenoss/$(ZP_NAME)/analytics/analytics-bundle.zip * 51 | 52 | 53 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/service_definition/-CONFIGS-/opt/zenoss/etc/proxy-zenopenstack.conf: -------------------------------------------------------------------------------- 1 | user zenoss; 2 | worker_processes auto; 3 | daemon off; 4 | pid /var/run/nginx.pid; 5 | events { 6 | worker_connections 8096; 7 | multi_accept on; 8 | use epoll; 9 | } 10 | 11 | worker_rlimit_nofile 40000; 12 | 13 | http { 14 | 15 | ## 16 | # Basic Settings 17 | ## 18 | 19 | sendfile on; 20 | tcp_nopush on; 21 | tcp_nodelay on; 22 | keepalive_timeout 100; 23 | types_hash_max_size 2048; 24 | 25 | ## 26 | # Logging Settings 27 | ## 28 | 29 | access_log off; 30 | error_log /opt/zenoss/zproxy/logs/error.log error; 31 | 32 | ## 33 | # Gzip Settings 34 | ## 35 | 36 | gzip on; 37 | gzip_disable "msie6"; 38 | 39 | upstream zenopenstack { 40 | ip_hash; 41 | include zenopenstack-upstreams.conf; 42 | } 43 | 44 | server { 45 | listen 8342 ssl; 46 | listen 8340; 47 | 48 | server_name ""; 49 | 50 | ssl_certificate /home/zenoss/.zenopenstack-certs/{{(parent .).Name}}_nginx.crt; 51 | ssl_certificate_key /home/zenoss/.zenopenstack-certs/{{(parent .).Name}}_nginx.key; 52 | 53 | ssl_prefer_server_ciphers on; 54 | ssl_session_cache shared:SSL:10m; 55 | ssl_session_tickets on; 56 | 57 | location / { 58 | proxy_set_header X-Real-IP $remote_addr; 59 | proxy_set_header X-Forwarded-Proto $scheme; 60 | proxy_buffering off; 61 | proxy_buffer_size 128k; 62 | proxy_buffers 100 128k; 63 | proxy_redirect off; 64 | proxy_set_header Host $host; 65 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 66 | proxy_pass http://zenopenstack; 67 | 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/setup.py: -------------------------------------------------------------------------------- 1 | 2 | import os 3 | import re 4 | from setuptools import setup, find_packages 5 | 6 | 7 | # Utility function to read the README file. 8 | def read(fname): 9 | return open(os.path.join(os.path.dirname(__file__), fname)).read() 10 | 11 | 12 | def get_version(filename): 13 | pattern = re.compile(r"^__version__ = ['\"]([^'\"]*)['\"]") 14 | 15 | for line in open(filename).readlines(): 16 | match = pattern.search(line) 17 | if match: 18 | return match.group(1) 19 | raise Exception('Unable to find version string in %s.' % filename) 20 | 21 | 22 | requires = [ 23 | 'twisted', 24 | 'pyasn1', 25 | 'PyCrypto', 26 | ] 27 | install_requires = [ 28 | 'idna<=2.10,>=2.4', 29 | 'twisted<21', 30 | ] 31 | 32 | setup( 33 | name='txsshclient', 34 | packages=find_packages(), 35 | 36 | version=get_version("sshclient/__init__.py"), 37 | description="Twisted python asynchronous library for issueing commands and receiving or sending files over ssh.", 38 | long_description=read('README'), 39 | 40 | # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers 41 | classifiers=[ 42 | 'Development Status :: 3 - Alpha', 43 | 'Environment :: Other Environment', 44 | 'Framework :: Twisted', 45 | 'Intended Audience :: Developers', 46 | 'License :: Other/Proprietary License', 47 | 'Natural Language :: English', 48 | 'Operating System :: POSIX :: Linux', 49 | 'Programming Language :: Python :: 2', 50 | 'Topic :: Software Development :: Libraries :: Python Modules', 51 | ], 52 | 53 | keywords="twisted ssh", 54 | author='Zenoss, Inc.', 55 | author_email='support@zenoss.com', 56 | url='http://github.com/zenoss/txsshclient', 57 | license='All Rights Reserved', 58 | requires=requires, 59 | install_requires=install_requires, 60 | ) 61 | 62 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/reportable.zcml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | 18 | 19 | 23 | 24 | 28 | 29 | 30 | 31 | 35 | 36 | 40 | 41 | 45 | 46 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/datasources/QueueSizeDataSource.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2014-2024, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | from zope.component import adapts 11 | from zope.interface import implements 12 | 13 | from ZenPacks.zenoss.PythonCollector.datasources.PythonDataSource import ( 14 | PythonDataSource, PythonDataSourcePlugin, PythonDataSourceInfo, 15 | IPythonDataSourceInfo) 16 | 17 | from ZenPacks.zenoss.OpenStackInfrastructure.utils import add_local_lib_path, result_errmsg 18 | 19 | class QueueSizeDataSource(PythonDataSource): 20 | ''' 21 | Deprecated. Need to delete with the next release. 22 | ''' 23 | 24 | ZENPACKID = 'ZenPacks.zenoss.OpenStackInfrastructure.' 25 | 26 | sourcetypes = ('OpenStack AMQP Queue Size',) 27 | sourcetype = sourcetypes[0] 28 | 29 | # RRDDataSource 30 | component = '${here/id}' 31 | cycletime = 30 32 | 33 | # PythonDataSource 34 | plugin_classname = 'ZenPacks.zenoss.OpenStackInfrastructure.datasources.'\ 35 | 'QueueSizeDataSource.QueueSizeDataSourcePlugin' 36 | 37 | # QueueSizeDataSource 38 | _properties = PythonDataSource._properties + () 39 | 40 | 41 | class IQueueSizeDataSourceInfo(IPythonDataSourceInfo): 42 | ''' 43 | Deprecated. Need to delete with the next release. 44 | ''' 45 | pass 46 | 47 | 48 | class QueueSizeDataSourceInfo(PythonDataSourceInfo): 49 | ''' 50 | Deprecated. Need to delete with the next release. 51 | ''' 52 | 53 | implements(IQueueSizeDataSourceInfo) 54 | adapts(QueueSizeDataSource) 55 | 56 | testable = False 57 | 58 | 59 | class QueueSizeDataSourcePlugin(PythonDataSourcePlugin): 60 | """ 61 | Deprecated. Need to delete with the next release. 62 | """ 63 | pass 64 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/deviceloaders.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | 14 | import logging 15 | log = logging.getLogger('zen.OpenStackLoader') 16 | 17 | from zope.interface import implements 18 | 19 | from Products.Zuul import getFacade 20 | from Products.ZenModel.interfaces import IDeviceLoader 21 | 22 | 23 | class OpenStackInfrastructureLoader(object): 24 | """ 25 | Loader for the OpenStackInfrastructure ZenPack. 26 | 27 | Sample usage: 28 | 29 | /Devices/OpenStack/Infrastructure loader='openstackinfrastructure', loader_arg_keys=['deviceName', 'username', 'api_key', 'project_id', 'user_domain_name', 'project_domain_name', 'auth_url', 'region_name', 'collector'] 30 | ostack_test username='admin', api_key='admin_password', project_id='admin', user_domain_name = 'default', 'project_domain_name' = 'default', auth_url='http://10.1.2.3:5000/v2.0/', region_name='RegionOne' 31 | 32 | """ 33 | implements(IDeviceLoader) 34 | 35 | def load_device(self, dmd, deviceName, username, api_key, project_id, user_domain_name, project_domain_name, auth_url, 36 | ceilometer_url=None, region_name=None, collector='localhost'): 37 | 38 | # we accept, but do not use, the ceilometer_url parameter for backwards 39 | # compatability reasons. 40 | 41 | return getFacade('openstackinfrastructure', dmd).addOpenStack( 42 | deviceName, username, api_key, project_id, user_domain_name, project_domain_name, auth_url, 43 | region_name=region_name, collector=collector) 44 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/datasources/EventsAMQPDataSource.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2014-2024, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | from zope.component import adapts 10 | from zope.interface import implements 11 | 12 | from Products.Zuul.infos import ProxyProperty 13 | 14 | from ZenPacks.zenoss.PythonCollector.datasources.PythonDataSource import ( 15 | PythonDataSource, PythonDataSourcePlugin ) 16 | 17 | from Products.Zuul.infos.template import RRDDataSourceInfo 18 | from Products.Zuul.interfaces import IRRDDataSourceInfo 19 | 20 | 21 | class EventsAMQPDataSource(PythonDataSource): 22 | ''' 23 | Deprecated. Need to delete with the next release. 24 | ''' 25 | 26 | ZENPACKID = 'ZenPacks.zenoss.OpenStackInfrastructure.' 27 | 28 | sourcetypes = ('OpenStack Ceilometer Events AMQP',) 29 | sourcetype = sourcetypes[0] 30 | 31 | # RRDDataSource 32 | component = '${here/id}' 33 | cycletime = 30 34 | 35 | # PythonDataSource 36 | plugin_classname = 'ZenPacks.zenoss.OpenStackInfrastructure.datasources.'\ 37 | 'EventsAMQPDataSource.EventsAMQPDataSourcePlugin' 38 | 39 | # EventsAMQPDataSource 40 | 41 | _properties = PythonDataSource._properties + () 42 | 43 | 44 | class IEventsAMQPDataSourceInfo(IRRDDataSourceInfo): 45 | ''' 46 | Deprecated. Need to delete with the next release. 47 | ''' 48 | pass 49 | 50 | class EventsAMQPDataSourceInfo(RRDDataSourceInfo): 51 | ''' 52 | Deprecated. Need to delete with the next release. 53 | ''' 54 | 55 | implements(IEventsAMQPDataSourceInfo) 56 | adapts(EventsAMQPDataSource) 57 | 58 | cycletime = ProxyProperty('cycletime') 59 | 60 | testable = False 61 | 62 | 63 | class EventsAMQPDataSourcePlugin(PythonDataSourcePlugin): 64 | """ 65 | Deprecated. Need to delete with the next release. 66 | """ 67 | pass 68 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/SoftwareComponent.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2013-2014, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | 11 | from . import schema 12 | 13 | import logging 14 | LOG = logging.getLogger('zen.OpenStackSoftwareComponent') 15 | 16 | 17 | class SoftwareComponent(schema.SoftwareComponent): 18 | 19 | def osprocess_components(self): 20 | try: 21 | device = self.hostedOn().proxy_device() 22 | if device: 23 | os_processes = filter( 24 | lambda x: x.osProcessClass().id == self.binary, 25 | device.getDeviceComponents(type='OSProcess') 26 | ) 27 | return os_processes 28 | except Exception: 29 | pass 30 | 31 | return [] 32 | 33 | def getDefaultGraphDefs(self, drange=None): 34 | """ 35 | Return graph definitions for this software comoponent, along with 36 | any graphs from the associated OSProcess component. 37 | """ 38 | graphs = super(SoftwareComponent, self).getDefaultGraphDefs(drange=drange) 39 | os_processes = self.osprocess_components() 40 | for os_process in os_processes: 41 | for graph in os_process.getDefaultGraphDefs(drange): 42 | graphs.append(graph) 43 | 44 | return graphs 45 | 46 | def getGraphObjects(self, drange=None): 47 | """ 48 | Return graph definitions for this software comoponent, along with 49 | any graphs from the associated OSProcess component. 50 | This method is for 5.x compatibility 51 | """ 52 | graphs = super(SoftwareComponent, self).getGraphObjects() 53 | os_processes = self.osprocess_components() 54 | for os_process in os_processes: 55 | graphs.extend(os_process.getGraphObjects()) 56 | 57 | return graphs 58 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/dsplugins.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2016-2017, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | from twisted.internet import defer 11 | from twisted.internet.defer import inlineCallbacks 12 | 13 | from ZenPacks.zenoss.PythonCollector.datasources.PythonDataSource import \ 14 | PythonDataSourcePlugin 15 | 16 | from Products.DataCollector.plugins.DataMaps import ObjectMap 17 | 18 | import zope.component 19 | from Products.Five import zcml 20 | 21 | import Products.ZenMessaging.queuemessaging 22 | 23 | zcml.load_config('meta.zcml', zope.component) 24 | zcml.load_config('configure.zcml', zope.component) 25 | zcml.load_config('configure.zcml', Products.ZenMessaging.queuemessaging) 26 | 27 | 28 | class MaintenanceDataSourcePlugin(PythonDataSourcePlugin): 29 | proxy_attributes = () 30 | 31 | @classmethod 32 | def config_key(cls, datasource, context): 33 | """ 34 | Return list that is used to split configurations at the collector. 35 | 36 | This is a classmethod that is executed in zenhub. The datasource and 37 | context parameters are the full objects. 38 | """ 39 | return ( 40 | context.device().id, 41 | datasource.getCycleTime(context), 42 | datasource.plugin_classname, 43 | ) 44 | 45 | @classmethod 46 | def params(cls, datasource, context): 47 | return {} 48 | 49 | @inlineCallbacks 50 | def collect(self, config): 51 | defer.returnValue(None) 52 | yield None 53 | 54 | def onSuccess(self, result, config): 55 | data = self.new_data() 56 | 57 | data['maps'].append(ObjectMap( 58 | modname='ZenPacks.zenoss.OpenStackInfrastructure.Endpoint', 59 | data=dict( 60 | set_ensure_service_monitoring=True 61 | ) 62 | )) 63 | 64 | return data 65 | -------------------------------------------------------------------------------- /migrate/DefaultZProps.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2016-2017, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | 11 | import logging 12 | log = logging.getLogger("zen.migrate") 13 | 14 | import Globals 15 | from Products.ZenModel.migrate.Migrate import Version 16 | from Products.ZenModel.ZenPack import ZenPackMigration 17 | from Products.ZenUtils.Utils import unused 18 | unused(Globals) 19 | 20 | # in previous versions of the zenpack, these zproperties had their defaults 21 | # explicitly set at the device class level, rather than as global defaults. 22 | # 23 | # this would cause any changes to these values at the device class level to be 24 | # overwritten when the zenpack was upgraded. 25 | 26 | 27 | class DefaultZProps(ZenPackMigration): 28 | version = Version(2, 4, 0) 29 | 30 | def migrate(self, pack): 31 | dmd = pack.dmd 32 | 33 | set_default_if_none = { 34 | 'zOpenStackNeutronConfigDir': '/etc/neutron' 35 | } 36 | 37 | remove_local_copy_if_default = { 38 | 'Server/SSH/Linux/NovaHost': [ 39 | 'zOpenStackRunNovaManageInContainer', 40 | 'zOpenStackRunVirshQemuInContainer', 41 | 'zOpenStackRunNeutronCommonInContainer' 42 | ] 43 | } 44 | 45 | for zprop, newval in set_default_if_none.iteritems(): 46 | if dmd.Devices.hasProperty(zprop): 47 | if dmd.Devices.getZ(zprop) == '': 48 | log.info("Setting default of %s to %s", zprop, newval) 49 | dmd.Devices.setZenProperty(zprop, newval) 50 | 51 | for deviceclass, zprops in remove_local_copy_if_default.iteritems(): 52 | try: 53 | dc = dmd.Devices.getObjByPath(deviceclass) 54 | except KeyError: 55 | continue 56 | 57 | for zprop in zprops: 58 | if dc.hasProperty(zprop) and dc.getZ(zprop) == dmd.Devices.getZ(zprop): 59 | log.info("Removing redundant default value for %s", zprop) 60 | dc._delProperty(zprop) 61 | 62 | DefaultZProps() 63 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/migrate/DefaultZProps.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2016-2017, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | 11 | import logging 12 | log = logging.getLogger("zen.migrate") 13 | 14 | import Globals 15 | from Products.ZenModel.migrate.Migrate import Version 16 | from Products.ZenModel.ZenPack import ZenPackMigration 17 | from Products.ZenUtils.Utils import unused 18 | unused(Globals) 19 | 20 | # in previous versions of the zenpack, these zproperties had their defaults 21 | # explicitly set at the device class level, rather than as global defaults. 22 | # 23 | # this would cause any changes to these values at the device class level to be 24 | # overwritten when the zenpack was upgraded. 25 | 26 | 27 | class DefaultZProps(ZenPackMigration): 28 | version = Version(2, 4, 0) 29 | 30 | def migrate(self, pack): 31 | dmd = pack.dmd 32 | 33 | set_default_if_none = { 34 | 'zOpenStackNeutronConfigDir': '/etc/neutron', 35 | 'zOpenStackAMQPUsername': 'openstack' 36 | } 37 | 38 | remove_local_copy_if_default = { 39 | 'Server/SSH/Linux/NovaHost': [ 40 | 'zOpenStackRunNovaManageInContainer', 41 | 'zOpenStackRunVirshQemuInContainer', 42 | 'zOpenStackRunNeutronCommonInContainer' 43 | ] 44 | } 45 | 46 | for zprop, newval in set_default_if_none.iteritems(): 47 | if dmd.Devices.hasProperty(zprop): 48 | if dmd.Devices.getZ(zprop) == '': 49 | log.info("Setting default of %s to %s", zprop, newval) 50 | dmd.Devices.setZenProperty(zprop, newval) 51 | 52 | for deviceclass, zprops in remove_local_copy_if_default.iteritems(): 53 | try: 54 | dc = dmd.Devices.getObjByPath(deviceclass) 55 | except KeyError: 56 | continue 57 | 58 | for zprop in zprops: 59 | if dc.hasProperty(zprop) and dc.getZ(zprop) == dmd.Devices.getZ(zprop): 60 | log.info("Removing redundant default value for %s", zprop) 61 | dc._delProperty(zprop) 62 | 63 | DefaultZProps() 64 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/service_definition/-CONFIGS-/opt/zenoss/bin/proxy-zenopenstack: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . /opt/zenoss/etc/proxy-zenopenstack-env 4 | ZPROXY_HOME=/opt/zenoss/zproxy 5 | 6 | CERT_FILE=/home/zenoss/.zenopenstack-certs/${COLLECTOR_LOCATION}_nginx.crt 7 | KEY_FILE=/home/zenoss/.zenopenstack-certs/${COLLECTOR_LOCATION}_nginx.key 8 | 9 | new_self_signed_cert() { 10 | if -f $CERT_FILE; 11 | then 12 | mv $CERT_FILE $CERT_FILE.bak 13 | mv $KEY_FILE $KEY_FILE.bak 14 | fi 15 | 16 | openssl req -nodes -x509 -newkey rsa:2048 -keyout ${KEY_FILE} -out ${CERT_FILE} -days 1000 -subj "/C=US/ST=Texas/L=Austin/O=Zenoss" 17 | } 18 | 19 | verify_cert() { 20 | if [ ! -f /home/zenoss/.zenopenstack-certs/${COLLECTOR_LOCATION}_nginx.key ]; 21 | then 22 | # generate a self-signed cert 23 | new_self_signed_cert 24 | fi 25 | 26 | if ! openssl x509 -checkend 86400 -noout -in /home/zenoss/.zenopenstack-certs/${COLLECTOR_LOCATION}_nginx.crt; 27 | then 28 | # certificate has expired, or will in the next 24 hours, so generate a new one. 29 | new_self_signed_cert 30 | fi 31 | } 32 | 33 | verify_cert_loop() { 34 | while true; do 35 | # check the cert for expiration once a day. 36 | verify_cert 37 | sleep 86400 38 | done 39 | } 40 | 41 | rotate_logs() { 42 | while true; do 43 | if [ -s ${ZPROXY_HOME}/logs/access.log ]; then 44 | if [ $(du -m ${ZPROXY_HOME}/logs/access.log | cut -f 1) -ge 30 ]; then 45 | mv ${ZPROXY_HOME}/logs/access.log ${ZPROXY_HOME}/logs/access.log.0 46 | kill -USR1 $(cat ${ZPROXY_HOME}/logs/nginx.pid) 47 | fi 48 | fi 49 | sleep 3600 50 | done 51 | } 52 | 53 | 54 | update_upstreams() { 55 | while true; do 56 | ${ZPROXY_HOME}/scripts/update_upstreams 8242 /opt/zenoss/etc/zenopenstack-upstreams.conf 57 | if [ $? -eq 2 ]; then 58 | echo "$(date) Reloading nginx config due to upstream Zope servers change" 59 | LD_LIBRARY_PATH=${ZPROXY_HOME}/lib ${ZPROXY_HOME}/sbin/nginx -s reload -c /opt/zenoss/etc/proxy-zenopenstack.conf 60 | fi 61 | sleep 30 62 | done 63 | } 64 | 65 | # mkdir -p /var/run 66 | 67 | # Update the certificate and upstream configuration once 68 | verify_cert 69 | ${ZPROXY_HOME}/scripts/update_upstreams 8242 /opt/zenoss/etc/zenopenstack-upstreams.conf 70 | 71 | # And start background loops to keep them up to date. 72 | rotate_logs & 73 | update_upstreams & 74 | verify_cert_loop & 75 | 76 | LD_LIBRARY_PATH=${ZPROXY_HOME}/lib ${ZPROXY_HOME}/sbin/nginx -c /opt/zenoss/etc/proxy-zenopenstack.conf 77 | 78 | # clean up the background jobs 79 | kill %1 %2 %3 80 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/Hypervisor.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2013-2014, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | 11 | from . import schema 12 | 13 | import logging 14 | log = logging.getLogger('zen.OpenStackInfrastructureHypervisor') 15 | 16 | from Products.AdvancedQuery import Eq, Or 17 | 18 | 19 | class Hypervisor(schema.Hypervisor): 20 | 21 | def get_faceting_relnames(self): 22 | return ['host'] 23 | 24 | def get_hostByName(self): 25 | if self.host() and self.hostfqdn: 26 | return self.hostfqdn 27 | 28 | return None 29 | 30 | def set_hostByName(self, name): 31 | if not name: 32 | log.warning("Could not set host. Given name is None") 33 | return 34 | 35 | query = Or(Eq('hostname', name), Eq('hostfqdn', name)) 36 | hosts = self.search('Host', query) 37 | if len(hosts) > 0: 38 | if len(hosts) > 1: 39 | log.warning( 40 | "Got more than one host for hypervisor: " + 41 | "%s with id: %s" % (self.title, self.id)) 42 | 43 | try: 44 | host = hosts[0].getObject() 45 | except Exception: 46 | # ignore a stale entry 47 | pass 48 | else: 49 | log.info("Set host by fqdn: %s" % name) 50 | self.set_host(host.id) 51 | self.hostfqdn = name 52 | elif name.find('.') > -1: 53 | name = name[:name.index('.')] 54 | query = Or(Eq('hostname', name), Eq('hostfqdn', name)) 55 | hosts = self.search('Host', query) 56 | if len(hosts) > 0: 57 | if len(hosts) > 1: 58 | log.warning( 59 | "Got more than one host for hypervisor: " + 60 | "%s with id: %s" (self.title, self.id)) 61 | 62 | try: 63 | host = hosts[0].getObject() 64 | except Exception: 65 | # ignore a stale entry 66 | pass 67 | else: 68 | log.info("Set host by hostname: %s" % name) 69 | self.set_host(host.id) 70 | self.hostfqdn = name 71 | else: 72 | log.error("%s: Could not set hypervisor host by name (%s)", self.id, name) 73 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/lib/progresslog.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2014, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | """Periodic progress logging for long-running operations. 11 | 12 | Example usage: 13 | 14 | import logging 15 | LOG = logging.getLogger(__name__) 16 | 17 | import time 18 | import progresslog 19 | 20 | mylist = range(100) 21 | 22 | progress = ProgressLogger( 23 | LOG, 24 | prefix="progress", 25 | total=len(mylist), 26 | interval=1) 27 | 28 | for i in mylist: 29 | progress.increment() 30 | time.sleep(0.2) 31 | 32 | """ 33 | 34 | import datetime 35 | import logging 36 | 37 | 38 | class ProgressLogger(object): 39 | 40 | """Periodic progress logging for long-running operations.""" 41 | 42 | def __init__( 43 | self, 44 | logger, 45 | level=logging.INFO, 46 | prefix='', 47 | total=None, 48 | interval=60): 49 | 50 | self.logger = logger 51 | self.level = level 52 | self.prefix = prefix 53 | self.total = total 54 | self.interval = datetime.timedelta(seconds=interval) 55 | 56 | self.pos = 0 57 | self.start_time = datetime.datetime.now() 58 | self.last_time = self.start_time 59 | 60 | def increment(self, by=1): 61 | """Increment internal position and emit progress log if needed.""" 62 | self.pos += by 63 | 64 | now = datetime.datetime.now() 65 | if now - self.last_time >= self.interval: 66 | self.last_time = now 67 | 68 | progress = '{} of {}'.format( 69 | self.pos, 70 | self.total if self.total else '?') 71 | 72 | elapsed = now - self.start_time 73 | 74 | if self.total: 75 | per = elapsed / self.pos 76 | remaining = per * (self.total - self.pos) 77 | 78 | msg = '{}, elapsed={}, remaining={}'.format( 79 | progress, 80 | str(elapsed).split('.', 1)[0], 81 | str(remaining).split('.', 1)[0]) 82 | else: 83 | msg = '{}, elapsed={}'.format( 84 | progress, 85 | str(elapsed).split('.', 1)[0]) 86 | 87 | if self.prefix: 88 | msg = '{}: {}'.format(self.prefix, msg) 89 | 90 | self.logger.log(self.level, msg) 91 | -------------------------------------------------------------------------------- /impact.yuml: -------------------------------------------------------------------------------- 1 | // OpenStackInfrastructure Internal Impacts 2 | [note: OpenStackInfrastructure;ZenPack{bg:aquamarine}]-[NovaEndpoint{bg:aquamarine}] 3 | [note: OpenStackInfrastructure;ZenPack{bg:aquamarine}]-[NeutronAgent{bg:tan}] 4 | [note: OpenStackInfrastructure;ZenPack{bg:aquamarine}]-[CinderService{bg:orange}] 5 | [NovaEndpoint{bg:aquamarine}]1-*>[Host{bg:aquamarine}] 6 | 7 | [Host{bg:aquamarine}]*-1>[AvailabilityZone{bg:aquamarine}] 8 | [Host{bg:aquamarine}]*-1>[Cell{bg:aquamarine}] 9 | [Cell{bg:aquamarine}]*-1>[Cell{bg:aquamarine}] 10 | [Cell{bg:aquamarine}]*-1>[AvailabilityZone{bg:aquamarine}] 11 | [AvailabilityZone{bg:aquamarine}]*-1>[Region{bg:aquamarine}] 12 | 13 | [Host{bg:aquamarine}]1-*>[Hypervisor{bg:aquamarine}] 14 | [Hypervisor{bg:aquamarine}]1-*>[Instance{bg:aquamarine}] 15 | [Vnic{bg:aquamarine}]1-*>[Instance{bg:aquamarine}] 16 | [Instance{bg:aquamarine}]1-*>[Tenant{bg:aquamarine}] 17 | [Instance{bg:aquamarine}]1-*>[GuestDevice{bg:purple}] 18 | 19 | [Host{bg:aquamarine}]1-*>[NovaService{bg:aquamarine}] 20 | [Host{bg:aquamarine}]1-*>[NovaApi{bg:aquamarine}] 21 | [NovaService{bg:aquamarine}]1-*>[AvailabilityZone{bg:aquamarine}] 22 | [NovaAPI{bg:aquamarine}]1-*>[Region{bg:aquamarine}] 23 | 24 | # // [Vnic{bg:tan}]1-*>[Port{bg:tan}] 25 | [Host{bg:tan}]1-*>[NeutronAgent{bg:tan}] 26 | [Host{bg:tan}]1-*>[CinderService{bg:orange}] 27 | [NeutronAgent{bg:tan}]*-*>[Network{bg:tan}] 28 | [NeutronAgent{bg:tan}]*-*>[Router{bg:tan}] 29 | [NeutronAgent{bg:tan}]*-*>[Subnet{bg:tan}] 30 | [Network{bg:tan}]*-*>[Subnet{bg:tan}] 31 | [Router{bg:tan}]*-*>[Subnet{bg:tan}] 32 | [Subnet{bg:tan}]*-*>[Port{bg:tan}] 33 | [Subnet{bg:tan}]*-1>[Tenant{bg:tan}] 34 | [Network{bg:tan}]*-1>[Tenant{bg:tan}] 35 | // To Instance Relations 36 | # // [Vnic{bg:aquamarine}]1-*>[Instance{bg:aquamarine}] 37 | [Port{bg:tan}]1-1>[Instance{bg:tan}] 38 | [Router{bg:tan}]1-1>[FloatingIp{bg:tan}] 39 | [FloatingIp{bg:tan}]1-1>[Port{bg:tan}] 40 | // 41 | // Platform Impacts 42 | # // [note: Platform{bg:deepskyblue}]-[Guest;Device{bg:deepskyblue}] 43 | # // [Instance{bg:aquamarine}]1-1>[Guest;Device{bg:deepskyblue}] 44 | 45 | # //[note: Platform{bg:deepskyblue}]-[Linux;Device{bg:deepskyblue}] 46 | [Linux;Device{bg:deepskyblue}]1-1>[Host{bg:aquamarine}] 47 | [Linux;Device{bg:deepskyblue}]1-*>[OSProcess{bg:deepskyblue}] 48 | [OSProcess{bg:deepskyblue}]*-1>[NovaService{bg:aquamarine}] 49 | [OSProcess{bg:deepskyblue}]*-1>[NovaApi{bg:aquamarine}] 50 | [OSProcess{bg:deepskyblue}]*-1>[CinderService{bg:orange}] 51 | 52 | // 53 | // CiscoUCS Impacts 54 | # // [note: Cisco UCS;ZenPack{bg:darkslateblue}]-[UCS Service Profile{bg:darkslateblue}] 55 | [UCS Service Profile{bg:darkslateblue}]1-*>[Linux;Device{bg:deepskyblue}] 56 | 57 | # Cinder 58 | [Volume{bg:orange}]*-1>[Tenant{bg:orange}] 59 | [Instance{bg:orange}]<1-*[Volume{bg:orange}] 60 | [Volume{bg:orange}]<1-*[Snapshot{bg:orange}] 61 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/tests/test_apiclients.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | ########################################################################### 4 | # 5 | # This program is part of Zenoss Core, an open source monitoring platform. 6 | # Copyright (C) 2020, Zenoss Inc. 7 | # 8 | # This program is free software; you can redistribute it and/or modify it 9 | # under the terms of the GNU General Public License version 2 or (at your 10 | # option) any later version as published by the Free Software Foundation. 11 | # 12 | # For complete information please visit: http://www.zenoss.com/oss/ 13 | # 14 | ########################################################################### 15 | 16 | from mock import Mock 17 | 18 | from twisted.internet.defer import inlineCallbacks 19 | 20 | from Products.ZenTestCase.BaseTestCase import BaseTestCase 21 | 22 | from ZenPacks.zenoss.OpenStackInfrastructure.tests.utils import setup_crochet 23 | from ZenPacks.zenoss.OpenStackInfrastructure.apiclients.base import BaseClient 24 | from ZenPacks.zenoss.OpenStackInfrastructure.apiclients.session import base_url 25 | 26 | crochet = setup_crochet() 27 | 28 | 29 | class TestApiClients(BaseTestCase): 30 | 31 | def test_base_url_strip(self): 32 | url = base_url('http://www.test.com/') 33 | self.assertEquals(url, 'http://www.test.com') 34 | 35 | def test_base_url_no_change(self): 36 | url = base_url('http://www.test.com') 37 | self.assertEquals(url, 'http://www.test.com') 38 | 39 | def test_base_url_none(self): 40 | url = base_url(None) 41 | self.assertEquals(url, None) 42 | 43 | @crochet.wait_for(timeout=5) 44 | @inlineCallbacks 45 | def test_base_client_without_url(self): 46 | session_manager = Mock() 47 | session_manager.get_service_url.return_value = None 48 | base_client = BaseClient(session_manager=session_manager) 49 | result = yield base_client.get_json('http://www.test.com') 50 | self.assertEquals(result, {}) 51 | 52 | @crochet.wait_for(timeout=5) 53 | @inlineCallbacks 54 | def test_base_client_valid_url(self): 55 | session_manager = Mock() 56 | session_manager.get_service_url.return_value = 'test' 57 | session_manager.authenticated_GET_request.return_value = ('{"key":["value"]}', None) 58 | base_client = BaseClient(session_manager=session_manager) 59 | result = yield base_client.get_json('http://www.test.com') 60 | self.assertEquals(result, {u'key': [u'value']}) 61 | 62 | 63 | def test_suite(): 64 | from unittest import TestSuite, makeSuite 65 | suite = TestSuite() 66 | suite.addTest(makeSuite(TestApiClients)) 67 | return suite 68 | 69 | 70 | if __name__ == "__main__": 71 | from zope.testrunner.runner import Runner 72 | runner = Runner(found_suites=[test_suite()]) 73 | runner.run() 74 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/tests/data/model/pickle_to_json.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | ############################################################################## 4 | # 5 | # Copyright (C) Zenoss, Inc. 2018, all rights reserved. 6 | # 7 | # This content is made available according to terms specified in 8 | # License.zenoss under the directory where your Zenoss product is installed. 9 | # 10 | ############################################################################## 11 | 12 | # Convert a pickle file from zenmodeler --save_raw_results into a 13 | # json format suitable for our unit tests. 14 | 15 | import json 16 | import pickle 17 | import re 18 | import sys 19 | 20 | import Globals 21 | from ZenPacks.zenoss.OpenStackInfrastructure.hostmap import HostMap 22 | from ZenPacks.zenoss.OpenStackInfrastructure.tests.utils import next_ip_address 23 | 24 | if len(sys.argv) != 2: 25 | raise Exception("Usage: %s " % sys.argv[0]) 26 | 27 | with open(sys.argv[1], 'r') as f: 28 | data = pickle.load(f) 29 | 30 | if type(data.get('hostmap')) == HostMap: 31 | data['hostmap_mappings'] = data['hostmap'].freeze_mappings() 32 | data['hostmap_dns'] = data['hostmap'].resolved_hostnames 33 | del data['hostmap'] 34 | 35 | else: 36 | # Older versions of the modeler both didn't pickle the hostmap 37 | # object and also replaced the host references with host IDs. 38 | # 39 | # This means that we can't fully reverse engineer hostmap_mappings 40 | # and hostmap_dns from what we have available. 41 | # 42 | # We can approximate it though, by assigning an arbitrary IP to every 43 | # host ID we see, and reversing out a host reference (name). 44 | # This is sufficient for writing basic unit tests. 45 | 46 | # Find all the host IDs: 47 | hostids = set() 48 | 49 | for service in data['services']: 50 | if 'host' in service: 51 | hostids.add(service['host']) 52 | 53 | for agent in data['agents']: 54 | if 'host' in agent: 55 | hostids.add(agent['host']) 56 | 57 | for service in data['cinder_services']: 58 | if 'host' in service: 59 | hostids.add(service['host']) 60 | 61 | for host in data['zOpenStackNovaApiHosts'] + data['zOpenStackExtraHosts'] + [data['nova_url_host']] + [data['cinder_url_host']]: 62 | hostids.add(host) 63 | 64 | data['hostmap_mappings'] = {} 65 | data['hostmap_dns'] = {} 66 | for hostid in hostids: 67 | if hostid is None: 68 | continue 69 | 70 | # make up a hostname based on the hostref. This is definitely 71 | # not necessarily correct in all cases, but it should be sufficient. 72 | hostref = re.sub(r'^host-', '', hostid) 73 | data['hostmap_mappings'][hostref] = hostid 74 | data['hostmap_dns'][hostref] = next_ip_address() 75 | 76 | print json.dumps(data, indent=4) 77 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/modeler/plugins/zenoss/cmd/linux/openstack/hostfqdn.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2014-2018, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | 14 | """ Get OpenStack host FQDN """ 15 | 16 | from Products.DataCollector.plugins.DataMaps import ObjectMap 17 | 18 | from Products.DataCollector.plugins.CollectorPlugin import CommandPlugin 19 | from ZenPacks.zenoss.OpenStackInfrastructure.utils import add_local_lib_path 20 | add_local_lib_path() 21 | 22 | import re 23 | 24 | import logging 25 | LOG = logging.getLogger('zen.OpenStack.hostfqdn') 26 | 27 | 28 | def command_from_commands(*commands): 29 | """Return a single command given an iterable of commands. 30 | 31 | The results of each command will be separated by __SPLIT__, and the 32 | results will contain only the commands' stdout. 33 | 34 | """ 35 | return " ; echo __SPLIT__ ; ".join("{} 2>/dev/null".format(c) for c in commands) 36 | 37 | 38 | def results_from_result(result): 39 | """Return results split into a list of per-command output.""" 40 | try: 41 | return [r.strip() for r in result.split("__SPLIT__")] 42 | except Exception: 43 | return [] 44 | 45 | 46 | class hostfqdn(CommandPlugin): 47 | 48 | command = command_from_commands( 49 | "/bin/hostname", 50 | "/bin/hostname -f", 51 | "/bin/dnsdomainname" 52 | ) 53 | 54 | def process(self, device, results, log): 55 | log.info("Modeler %s processing data for device %s", 56 | self.name(), device.id) 57 | 58 | results = results_from_result(results) 59 | 60 | if len(results) != 3: 61 | LOG.error("Unable to process results. Expected 3 results, but got %d (%s)", len(results), results) 62 | return [] 63 | 64 | hostname, hostname_f, dnsdomainname = results 65 | 66 | # the FQDN could be either "hostname -f", or "hostname" + "dnsdomainname" 67 | fqdn = hostname_f 68 | if "." not in hostname and len(dnsdomainname) > 0: 69 | merged_fqdn = hostname + '.' + dnsdomainname 70 | else: 71 | merged_fqdn = "" 72 | 73 | # pick the longer of the two 74 | if len(merged_fqdn) > len(fqdn): 75 | fqdn = merged_fqdn 76 | 77 | hostfqdn_om = ObjectMap({ 78 | 'hostfqdn': fqdn, 79 | 'hostlocalname': hostname 80 | }) 81 | 82 | LOG.info("Hostname: %s (%s)", hostname, fqdn) 83 | 84 | return [ObjectMap({ 85 | 'setApplyDataMapToOpenStackInfrastructureHost': hostfqdn_om 86 | })] 87 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/datasources/PerfAMQPDataSource.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2014-2024, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | from zope.component import adapts 10 | from zope.interface import implements 11 | 12 | from Products.Zuul.form import schema 13 | from Products.Zuul.infos import ProxyProperty 14 | from Products.Zuul.utils import ZuulMessageFactory as _t 15 | 16 | from ZenPacks.zenoss.PythonCollector.datasources.PythonDataSource import ( 17 | PythonDataSource, PythonDataSourcePlugin ) 18 | 19 | from Products.Zuul.infos.template import RRDDataSourceInfo 20 | from Products.Zuul.interfaces import IRRDDataSourceInfo 21 | 22 | 23 | class PerfAMQPDataSource(PythonDataSource): 24 | ''' 25 | Datasource used to capture data and events shipped to us from OpenStack 26 | Ceilometer via AMQP. 27 | ''' 28 | 29 | ZENPACKID = 'ZenPacks.zenoss.OpenStackInfrastructure.' 30 | 31 | sourcetypes = ('OpenStack Ceilometer Perf AMQP',) 32 | sourcetype = sourcetypes[0] 33 | 34 | # RRDDataSource 35 | component = '${here/id}' 36 | cycletime = 300 37 | 38 | # PythonDataSource 39 | plugin_classname = 'ZenPacks.zenoss.OpenStackInfrastructure.datasources.'\ 40 | 'PerfAMQPDataSource.PerfAMQPDataSourcePlugin' 41 | 42 | # PerfAMQPDataSource 43 | meter = '' 44 | 45 | _properties = PythonDataSource._properties + ( 46 | {'id': 'meter', 'type': 'string'}, 47 | ) 48 | 49 | 50 | class IPerfAMQPDataSourceInfo(IRRDDataSourceInfo): 51 | ''' 52 | API Info interface for IPerfAMQPDataSource. 53 | ''' 54 | 55 | meter = schema.TextLine( 56 | group=_t('OpenStack Ceilometer'), 57 | title=_t('meter Name')) 58 | 59 | cycletime = schema.TextLine( 60 | group=_t('OpenStack Ceilometer'), 61 | title=_t('Cycletime') 62 | ) 63 | 64 | class PerfAMQPDataSourceInfo(RRDDataSourceInfo): 65 | ''' 66 | API Info adapter factory for PerfAMQPDataSource. 67 | ''' 68 | 69 | implements(IPerfAMQPDataSourceInfo) 70 | adapts(PerfAMQPDataSource) 71 | 72 | cycletime = ProxyProperty('cycletime') 73 | 74 | testable = False 75 | 76 | meter = ProxyProperty('meter') 77 | 78 | 79 | class PerfAMQPDataSourcePlugin(PythonDataSourcePlugin): 80 | """ 81 | Deprecated. Needed to avoid errors in the log until zenopenstack migrates to its custom datasources. 82 | """ 83 | proxy_attributes = ('resourceId') 84 | queue_name = "$OpenStackInboundPerf" 85 | failure_eventClassKey = 'PerfFailure' 86 | 87 | @classmethod 88 | def params(cls, datasource, context): 89 | return { 90 | 'meter': datasource.talesEval(datasource.meter, context), 91 | 'resourceId': context.resourceId, 92 | 'component_meta_type': context.meta_type 93 | } 94 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # These variables are overwritten by Zenoss when the ZenPack is exported 2 | # or saved. Do not modify them directly here. 3 | # NB: PACKAGES is deprecated 4 | NAME = "ZenPacks.zenoss.OpenStackInfrastructure" 5 | VERSION = "4.1.0" 6 | AUTHOR = "Zenoss" 7 | LICENSE = "GPLv2" 8 | NAMESPACE_PACKAGES = [u'ZenPacks', u'ZenPacks.zenoss'] 9 | PACKAGES = [u'ZenPacks', u'ZenPacks.zenoss', u'ZenPacks.zenoss.OpenStackInfrastructure'] 10 | INSTALL_REQUIRES = ['ZenPacks.zenoss.ZenPackLib>=2.1.0', 'ZenPacks.zenoss.PythonCollector>=1.6.1', 'ZenPacks.zenoss.OpenStack>=1.2.3'] 11 | COMPAT_ZENOSS_VERS = ">=6.3.2" 12 | PREV_ZENPACK_NAME = "" 13 | # STOP_REPLACEMENTS 14 | # Zenoss will not overwrite any changes you make below here. 15 | 16 | from setuptools import setup, find_packages 17 | 18 | # make build 19 | import subprocess 20 | p = subprocess.Popen('make build', shell=True) 21 | 22 | if p.poll() is None: 23 | p.wait() 24 | if p.returncode != 0: 25 | raise Exception('make exited with an error: %s' % p.returncode) 26 | 27 | setup( 28 | # This ZenPack metadata should usually be edited with the Zenoss 29 | # ZenPack edit page. Whenever the edit page is submitted it will 30 | # overwrite the values below (the ones it knows about) with new values. 31 | name=NAME, 32 | version=VERSION, 33 | author=AUTHOR, 34 | license=LICENSE, 35 | 36 | # This is the version spec which indicates what versions of Zenoss 37 | # this ZenPack is compatible with 38 | compatZenossVers=COMPAT_ZENOSS_VERS, 39 | 40 | # previousZenPackName is a facility for telling Zenoss that the name 41 | # of this ZenPack has changed. If no ZenPack with the current name is 42 | # installed then a zenpack of this name if installed will be upgraded. 43 | prevZenPackName=PREV_ZENPACK_NAME, 44 | 45 | # Indicate to setuptools which namespace packages the zenpack 46 | # participates in 47 | namespace_packages=NAMESPACE_PACKAGES, 48 | 49 | # Tell setuptools what packages this zenpack provides. 50 | packages=find_packages(), 51 | 52 | # Tell setuptools to figure out for itself which files to include 53 | # in the binary egg when it is built. 54 | include_package_data=True, 55 | 56 | # Tell setuptools what non-python files should also be included 57 | # with the binary egg. 58 | package_data={ 59 | '': ['*.txt'], 60 | }, 61 | 62 | # Indicate dependencies on other python modules or ZenPacks. This line 63 | # is modified by zenoss when the ZenPack edit page is submitted. Zenoss 64 | # tries to put add/delete the names it manages at the beginning of this 65 | # list, so any manual additions should be added to the end. Things will 66 | # go poorly if this line is broken into multiple lines or modified to 67 | # dramatically. 68 | install_requires=INSTALL_REQUIRES, 69 | 70 | # Every ZenPack egg must define exactly one zenoss.zenpacks entry point 71 | # of this form. 72 | entry_points={ 73 | 'zenoss.zenpacks': '%s = %s' % (NAME, NAME), 74 | }, 75 | 76 | # All ZenPack eggs must be installed in unzipped form. 77 | zip_safe=False, 78 | ) 79 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/migrate/RebuildTenantRelations.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2012-2016, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | import logging 11 | LOG = logging.getLogger('zen.OpenStackInfrastructure.migrate.%s' % __name__) 12 | 13 | # Zope Imports 14 | import Globals 15 | from Acquisition import aq_base 16 | 17 | # Zenoss Imports 18 | from Products.ZenModel.migrate.Migrate import Version 19 | from Products.ZenModel.ZenPack import ZenPackMigration 20 | from Products.ZenRelations.RelationshipBase import RelationshipBase 21 | from Products.ZenUtils.Utils import unused 22 | from Products.Zuul.interfaces import ICatalogTool 23 | 24 | # ZenPack Imports 25 | from ZenPacks.zenoss.OpenStackInfrastructure.Tenant import Tenant 26 | from ZenPacks.zenoss.OpenStackInfrastructure.lib.progresslog import ProgressLogger 27 | 28 | unused(Globals) 29 | 30 | # If the migration takes longer than this interval, a running progress 31 | # showing elapsed and estimated remaining time will be logged this 32 | # often. The value is in seconds. 33 | PROGRESS_LOG_INTERVAL = 10 34 | 35 | 36 | class RebuildTenantRelations(ZenPackMigration): 37 | 38 | """Rebuilds relations on all Tenant objects. 39 | 40 | This is necessary anytime new relations are added to Tenant. 41 | The code is generic enough to work simply by updating the version 42 | at which the migrate script should run. Update the version anytime 43 | you add a new relationship to Tenant. No other changes to this 44 | script are necessary. 45 | 46 | """ 47 | 48 | version = Version(2, 2, 0) 49 | 50 | def migrate(self, pack): 51 | results = ICatalogTool(pack.dmd.Devices).search(Tenant) 52 | 53 | LOG.info("starting: %s total devices", results.total) 54 | progress = ProgressLogger( 55 | LOG, 56 | prefix="progress", 57 | total=results.total, 58 | interval=PROGRESS_LOG_INTERVAL) 59 | 60 | objects_migrated = 0 61 | 62 | for brain in results: 63 | try: 64 | if self.updateRelations(brain.getObject()): 65 | objects_migrated += 1 66 | except Exception: 67 | LOG.exception( 68 | "error updating relationships for %s", 69 | brain.id) 70 | 71 | progress.increment() 72 | 73 | LOG.info( 74 | "finished: %s of %s devices required migration", 75 | objects_migrated, 76 | results.total) 77 | 78 | def updateRelations(self, device): 79 | for relname in (x[0] for x in Tenant._relations): 80 | rel = getattr(aq_base(device), relname, None) 81 | if not rel or not isinstance(rel, RelationshipBase): 82 | device.buildRelations() 83 | return True 84 | 85 | return False 86 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/migrate/RebuildInstanceRelations.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2012-2016, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | import logging 11 | LOG = logging.getLogger('zen.OpenStackInfrastructure.migrate.%s' % __name__) 12 | 13 | # Zope Imports 14 | import Globals 15 | from Acquisition import aq_base 16 | 17 | # Zenoss Imports 18 | from Products.ZenModel.migrate.Migrate import Version 19 | from Products.ZenModel.ZenPack import ZenPackMigration 20 | from Products.ZenRelations.RelationshipBase import RelationshipBase 21 | from Products.ZenUtils.Utils import unused 22 | from Products.Zuul.interfaces import ICatalogTool 23 | 24 | # ZenPack Imports 25 | from ZenPacks.zenoss.OpenStackInfrastructure.Instance import Instance 26 | from ZenPacks.zenoss.OpenStackInfrastructure.lib.progresslog import ProgressLogger 27 | 28 | unused(Globals) 29 | 30 | # If the migration takes longer than this interval, a running progress 31 | # showing elapsed and estimated remaining time will be logged this 32 | # often. The value is in seconds. 33 | PROGRESS_LOG_INTERVAL = 10 34 | 35 | 36 | class RebuildInstanceRelations(ZenPackMigration): 37 | 38 | """Rebuilds relations on all Instance objects. 39 | 40 | This is necessary anytime new relations are added to Instance. 41 | The code is generic enough to work simply by updating the version 42 | at which the migrate script should run. Update the version anytime 43 | you add a new relationship to Instance. No other changes to this 44 | script are necessary. 45 | 46 | """ 47 | 48 | version = Version(2, 2, 0) 49 | 50 | def migrate(self, pack): 51 | results = ICatalogTool(pack.dmd.Devices).search(Instance) 52 | 53 | LOG.info("starting: %s total devices", results.total) 54 | progress = ProgressLogger( 55 | LOG, 56 | prefix="progress", 57 | total=results.total, 58 | interval=PROGRESS_LOG_INTERVAL) 59 | 60 | objects_migrated = 0 61 | 62 | for brain in results: 63 | try: 64 | if self.updateRelations(brain.getObject()): 65 | objects_migrated += 1 66 | except Exception: 67 | LOG.exception( 68 | "error updating relationships for %s", 69 | brain.id) 70 | 71 | progress.increment() 72 | 73 | LOG.info( 74 | "finished: %s of %s devices required migration", 75 | objects_migrated, 76 | results.total) 77 | 78 | def updateRelations(self, device): 79 | for relname in (x[0] for x in Instance._relations): 80 | rel = getattr(aq_base(device), relname, None) 81 | if not rel or not isinstance(rel, RelationshipBase): 82 | device.buildRelations() 83 | return True 84 | 85 | return False 86 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/service_migration.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2016-2019, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | import logging 11 | log = logging.getLogger("zen.migrate") 12 | 13 | from ZenPacks.zenoss.OpenStackInfrastructure.utils import zenpack_path 14 | 15 | try: 16 | import servicemigration as sm 17 | sm.require("1.0.0") 18 | VERSION5 = True 19 | except ImportError: 20 | VERSION5 = False 21 | 22 | import copy 23 | import os 24 | 25 | 26 | def force_update_configs(zenpack, service_name, config_filenames): 27 | # update the specified config filenames to match those provided in the 28 | # zenpack. Any local changes to them will be overwritten. 29 | 30 | if not VERSION5: 31 | return 32 | 33 | try: 34 | ctx = sm.ServiceContext() 35 | except sm.ServiceMigrationError: 36 | log.info("Couldn't generate service context, skipping.") 37 | return 38 | 39 | for svc in ctx.services: 40 | if svc.name != service_name: 41 | continue 42 | 43 | for cfile in svc.configFiles: 44 | if cfile.filename.lstrip('/') in config_filenames: 45 | with open(os.path.join(zenpack.path('service_definition/-CONFIGS-/'), cfile.filename.lstrip('/'))) as f: 46 | content = f.read() 47 | 48 | if cfile.content != content: 49 | log.info("Updating %s", cfile.filename) 50 | cfile.content = content 51 | 52 | ctx.commit() 53 | 54 | 55 | def remove_migrate_zenpython(): 56 | if not VERSION5: 57 | return 58 | 59 | try: 60 | ctx = sm.ServiceContext() 61 | except sm.ServiceMigrationError: 62 | log.info("Couldn't generate service context, skipping.") 63 | return 64 | 65 | commit = False 66 | zpythons = filter(lambda s: s.name == "zenpython", ctx.services) 67 | log.info("Found %i services named 'zenpython'" % len(zpythons)) 68 | for zpython in zpythons: 69 | rbtamqp_imports = filter(lambda ep: ep.name == "rabbitmqs_ceil" and ep.purpose == "import_all", zpython.endpoints) 70 | if len(rbtamqp_imports) > 0: 71 | zpython.endpoints = filter(lambda ep: not (ep.name == "rabbitmqs_ceil" and ep.purpose == "import_all"), zpython.endpoints) 72 | commit = True 73 | log.info("Removing the rabbitmqs_ceil import endpoint from service '%s'." % ctx.getServicePath(zpython)) 74 | rbtmgmt_imports = filter(lambda ep: ep.name == "rabbitmqadmins_ceil" and ep.purpose == "import_all", zpython.endpoints) 75 | if len(rbtmgmt_imports) > 0: 76 | zpython.endpoints = filter(lambda ep: not (ep.name == "rabbitmqadmins_ceil" and ep.purpose == "import_all"), zpython.endpoints) 77 | commit = True 78 | log.info("Removing the rabbitmqadmins_ceil import endpoint from service '%s'." % ctx.getServicePath(zpython)) 79 | if commit: 80 | ctx.commit() 81 | -------------------------------------------------------------------------------- /event_definitions/README.txt: -------------------------------------------------------------------------------- 1 | Ceilometer Event Definitions for Zenoss 2 | --------------------------------------- 3 | 4 | Zenoss maintains its model using zenmodeler to do a complete poll of the 5 | target openstack environment (every 12 hours by default). 6 | 7 | Because openstack is fairly dynamic, with new instances being created, destroyed, 8 | and their states changed, the zenpack also uses events generated by OpenStack's 9 | ceilometer to update its model in between polling cycles. This allows 10 | the zenoss model to be kept current in near real-time. 11 | 12 | Each ceilometer event contains a number of properties about the object 13 | the event is describing. The set of properties included in an event 14 | are referred to as the event's traits. 15 | 16 | For example, an event about an instance being created might include its 17 | name, the host it is being created upon, how much memory is allocated to it, 18 | etc. These traits are used to set the corresponding properties in the zenoss 19 | model. 20 | 21 | The set of traits included in each property are defined in openstack's 22 | /etc/ceilometer/event_definitions.yaml file. 23 | 24 | It is recommended to add the contents of the file 'zenoss_additions.yaml' to 25 | the end of your event_definitions.yaml if possible, as this will ensure that 26 | all events include the traits that zenoss needs. 27 | 28 | While the default file included in openstack is sufficient for basic model updates, it lacks some event traits that the zenpack would normally be 29 | able to take advantage of. If the event_defintions.yaml file is left in its 30 | default state, you can expect the following issues: 31 | 32 | * All Supported Openstack Versions 33 | 34 | The events related to networking objects are very minimal by default. 35 | These properties and relationships can not be updated from them, and will 36 | be left blank until the next modeling cycle: 37 | 38 | FloatingIp: 39 | Properties: Attached IP, Floating IP, Status 40 | Relationships: Network, Port and Router 41 | Network: 42 | Properties: Name, Admin State, Type, Net External, Status 43 | Relationships: Floating IP, Port, Router 44 | Port: 45 | Properties: Name, Admin State, Type, MAC, Status, Fixed IPs 46 | Relationships: Floating IP, Instance, Network 47 | Router: 48 | Properties: Name, Admin State, Routes, Status 49 | Relationships: Floating IP, Network, Subnet 50 | Subnet: 51 | Properties: Name, CIDR, Gateway, DNS Nameservers 52 | Relationships: Router, Network 53 | 54 | For objects where the name attribute is not available, the name will be set to the object's ID until the next modeling cycle. 55 | 56 | 57 | * OpenStack Queens (Red Hat OSP 13) 58 | 59 | Newly created or attached volumes will not be linked to the appropriate 60 | instances in Zenoss until the next modeling cycle. 61 | 62 | The 'size' property of snapshots will not update until the next modeling cycle. 63 | 64 | 65 | * OpenStack Pike (Red Hat OSP 12) 66 | 67 | In events and the model, the instances will not have their proper names. 68 | The ID of the instance will be shown instead, until the next 69 | modeling cycle, which will populate the names. 70 | 71 | Newly created or attached volumes will not be linked to the appropriate 72 | instances in Zenoss until the next modeling cycle. 73 | 74 | The 'size' property of snapshots will not update until the next modeling 75 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/objects/objects.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | http://www.openstack.org/ 7 | 8 | 9 | 10 | 11 | [] 12 | 13 | 14 | 15 | 16 | Havana (2013.2) 17 | 18 | 19 | ['2013.2.1', '2013.2.2', '2013.2.3', '2013.2.4', '2013.2.5', '2013.2.6', '2013.2.7', '2013.2.8', '2013.2.9', '2013.2.10'] 20 | 21 | 22 | True 23 | 24 | 25 | 26 | 27 | Icehouse (2014.1) 28 | 29 | 30 | ['2014.1.1', '2014.1.2', '2014.1.3', '2014.1.4', '2014.1.5', '2014.1.6', '2014.1.7', '2014.1.8', '2014.1.9', '2014.1.10'] 31 | 32 | 33 | True 34 | 35 | 36 | 37 | 38 | Juno (2014.2) 39 | 40 | 41 | ['2014.2.1', '2014.2.2', '2014.2.3', '2014.2.4', '2014.2.5', '2014.2.6', '2014.2.7', '2014.2.8', '2014.2.9', '2014.2.10'] 42 | 43 | 44 | True 45 | 46 | 47 | 48 | 49 | Kilo (2015.1) 50 | 51 | 52 | ['2015.1.1', '2015.1.2', '2015.1.3', '2015.1.4', '2015.1.5', '2015.1.6', '2015.1.7', '2015.1.8', '2015.1.9', '2015.1.10'] 53 | 54 | 55 | True 56 | 57 | 58 | 59 | 60 | Liberty (2015.2) 61 | 62 | 63 | ['Liberty', '2015.2.1', '2015.2.2', '2015.2.3', '2015.2.4', '2015.2.5', '2015.2.6', '2015.2.7', '2015.2.8', '2015.2.9', '2015.2.10'] 64 | 65 | 66 | True 67 | 68 | 69 | 70 | 71 | Mitaka (2016.1) 72 | 73 | 74 | ['Mitaka', '2016.1.1', '2016.1.2', '2016.1.3', '2016.1.4', '2016.1.5', '2016.1.6', '2016.1.7', '2016.1.8', '2016.1.9', '2016.1.10'] 75 | 76 | 77 | True 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/migrate/RebuildRouterPortRelations.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2012-2016, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | import logging 11 | LOG = logging.getLogger('zen.OpenStackInfrastructure.migrate.%s' % __name__) 12 | 13 | # Zope Imports 14 | import Globals 15 | from Acquisition import aq_base 16 | 17 | # Zenoss Imports 18 | from Products.ZenModel.migrate.Migrate import Version 19 | from Products.ZenModel.ZenPack import ZenPackMigration 20 | from Products.ZenRelations.RelationshipBase import RelationshipBase 21 | from Products.ZenUtils.Utils import unused 22 | from Products.Zuul.interfaces import ICatalogTool 23 | 24 | # ZenPack Imports 25 | from ZenPacks.zenoss.OpenStackInfrastructure.Router import Router 26 | from ZenPacks.zenoss.OpenStackInfrastructure.Port import Port 27 | from ZenPacks.zenoss.OpenStackInfrastructure.lib.progresslog import ProgressLogger 28 | 29 | unused(Globals) 30 | 31 | # If the migration takes longer than this interval, a running progress 32 | # showing elapsed and estimated remaining time will be logged this 33 | # often. The value is in seconds. 34 | PROGRESS_LOG_INTERVAL = 10 35 | 36 | 37 | class RebuildRouterPortRelations(ZenPackMigration): 38 | 39 | """Rebuilds relations on all Router and Port objects. 40 | 41 | This is necessary anytime new relations are added to Tenant. 42 | The code is generic enough to work simply by updating the version 43 | at which the migrate script should run. Update the version anytime 44 | you add a new relationship to Tenant. No other changes to this 45 | script are necessary. 46 | 47 | """ 48 | 49 | version = Version(2, 2, 0) 50 | 51 | def migrate(self, pack): 52 | results = ICatalogTool(pack.dmd.Devices).search((Router, Port)) 53 | 54 | LOG.info("starting: %s total devices", results.total) 55 | progress = ProgressLogger( 56 | LOG, 57 | prefix="progress", 58 | total=results.total, 59 | interval=PROGRESS_LOG_INTERVAL) 60 | 61 | objects_migrated = 0 62 | 63 | for brain in results: 64 | try: 65 | if self.updateRelations(brain.getObject()): 66 | objects_migrated += 1 67 | except Exception: 68 | LOG.exception( 69 | "error updating relationships for %s", 70 | brain.id) 71 | 72 | progress.increment() 73 | 74 | LOG.info( 75 | "finished: %s of %s devices required migration", 76 | objects_migrated, 77 | results.total) 78 | 79 | def updateRelations(self, device): 80 | relations = None 81 | if isinstance(device, Port): 82 | relations = Port._relations 83 | elif isinstance(device, Router): 84 | relations = Router._relations 85 | for relname in (x[0] for x in relations): 86 | rel = getattr(aq_base(device), relname, None) 87 | if not rel or not isinstance(rel, RelationshipBase): 88 | device.buildRelations() 89 | return True 90 | 91 | return False 92 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/callhome.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2015, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | # Logging 11 | import logging 12 | LOG = logging.getLogger('zen.OpenStackInfrastructureCallhome') 13 | 14 | # Zope Imports 15 | from zope.interface import implements 16 | 17 | # Zenoss Imports 18 | from Products.ZenCallHome import IDeviceResource 19 | 20 | # ZenPack Imports 21 | from .Host import Host 22 | from .Hypervisor import Hypervisor 23 | from .Instance import Instance 24 | from .Router import Router 25 | from .Network import Network 26 | from .Volume import Volume 27 | 28 | # Exports 29 | __all__ = [ 30 | 'OSI_HOSTS', 31 | 'OSI_HYPERVISORS', 32 | 'OSI_INSTANCES', 33 | 'OSI_ROUTERS', 34 | 'OSI_NETWORKS', 35 | 'OSI_VOLUMES', 36 | 'OSIResource', 37 | ] 38 | 39 | # Constants 40 | OSI_HOSTS = 'OpenStack Infrastructure Host Count' 41 | OSI_HYPERVISORS = 'OpenStack Infrastructure Hypervisor Count' 42 | OSI_INSTANCES = 'OpenStack Infrastructure Instance Count' 43 | OSI_ROUTERS = 'OpenStack Infrastructure Router Count' 44 | OSI_NETWORKS = 'OpenStack Infrastructure Network Count' 45 | OSI_VOLUMES = 'OpenStack Infrastructure Volume Count' 46 | 47 | 48 | class OSIResource(object): 49 | 50 | """IDeviceResource subscriber for OpenStackInfrastructure.""" 51 | 52 | implements(IDeviceResource) 53 | 54 | def __init__(self, device): 55 | """Initialize OpenStackInfrastructure DeviceResource subscriber.""" 56 | self.device = device 57 | 58 | def processDevice(self, context=None): 59 | """Add OpenStackInfrastructure counters to context. 60 | 61 | Consider the following counters: 62 | 63 | * OpenStackInfrastructureController Host Count 64 | * OpenStackInfrastructure Hypervisor Count 65 | * OpenStackInfrastructure Instance Count 66 | * OpenStackInfrastructure Router Count 67 | * OpenStackInfrastructure Network Count 68 | * OpenStackInfrastructure Volume Count 69 | 70 | """ 71 | counter_keys = ( 72 | OSI_HOSTS, 73 | OSI_HYPERVISORS, 74 | OSI_INSTANCES, 75 | OSI_ROUTERS, 76 | OSI_NETWORKS, 77 | OSI_VOLUMES 78 | ) 79 | 80 | # Initialize counters if needed. 81 | for counter_key in counter_keys: 82 | if counter_key not in context: 83 | LOG.debug("initializing %r counter", counter_key) 84 | context[counter_key] = 0 85 | 86 | hosts = self.device.componentSearch(meta_type=Host.meta_type) 87 | context[OSI_HOSTS] += len(hosts) 88 | hypervisors = self.device.componentSearch(meta_type=Hypervisor.meta_type) 89 | context[OSI_HYPERVISORS] += len(hypervisors) 90 | instances = self.device.componentSearch(meta_type=Instance.meta_type) 91 | context[OSI_INSTANCES] += len(instances) 92 | routers = self.device.componentSearch(meta_type=Router.meta_type) 93 | context[OSI_ROUTERS] += len(routers) 94 | networks = self.device.componentSearch(meta_type=Network.meta_type) 95 | context[OSI_NETWORKS] += len(networks) 96 | volumes = self.device.componentSearch(meta_type=Volume.meta_type) 97 | context[OSI_VOLUMES] += len(volumes) 98 | -------------------------------------------------------------------------------- /vagrant/rdo-pike/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | yum install -y emacs wget telnet 4 | 5 | yum install -y centos-release-openstack-pike 6 | yum update -y 7 | yum install -y openstack-packstack openstack-utils 8 | 9 | systemctl disable firewalld 10 | systemctl stop firewalld 11 | systemctl disable NetworkManager 12 | systemctl stop NetworkManager 13 | systemctl enable network 14 | systemctl start network 15 | 16 | yum install -y qemu-kvm sys libguestfs-tools e2fsprogs 17 | 18 | sudo packstack --allinone --os-ceilometer-install=y --os-swift-install=n --os-nova-install=y 19 | 20 | # Fix libvirt hypervisor so it can run nested under virtualbox. 21 | echo "options kvm-intel nested=y" | sudo tee /etc/modprobe.d/kvm-intel.conf 22 | openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu 23 | 24 | # Enable compute.instance.update events 25 | openstack-config --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_state 26 | 27 | 28 | # bounce most of nova/neutron to pick up those config file changes 29 | for e in openstack-nova-api openstack-nova-compute openstack-nova-conductor openstack-nova-scheduler; do /bin/systemctl restart $e; done 30 | for e in neutron-dhcp-agent neutron-l3-agent neutron-metadata-agent neutron-openvswitch-agent neutron-server; do /bin/systemctl restart $e; done 31 | 32 | /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management 33 | /bin/systemctl restart rabbitmq-server 34 | # (http://:15672/ - log in as guest/guest) 35 | 36 | # When using openvpn, it can picks up a bogus domain name that keeps horizon's 37 | # vhost form working. 38 | perl -p -i -e 's/\.openvpn//g' /etc/httpd/conf.d/15-horizon_vhost.conf /etc/openstack-dashboard/local_settings 39 | /bin/systemctl restart httpd 40 | 41 | # Install zenoss plugin (provides dispatcher_zenoss) 42 | sudo yum install -y python-pip 43 | sudo pip -q install --force-reinstall https://github.com/zenoss/ceilometer_zenoss/archive/master.zip 44 | 45 | # Configure ceilometer 46 | sudo cp /usr/lib/python2.7/site-packages/ceilometer_zenoss/event_definitions.yaml /etc/ceilometer/ 47 | openstack-config --set /etc/ceilometer/ceilometer.conf notification store_events True 48 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT verbose False 49 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT debug True 50 | 51 | perl -p -i -e 's|- gnocchi://|- http://192.168.2.2:8242/ceilometer/v1/samples/rdo-pike|g' /etc/ceilometer/pipeline.yaml 52 | perl -p -i -e 's|- gnocchi://|- http://192.168.2.2:8242/ceilometer/v1/events/rdo-pike|g' /etc/ceilometer/event_pipeline.yaml 53 | 54 | # bounce ceilometer. 55 | systemctl restart openstack-ceilometer-central openstack-ceilometer-notification 56 | 57 | # Fix keystone endpoints to use the externally accessible IP: 58 | perl -p -i -e 's/10.0.2.15/192.168.2.15/g' /root/keystonerc_admin 59 | . /root/keystonerc_admin 60 | openstack endpoint list -f value -c ID -c URL | perl -ne 'chomp; ($id, $url) = split / /; $url =~ s/10\.0\.2\.15/192\.168\.2\.15/g; print "openstack endpoint set --url \"$url\" $id\n";' | sh -x 61 | 62 | 63 | # Create a zenoss user so that zenoss can monitor this host as well. 64 | adduser zenoss -p '$6$GBeC9/Vf$0/6klsM6XThSI/nXvZTwsn1ESPjKjSbmlXj1Okh1i2CVTCknekldztlvhAF5ki85a94FejZ1cliKd30Met0BT/' 65 | 66 | # Increase MaxSessions for sshd: 67 | perl -p -i -e 's/#MaxSessions 10/MaxSessions 100/g' /etc/ssh/sshd_config 68 | /bin/systemctl restart sshd 69 | 70 | # set up the vagrant user with the right openstack environment so you can just 71 | # log in and run the openstack commandline tools. 72 | cp /root/keystonerc_admin /home/vagrant/keystonerc_admin 73 | chown vagrant /home/vagrant/keystonerc_admin 74 | echo ". /home/vagrant/keystonerc_admin" >> /home/vagrant/.bashrc 75 | 76 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/apiclients/utils.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2017, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | 14 | # Note: because this file is included (indirectly) by openstack_helper.py, 15 | # which does not 'import Globals' for performance reasons, we can not 16 | # depend on any platform or zenpack modules here. 17 | 18 | from twisted.internet import reactor, defer, error 19 | from twisted.python import failure 20 | from twisted.web._newclient import ResponseNeverReceived 21 | 22 | import logging 23 | LOG = logging.getLogger('zen.OpenStack.apiclient.utils') 24 | 25 | SEMAPHORES = {} 26 | ZP_VERSION = [] 27 | 28 | 29 | def zenpack_version(): 30 | if not ZP_VERSION: 31 | import pkg_resources 32 | working_set = pkg_resources.WorkingSet() 33 | requirement = pkg_resources.Requirement.parse('ZenPacks.zenoss.OpenStackInfrastructure') 34 | ZP_VERSION.append(working_set.find(requirement).version) 35 | return ZP_VERSION[0] 36 | 37 | 38 | def add_timeout(deferred, seconds, exception_class=error.TimeoutError): 39 | """Return new Deferred that will errback exception_class after seconds.""" 40 | deferred_with_timeout = defer.Deferred() 41 | 42 | def fire_timeout(): 43 | deferred.cancel() 44 | 45 | if not deferred_with_timeout.called: 46 | deferred_with_timeout.errback(exception_class()) 47 | 48 | delayed_timeout = reactor.callLater(seconds, fire_timeout) 49 | 50 | def handle_result(result): 51 | is_failure = isinstance(result, failure.Failure) 52 | is_cancelled = is_failure and isinstance(result.value, defer.CancelledError) 53 | 54 | # With twisted.web._newclient, errors may be wrapped in a 55 | # 'ResponseNeverReceived', including CancelledError. If it is, 56 | # set is_cancelled. 57 | if is_failure and isinstance(result.value, ResponseNeverReceived): 58 | if any([isinstance(x, failure.Failure) and isinstance(x.value, defer.CancelledError) 59 | for x in result.value.reasons]): 60 | is_cancelled = True 61 | 62 | if delayed_timeout.active(): 63 | # Cancel the timeout since a result came before it fired. 64 | delayed_timeout.cancel() 65 | elif is_cancelled: 66 | # Don't propagate cancellations that we caused. 67 | return 68 | 69 | # Propagate remaining results. 70 | if is_failure: 71 | deferred_with_timeout.errback(result) 72 | else: 73 | deferred_with_timeout.callback(result) 74 | 75 | deferred.addBoth(handle_result) 76 | 77 | return deferred_with_timeout 78 | 79 | 80 | def getDeferredSemaphore(key, limit): 81 | if key not in SEMAPHORES: 82 | SEMAPHORES[key] = defer.DeferredSemaphore(limit) 83 | semaphore = SEMAPHORES[key] 84 | 85 | if semaphore.limit != limit: 86 | if limit >= semaphore.tokens: 87 | semaphore.limit = limit 88 | LOG.info("Unable to lower maximum parallel query limit for %s to %d ", key, limit) 89 | else: 90 | LOG.warning("Unable to lower maximum parallel query limit for %s to %d at this time (%d connections currently active)", key, limit, semaphore.tokens) 91 | 92 | return semaphore 93 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/libexec/openstack_helper.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ########################################################################### 3 | # 4 | # This program is part of Zenoss Core, an open source monitoring platform. 5 | # Copyright (C) 2011, Zenoss Inc. 6 | # 7 | # This program is free software; you can redistribute it and/or modify it 8 | # under the terms of the GNU General Public License version 2 or (at your 9 | # option) any later version as published by the Free Software Foundation. 10 | # 11 | # For complete information please visit: http://www.zenoss.com/oss/ 12 | # 13 | ########################################################################### 14 | 15 | import json 16 | import sys 17 | import logging 18 | logging.basicConfig(level=logging.ERROR) 19 | log = logging.getLogger('openstackHelper') 20 | 21 | from optparse import OptionParser 22 | from twisted.internet.defer import inlineCallbacks, returnValue 23 | 24 | from ZenPacks.zenoss.OpenStackInfrastructure.apiclients.session import SessionManager 25 | 26 | 27 | class OpenstackHelper(object): 28 | 29 | @inlineCallbacks 30 | def getRegions(self, username, api_key, project_id, user_domain_name, project_domain_name, auth_url): 31 | """Get a list of available regions, given a keystone endpoint and credentials.""" 32 | 33 | sm = SessionManager( 34 | username=username, 35 | password=api_key, 36 | project_id=project_id, 37 | user_domain_name=user_domain_name, 38 | project_domain_name=project_domain_name, 39 | auth_url=auth_url, 40 | ) 41 | 42 | regions = yield sm.get_regions() 43 | 44 | returnValue([{'key': c, 'label': c} for c in sorted(regions)]) 45 | 46 | 47 | if __name__ == '__main__': 48 | from twisted.internet import reactor 49 | OpenstackHelper.exitValue = 0 50 | 51 | try: 52 | methodname = sys.argv.pop(1) 53 | except Exception: 54 | pass 55 | 56 | supported_methods = { 57 | 'getRegions': ('username', 'api_key', 'project_id', 'user_domain_name', 'project_domain_name', 'auth_url',), 58 | } 59 | 60 | if methodname in supported_methods: 61 | required_opts = supported_methods[methodname] 62 | parser = OptionParser(usage="usage: %%prog %s [options]" % methodname) 63 | for opt in required_opts: 64 | parser.add_option("--" + opt, dest=opt) 65 | (options, args) = parser.parse_args() 66 | 67 | for required_opt in required_opts: 68 | if getattr(options, required_opt) is None: 69 | parser.print_help() 70 | parser.error("Option '--%s' is required." % required_opt) 71 | 72 | helper = OpenstackHelper() 73 | method = getattr(helper, methodname) 74 | kwargs = {} 75 | for opt in required_opts: 76 | kwargs[opt] = getattr(options, opt) 77 | 78 | def success(result): 79 | print json.dumps(result) 80 | if reactor.running: 81 | reactor.stop() 82 | 83 | def failure(failure): 84 | OpenstackHelper.exitValue = 1 85 | log.error(failure) 86 | error = "%s: %s" % (failure.value.__class__.__name__, str(failure.value)) 87 | print json.dumps({'error': error}) 88 | if reactor.running: 89 | reactor.stop() 90 | 91 | # invoke the method with the supplied arguments 92 | d = method(**kwargs) 93 | d.addCallback(success) 94 | d.addErrback(failure) 95 | reactor.run() 96 | 97 | sys.exit(OpenstackHelper.exitValue) 98 | 99 | else: 100 | print >> sys.stderr, "Usage: %s (%s) [options]" % ( 101 | sys.argv[0], 102 | '|'.join(sorted(supported_methods.keys())) 103 | ) 104 | sys.exit(1) 105 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/apiclients/base.py: -------------------------------------------------------------------------------- 1 | ########################################################################### 2 | # 3 | # This program is part of Zenoss Core, an open source monitoring platform. 4 | # Copyright (C) 2017, Zenoss Inc. 5 | # 6 | # This program is free software; you can redistribute it and/or modify it 7 | # under the terms of the GNU General Public License version 2 or (at your 8 | # option) any later version as published by the Free Software Foundation. 9 | # 10 | # For complete information please visit: http://www.zenoss.com/oss/ 11 | # 12 | ########################################################################### 13 | 14 | import logging 15 | log = logging.getLogger('zen.OpenStack.txapiclient') 16 | 17 | from .session import SessionManager 18 | from .exceptions import APIClientError 19 | 20 | from twisted.internet.defer import inlineCallbacks, returnValue 21 | 22 | import json 23 | 24 | 25 | class BaseClient(object): 26 | session_manager = None 27 | keystone_service_type = None # override in subclasses 28 | 29 | def __init__(self, username=None, password=None, auth_url=None, project_id=None, user_domain_name=None, project_domain_name=None, region_name=None, session_manager=None): 30 | if session_manager: 31 | self.session_manager = session_manager 32 | else: 33 | self.session_manager = SessionManager(username, password, auth_url, project_id, user_domain_name, project_domain_name, region_name) 34 | 35 | @inlineCallbacks 36 | def get_url(self, interface="public"): 37 | base_url = yield self.session_manager.get_service_url(self.keystone_service_type, interface) 38 | returnValue(base_url) 39 | 40 | @inlineCallbacks 41 | def get_json(self, url_path, interface="public", **kwargs): 42 | """ 43 | Any list operation can potentially return a collection, where pages 44 | of results are linked by next/previous links. If found, we will 45 | follow the 'next' links, building up a merged result, and 46 | then return the whole thing. 47 | """ 48 | result = {} 49 | base_url = yield self.session_manager.get_service_url(self.keystone_service_type, interface) 50 | if not base_url: 51 | returnValue(result) 52 | 53 | full_url = base_url + url_path 54 | 55 | while True: 56 | body, headers = yield self.session_manager.authenticated_GET_request(full_url, params=kwargs) 57 | # will raise an exception if there was an error, so we can assume 58 | # that the result is normal json. 59 | 60 | try: 61 | data = json.loads(body) 62 | except ValueError: 63 | raise APIClientError("Unable to parse JSON response from %s: %s" % (full_url, body)) 64 | 65 | full_url = None 66 | for key in data.keys(): 67 | if key != 'links': 68 | if isinstance(data[key], list): 69 | result.setdefault(key, []) 70 | result[key].extend(data[key]) 71 | elif key in result: 72 | log.error("While parsing response to %s, ignoring overwritten key in subsequent page: %s (%s -> %s)", 73 | full_url, key, result[key], data[key]) 74 | else: 75 | result[key] = data[key] 76 | 77 | if '_links' in key: 78 | for link in data[key]: 79 | if link['rel'] == 'next': 80 | full_url = str(link['href']) 81 | 82 | if full_url is None: 83 | break 84 | 85 | returnValue(result) 86 | 87 | 88 | def api(url_path): 89 | 90 | @inlineCallbacks 91 | def api_caller(self, **kwargs): 92 | result = yield self.get_json(url_path, **kwargs) 93 | returnValue(result) 94 | 95 | return api_caller 96 | 97 | -------------------------------------------------------------------------------- /vagrant/rdo-queens/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | yum install -y emacs wget telnet 4 | sudo yum install -y qemu-kvm sys libguestfs-tools e2fsprogs 5 | 6 | sudo yum install -y centos-release-openstack-queens 7 | sudo yum update -y 8 | sudo yum install -y openstack-packstack openstack-utils 9 | 10 | sudo systemctl disable firewalld 11 | sudo systemctl stop firewalld 12 | sudo systemctl disable NetworkManager 13 | sudo systemctl stop NetworkManager 14 | sudo systemctl enable network 15 | sudo systemctl start network 16 | 17 | #sudo packstack --allinone 18 | sudo packstack --allinone --os-ceilometer-install=y 19 | #sudo packstack --allinone --os-ceilometer-install=y --os-controller-host=192.168.2.15 --os-compute-hosts=192.168.2.15 --os-network-hosts=192.168.2.15 --vcenter-host=192.168.2.15 --amqp-host=192.168.2.15 --mariadb-host=192.168.2.15 --mongodb-host=192.168.2.15 --novanetwork-pubif=eth1 --novanetwork-fixed-range=192.168.32.0/22 --novanetwork-floating-range=10.3.4.0/22 --os-neutron-ml2-type-drivers=local --os-neutron-ml2-tenant-network-types=local --os-neutron-ml2-mechanism-drivers=openvswitch --use-epel=y 20 | 21 | # Fix libvirt hypervisor so it can run nested under virtualbox. 22 | echo "options kvm-intel nested=y" | sudo tee /etc/modprobe.d/kvm-intel.conf 23 | openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu 24 | 25 | # Enable compute.instance.update events 26 | openstack-config --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_state 27 | 28 | 29 | # bounce most of nova/neutron to pick up those config file changes 30 | for e in openstack-nova-api openstack-nova-compute openstack-nova-conductor openstack-nova-scheduler; do /bin/systemctl restart $e; done 31 | for e in neutron-dhcp-agent neutron-l3-agent neutron-metadata-agent neutron-openvswitch-agent neutron-server; do /bin/systemctl restart $e; done 32 | 33 | /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management 34 | /bin/systemctl restart rabbitmq-server 35 | # (http://:15672/ - log in as guest/guest) 36 | 37 | # When using openvpn, it can picks up a bogus domain name that keeps horizon's 38 | # vhost form working. 39 | perl -p -i -e 's/\.openvpn//g' /etc/httpd/conf.d/15-horizon_vhost.conf /etc/openstack-dashboard/local_settings 40 | /bin/systemctl restart httpd 41 | 42 | # Install zenoss plugin (provides dispatcher_zenoss) 43 | sudo yum install -y python-pip 44 | sudo pip -q install --force-reinstall https://github.com/zenoss/ceilometer_zenoss/archive/master.zip 45 | 46 | # Configure ceilometer 47 | sudo cp /usr/lib/python2.7/site-packages/ceilometer_zenoss/event_definitions.yaml /etc/ceilometer/ 48 | openstack-config --set /etc/ceilometer/ceilometer.conf notification store_events True 49 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT verbose False 50 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT debug True 51 | 52 | perl -p -i -e 's|- gnocchi://|- http://192.168.2.2:8242/ceilometer/v1/samples/rdo-queens|g' /etc/ceilometer/pipeline.yaml 53 | perl -p -i -e 's|- gnocchi://|- http://192.168.2.2:8242/ceilometer/v1/events/rdo-queens|g' /etc/ceilometer/event_pipeline.yaml 54 | 55 | # bounce ceilometer. 56 | systemctl restart openstack-ceilometer-central openstack-ceilometer-notification 57 | 58 | # Fix keystone endpoints to use the externally accessible IP: 59 | . /root/keystonerc_admin 60 | openstack endpoint list -f value -c ID -c URL | perl -ne 'chomp; ($id, $url) = split / /; $url =~ s/10\.0\.2\.15/192\.168\.2\.15/g; print "openstack endpoint set --url \"$url\" $id\n";' | sh -x 61 | 62 | 63 | # Create a zenoss user so that zenoss can monitor this host as well. 64 | adduser zenoss -p '$6$GBeC9/Vf$0/6klsM6XThSI/nXvZTwsn1ESPjKjSbmlXj1Okh1i2CVTCknekldztlvhAF5ki85a94FejZ1cliKd30Met0BT/' 65 | 66 | # Increase MaxSessions for sshd: 67 | perl -p -i -e 's/#MaxSessions 10/MaxSessions 100/g' /etc/ssh/sshd_config 68 | /bin/systemctl restart sshd 69 | 70 | # set up the vagrant user with the right openstack environment so you can just 71 | # log in and run the openstack commandline tools. 72 | cp /root/keystonerc_admin /home/vagrant/keystonerc_admin 73 | chown vagrant /home/vagrant/keystonerc_admin 74 | echo ". /home/vagrant/keystonerc_admin" >> /home/vagrant/.bashrc 75 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/service_definition/proxy-zenopenstack.json: -------------------------------------------------------------------------------- 1 | { 2 | "servicePath": "/hub/collector", 3 | "serviceDefinition": { 4 | "Name": "proxy-zenopenstack", 5 | "Description": "zenopenstack proxy. Supplies SSL and allows more than one instance of zenopenstack to be started.", 6 | "Command": "/opt/zenoss/bin/proxy-zenopenstack", 7 | "Endpoints": [ 8 | { 9 | "Name": "proxy-zenopenstack_https", 10 | "Application": "zenopenstack_{{(parent .).Name}}-proxy_https", 11 | "PortNumber": 8342, 12 | "Protocol": "tcp", 13 | "Purpose": "export", 14 | "AddressConfig": { 15 | "Port": 8342, 16 | "Protocol": "tcp" 17 | } 18 | }, 19 | { 20 | "Name": "proxy-zenopenstack_http", 21 | "Application": "zenopenstack_{{(parent .).Name}}-proxy_http", 22 | "PortNumber": 8340, 23 | "Protocol": "tcp", 24 | "Purpose": "export", 25 | "AddressConfig": { 26 | "Port": 8340, 27 | "Protocol": "tcp" 28 | } 29 | }, 30 | { 31 | "Name": "zenopenstack_http", 32 | "Application": "zenopenstack_{{(parent .).Name}}_http", 33 | "PortNumber": 8242, 34 | "Protocol": "tcp", 35 | "Purpose": "import_all" 36 | } 37 | ], 38 | "ImageID": "", 39 | "Instances": { 40 | "Min": 1, 41 | "Max": 1 42 | }, 43 | "RAMCommitment": "1G", 44 | "CPUCommitment": 1, 45 | "Launch": "auto", 46 | "LogConfigs": [ 47 | { 48 | "path": "/opt/zenoss/zproxy/logs/access.log", 49 | "type": "zproxy" 50 | }, 51 | { 52 | "path": "/opt/zenoss/zproxy/logs/error.log", 53 | "type": "zproxy" 54 | } 55 | ], 56 | "ConfigFiles": { 57 | "/opt/zenoss/etc/proxy-zenopenstack.conf": { 58 | "####": "Contents will be loaded from ./-CONFIGS-/opt/zenoss/etc/proxy-zenopenstack.conf", 59 | "FileName": "/opt/zenoss/etc/proxy-zenopenstack.conf", 60 | "Owner": "zenoss:zenoss", 61 | "Permissions": "660" 62 | }, 63 | "/opt/zenoss/bin/proxy-zenopenstack": { 64 | "####": "Contents will be loaded from ./-CONFIGS-/opt/zenoss/bin/proxy-zenopenstack", 65 | "FileName": "/opt/zenoss/bin/proxy-zenopenstack", 66 | "Owner": "root:root", 67 | "Permissions": "750" 68 | }, 69 | "%(zenhome)s/etc/proxy-zenopenstack-env": { 70 | "FileName": "/opt/zenoss/etc/proxy-zenopenstack-env", 71 | "Owner": "zenoss:zenoss", 72 | "Content": "# Generated by serviced\nexport COLLECTOR_LOCATION=\"{{(parent .).Name}}\"\n", 73 | "Permissions": "660" 74 | } 75 | }, 76 | "HealthChecks": { 77 | "running": { 78 | "Script": "pgrep -fu root nginx > /dev/null", 79 | "Interval": 5.0 80 | } 81 | }, 82 | "Volumes": [ 83 | { 84 | "Owner": "zenoss:zenoss", 85 | "ContainerPath": "/home/zenoss/.zenopenstack-certs", 86 | "ResourcePath": ".proxy-zenopenstack-certs", 87 | "Permission": "0755" 88 | }, 89 | { 90 | "Owner": "zenoss:zenoss", 91 | "ResourcePath": "var-zenpacks", 92 | "ContainerPath": "/var/zenoss", 93 | "Permission": "0775" 94 | } 95 | ], 96 | "Tags": [ 97 | "daemon", 98 | "collector" 99 | ] 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/reportable.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2014, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | import basereportable 11 | from ZenPacks.zenoss.OpenStackInfrastructure.SoftwareComponent import SoftwareComponent 12 | from Products.Zuul.interfaces import IReportable 13 | from ZenPacks.zenoss.ZenETL.reportable import MARKER_LENGTH, DEFAULT_STRING_LENGTH 14 | 15 | 16 | class BaseReportable(basereportable.BaseReportable): 17 | 18 | @classmethod 19 | def entity_class_for_class(cls, object_class): 20 | entity_class = super(BaseReportable, cls).entity_class_for_class(object_class) 21 | return entity_class.replace("open_stack", "openstack") 22 | 23 | @property 24 | def export_as_bases(self): 25 | bases = super(BaseReportable, self).export_as_bases 26 | 27 | # Anything that is a softwarecomponent subclass, also export 28 | # as a softwarecomponent. 29 | if isinstance(self.context, SoftwareComponent): 30 | bases.append(SoftwareComponent) 31 | 32 | return bases 33 | 34 | 35 | class BaseReportableFactory(basereportable.BaseReportableFactory): 36 | pass 37 | 38 | 39 | class AvailabilityZoneReportable(BaseReportable): 40 | 41 | def reportProperties(self): 42 | # allow table join between avalability zone and region. 43 | for prop in super(AvailabilityZoneReportable, self).reportProperties(): 44 | yield prop 45 | 46 | yield ('openstack_infrastructure_region_key', 47 | 'reference', 48 | IReportable(self.context.device().getDeviceComponents( 49 | type='OpenStackInfrastructureRegion')[0]).sid, 50 | MARKER_LENGTH) 51 | 52 | class HostReportable(BaseReportable): 53 | 54 | # add a reference to the host device, in addition to the normal 55 | # exported references and properties. 56 | def reportProperties(self): 57 | for prop in super(HostReportable, self).reportProperties(): 58 | yield prop 59 | 60 | hostDevice = self.context.proxy_device() 61 | if hostDevice: 62 | yield ('openstack_infrastructure_host_host_device_key', 63 | 'reference', 64 | IReportable(hostDevice).sid, 65 | MARKER_LENGTH) 66 | else: 67 | yield ('openstack_infrastructure_host_host_device_key', 68 | 'reference', 69 | None, 70 | MARKER_LENGTH) 71 | 72 | 73 | class InstanceReportable(BaseReportable): 74 | 75 | # add a reference to the guest device, in addition to the normal 76 | # exported references and properties. 77 | def reportProperties(self): 78 | for prop in super(InstanceReportable, self).reportProperties(): 79 | yield prop 80 | 81 | guestDevice = self.context.guestDevice() 82 | if guestDevice: 83 | yield ('openstack_infrastructure_instance_guest_device_key', 84 | 'reference', 85 | IReportable(guestDevice).sid, 86 | MARKER_LENGTH) 87 | else: 88 | yield ('openstack_infrastructure_instance_guest_device_key', 89 | 'reference', 90 | None, 91 | MARKER_LENGTH) 92 | 93 | 94 | class RegionReportable(BaseReportable): 95 | 96 | def reportProperties(self): 97 | for prop in super(RegionReportable, self).reportProperties(): 98 | yield prop 99 | region = self.context 100 | 101 | yield ('openstack_infrastructure_region_parent_org', 102 | 'string', 103 | str(len(region.parentOrg())) if region.parentOrg() else None, 104 | DEFAULT_STRING_LENGTH) 105 | 106 | yield ('openstack_infrastructure_region_child_orgs', 107 | 'string', 108 | str(len(region.childOrgs())), 109 | DEFAULT_STRING_LENGTH) 110 | -------------------------------------------------------------------------------- /vagrant/rdo-newton/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | yum install -y emacs wget telnet 4 | 5 | 6 | sudo yum install -y centos-release-openstack-newton 7 | sudo yum update -y 8 | sudo yum install -y openstack-packstack openstack-utils 9 | 10 | sudo systemctl disable firewalld 11 | sudo systemctl stop firewalld 12 | sudo systemctl disable NetworkManager 13 | sudo systemctl stop NetworkManager 14 | sudo systemctl enable network 15 | sudo systemctl start network 16 | 17 | #sudo packstack --allinone 18 | sudo packstack --allinone --os-ceilometer-install=y 19 | #sudo packstack --allinone --os-ceilometer-install=y --os-controller-host=192.168.2.15 --os-compute-hosts=192.168.2.15 --os-network-hosts=192.168.2.15 --vcenter-host=192.168.2.15 --amqp-host=192.168.2.15 --mariadb-host=192.168.2.15 --mongodb-host=192.168.2.15 --novanetwork-pubif=eth1 --novanetwork-fixed-range=192.168.32.0/22 --novanetwork-floating-range=10.3.4.0/22 --os-neutron-ml2-type-drivers=local --os-neutron-ml2-tenant-network-types=local --os-neutron-ml2-mechanism-drivers=openvswitch --use-epel=y 20 | 21 | # Fix libvirt hypervisor so it can run nested under virtualbox. 22 | openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu 23 | 24 | # Enable compute.instance.update events 25 | openstack-config --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_state 26 | 27 | 28 | # bounce most of nova/neutron to pick up those config file changes 29 | for e in openstack-nova-api openstack-nova-compute openstack-nova-conductor openstack-nova-scheduler; do /bin/systemctl restart $e; done 30 | for e in neutron-dhcp-agent neutron-l3-agent neutron-metadata-agent neutron-openvswitch-agent neutron-server; do /bin/systemctl restart $e; done 31 | 32 | /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management 33 | /bin/systemctl restart rabbitmq-server 34 | # (http://:15672/ - log in as guest/guest) 35 | 36 | # When using openvpn, it can picks up a bogus domain name that keeps horizon's 37 | # vhost form working. 38 | perl -p -i -e 's/\.openvpn//g' /etc/httpd/conf.d/15-horizon_vhost.conf /etc/openstack-dashboard/local_settings 39 | /bin/systemctl restart httpd 40 | 41 | # Install zenoss plugin (provides dispatcher_zenoss) 42 | sudo yum install -y python-pip 43 | sudo pip -q install --force-reinstall https://github.com/zenoss/ceilometer_zenoss/archive/master.zip 44 | 45 | # Configure ceilometer 46 | sudo cp /usr/lib/python2.7/site-packages/ceilometer_zenoss/event_definitions.yaml /etc/ceilometer/ 47 | openstack-config --set /etc/ceilometer/ceilometer.conf notification store_events True 48 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT verbose False 49 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT debug True 50 | 51 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT meter_dispatchers zenoss 52 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT event_dispatchers zenoss 53 | 54 | # These will need to be tweaked for your specific setup. 55 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss zenoss_device ostack 56 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss amqp_hostname 192.168.2.2 57 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss amqp_port 5672 58 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss amqp_userid zenoss 59 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss amqp_password zenoss 60 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss amqp_virtual_host /zenoss 61 | 62 | # bounce ceilometer. 63 | for e in openstack-ceilometer-api openstack-ceilometer-central openstack-ceilometer-collector openstack-ceilometer-compute openstack-ceilometer-notification; do /bin/systemctl restart $e; done 64 | 65 | # Create a zenoss user so that zenoss can monitor this host as well. 66 | adduser zenoss -p '$6$GBeC9/Vf$0/6klsM6XThSI/nXvZTwsn1ESPjKjSbmlXj1Okh1i2CVTCknekldztlvhAF5ki85a94FejZ1cliKd30Met0BT/' 67 | 68 | # Increase MaxSessions for sshd: 69 | perl -p -i -e 's/#MaxSessions 10/MaxSessions 100/g' /etc/ssh/sshd_config 70 | /bin/systemctl restart sshd 71 | 72 | # set up the vagrant user with the right openstack environment so you can just 73 | # log in and run the openstack commandline tools. 74 | cp /root/keystonerc_admin /home/vagrant/keystonerc_admin 75 | chown vagrant /home/vagrant/keystonerc_admin 76 | echo ". /home/vagrant/keystonerc_admin" >> /home/vagrant/.bashrc 77 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/services/OpenStackConfig.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2018-2019, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | import logging 11 | log = logging.getLogger('zen.OpenStack.services.OpenStackConfig') 12 | 13 | from twisted.spread import pb 14 | 15 | from Products.ZenCollector.services.config import CollectorConfigService 16 | from Products.ZenRRD.zencommand import DataPointConfig 17 | 18 | from ZenPacks.zenoss.OpenStackInfrastructure.Endpoint import Endpoint 19 | from ZenPacks.zenoss.OpenStackInfrastructure.datasources.PerfAMQPDataSource import PerfAMQPDataSource 20 | 21 | 22 | class OpenStackDataSourceConfig(pb.Copyable, pb.RemoteCopy): 23 | device = None 24 | component = None 25 | template = None 26 | datasource = None 27 | points = None 28 | resourceId = None 29 | meter = None 30 | 31 | def __init__(self): 32 | self.points = [] 33 | 34 | 35 | class OpenStackConfig(CollectorConfigService): 36 | 37 | def _filterDevice(self, device): 38 | return ( 39 | isinstance(device, Endpoint) and 40 | CollectorConfigService._filterDevice(self, device) 41 | ) 42 | 43 | def _createDeviceProxy(self, device): 44 | collector = device.getPerformanceServer() 45 | 46 | proxy = CollectorConfigService._createDeviceProxy(self, device) 47 | proxy.datasources = [] 48 | proxy.thresholds = [] 49 | proxy.zOpenStackProcessEventTypes = device.zOpenStackProcessEventTypes 50 | proxy.zOpenStackIncrementalShortLivedSeconds = device.zOpenStackIncrementalShortLivedSeconds 51 | proxy.zOpenStackIncrementalBlackListSeconds = device.zOpenStackIncrementalBlackListSeconds 52 | proxy.zOpenStackIncrementalConsolidateSeconds = device.zOpenStackIncrementalConsolidateSeconds 53 | 54 | for component in device.getMonitoredComponents(): 55 | proxy.datasources += list( 56 | self.component_datasources(component, collector)) 57 | 58 | proxy.thresholds += component.getThresholdInstances( 59 | PerfAMQPDataSource.sourcetype) 60 | 61 | return proxy 62 | 63 | def component_datasources(self, component, collector): 64 | for template in component.getRRDTemplates(): 65 | 66 | # Get all enabled datasources that are PerfAMQPDataSources 67 | datasources = [ 68 | ds for ds in template.getRRDDataSources() 69 | if ds.enabled and isinstance(ds, PerfAMQPDataSource)] 70 | 71 | device = component.device() 72 | 73 | for ds in datasources: 74 | datapoints = [] 75 | 76 | for dp in ds.datapoints(): 77 | dp_config = DataPointConfig() 78 | dp_config.id = dp.id 79 | dp_config.dpName = dp.name() 80 | dp_config.component = component.id 81 | dp_config.rrdPath = '/'.join((component.rrdPath(), dp.name())) 82 | dp_config.rrdType = dp.rrdtype 83 | dp_config.rrdCreateCommand = dp.getRRDCreateCommand(collector) 84 | dp_config.rrdMin = dp.rrdmin 85 | dp_config.rrdMax = dp.rrdmax 86 | 87 | # MetricMixin.getMetricMetadata() added in Zenoss 5. 88 | if hasattr(component, 'getMetricMetadata'): 89 | dp_config.metadata = component.getMetricMetadata() 90 | 91 | datapoints.append(dp_config) 92 | 93 | ds_config = OpenStackDataSourceConfig() 94 | ds_config.device = device.id 95 | ds_config.component = component.id 96 | ds_config.component_meta_type = component.meta_type 97 | ds_config.template = template.id 98 | ds_config.datasource = ds.titleOrId() 99 | ds_config.points = datapoints 100 | ds_config.meter = ds.meter 101 | ds_config.resourceId = component.resourceId 102 | 103 | yield ds_config 104 | -------------------------------------------------------------------------------- /src/txsshclient-1.0.0/sshclient/test/test_timeouts.py: -------------------------------------------------------------------------------- 1 | from test_common import SlowSSHServer, ServerProtocol, ClientProtocol 2 | from test_common import SSHServer 3 | from sshclient import SSHClient 4 | from twisted.trial.unittest import TestCase 5 | from twisted.internet import reactor, defer 6 | import getpass 7 | import logging 8 | #logging.basicConfig(level=logging.DEBUG) 9 | #from twisted.python import log as twistedlog 10 | #observer = twistedlog.PythonLoggingObserver() 11 | #observer.start() 12 | log = logging.getLogger('txsshclient.test_timeouts') 13 | 14 | import tempfile 15 | import os 16 | import shutil 17 | from twisted.internet.error import TimeoutError 18 | 19 | 20 | def touch(path): 21 | with open(path, 'a'): 22 | os.utime(path, None) 23 | 24 | 25 | class IPV4FTPTimeoutTestCase(TestCase): 26 | def setUp(self): 27 | self.hostname = '127.0.0.1' 28 | self.user = getpass.getuser() 29 | self.password = 'dummyTestPassword' 30 | self.server = SlowSSHServer() 31 | self.server.protocol = ServerProtocol 32 | 33 | self.port = reactor.listenTCP(0, self.server, interface=self.hostname) 34 | self.portnum = self.port.getHost().port 35 | 36 | options = {'hostname': self.hostname, 37 | 'port': self.portnum, 38 | 'user': self.user, 39 | 'password': self.password, 40 | 'buffersize': 32768} 41 | 42 | self.client = SSHClient(options) 43 | self.client.protocol = ClientProtocol 44 | self.client.connect() 45 | 46 | def tearDown(self): 47 | # Shut down the server and client 48 | log.debug('tearing down') 49 | port, self.port = self.port, None 50 | client, self.client = self.client, None 51 | server, self.server = self.server, None 52 | 53 | # A Deferred for the server listening port 54 | d = port.stopListening() 55 | 56 | # Tell the client to disconnect and not retry. 57 | client.disconnect() 58 | 59 | return defer.gatherResults([d, 60 | client.onConnectionLost, 61 | server.onConnectionLost]) 62 | 63 | def test_lsdir_timeout_fail(self): 64 | d = self.client.ls('/tmp', timeout=1) 65 | return self.assertFailure(d, TimeoutError) 66 | 67 | @defer.inlineCallbacks 68 | def test_lsdir_timeout_pass(self): 69 | try: 70 | test_file = 'test_ls_dir' 71 | sandbox = tempfile.mkdtemp() 72 | testfile = '/'.join([sandbox, test_file]) 73 | touch(testfile) 74 | d = yield self.client.ls(sandbox, timeout=60) 75 | 76 | self.assertEquals(d[0][0], test_file) 77 | defer.returnValue(d) 78 | finally: 79 | shutil.rmtree(sandbox) 80 | 81 | 82 | class IPV4CommandTimeoutTestCase(TestCase): 83 | def setUp(self): 84 | self.hostname = '127.0.0.1' 85 | self.user = getpass.getuser() 86 | self.password = 'dummyTestPassword' 87 | self.server = SSHServer() 88 | self.server.protocol = ServerProtocol 89 | 90 | self.port = reactor.listenTCP(0, self.server, interface=self.hostname) 91 | self.portnum = self.port.getHost().port 92 | 93 | options = {'hostname': self.hostname, 94 | 'port': self.portnum, 95 | 'user': self.user, 96 | 'password': self.password, 97 | 'buffersize': 32768} 98 | 99 | self.client = SSHClient(options) 100 | self.client.protocol = ClientProtocol 101 | self.client.connect() 102 | 103 | def tearDown(self): 104 | # Shut down the server and client 105 | log.debug('tearing down') 106 | port, self.port = self.port, None 107 | client, self.client = self.client, None 108 | server, self.server = self.server, None 109 | 110 | # A Deferred for the server listening port 111 | d = port.stopListening() 112 | 113 | # Tell the client to disconnect and not retry. 114 | client.disconnect() 115 | 116 | return defer.gatherResults([d, 117 | client.onConnectionLost, 118 | server.onConnectionLost]) 119 | 120 | def test_run_command_timeout_failed(self): 121 | d = self.client.run('sleep 2 && ls', timeout=1) 122 | return self.assertFailure(d, TimeoutError) 123 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/manhole.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2020, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | """Twisted manhole support. 11 | 12 | Allows SSH connections into the running process for troubleshooting purposes. 13 | 14 | """ 15 | 16 | from twisted import cred 17 | from twisted.conch import manhole, manhole_ssh 18 | from twisted.conch.insults import insults 19 | from twisted.conch.ssh.keys import Key 20 | from twisted.internet import reactor 21 | 22 | import logging 23 | import socket 24 | 25 | log = logging.getLogger('zen.manhole') 26 | 27 | MANHOLE_PRIVATE_KEY = """ 28 | -----BEGIN RSA PRIVATE KEY----- 29 | MIIEowIBAAKCAQEA4wso+ziJNL4m/C7ycjpDGVEIcutNdenoCRoUelOjyCXnoBIA 30 | fX61iUy0bNSQElewyQWhKvR/FuvxdzgDeukeNdjZC4ECzcm4SoP3my42Qx0Ye8+n 31 | xhpWMKW5rPGudTNGAJSrayals/Q8DQxWHZnTfH0YaImLnl5OC4CIcKeGh5vpgDyR 32 | 72P4m+dRmocXnH/snyNlGmsOwTBCMiKV8pksxdjwmbxLhFmTCrrx/4IZpMHBB36q 33 | MqGvlVJ5+kkJg+MIOEq4q+UNJnQB4nW+DMTNfuwywV9YWb/wFTy3zCTRB9+NUjZ5 34 | kMhcbeSKCXXCUmdH0zvaOwEVirmcA92+17WvnQIDAQABAoIBACYEkmIuv1rjlGeZ 35 | /OL/uoictwt3N0tNVZtgkJlDNCOppTV6jjZ1ZzSMcZHfrhhEMsgWdzxYIIfYDmDm 36 | Mj78liByJTX17mBDLObdXjLP9CoczyK8TN2xP0l6FrNM7OeXJFuoiWOx3wFZHk0Z 37 | Cbp/LZik4ddvYL+uDueCKFak1rQSKLPaBr3o3znYNyFmMY0w/2WThFIxS0uyt6bw 38 | KrAXpj3F3S7O8WhSr71a4qsUWdT/kHZFo6jMK+0kJvuk+fbO4ByfOoaE3DJgoQP/ 39 | D1cRF7GJfx3HUSU2FfdwUMLEIum0svNFHG3qEgEApbsmDjb5sEH4V4Qkn0WdZCaQ 40 | JQfhGokCgYEA8YhE00M30FUD63miZkEqw8N3i6P7iqgPIb2fA+WcnTcDooDnBU4D 41 | 6MKvuhMvxXr6OVaWjc3b7oUzwpvhdS2RwRZ+/ZpctfmEoeHGztjCUP5tkfvOmX/B 42 | z4kdSjWs6/rNTOy0eeswml10fpHKct0kup9IJbVSCMCyV/k164l11k8CgYEA8KS3 43 | iF3kp32JAQjVsbKc2xHROR0ZTuMx8CC5d3NvR4jzv7wUHU/ySXhFcbr7kxH/w0Yz 44 | 4aTVsYrqgXCCCtkG+wBn3FcEbZaLW/nGyntt9qHHcT8X7qlNUjM8rTNxpn1Jkeeh 45 | FA7iFSIO7+YPxmf3IIy5Td5HoLqd1E1dytBSjFMCgYB+IGnIZI6N1QdR/NeITDl3 46 | tugDXKNrWa1lMi8KiunI00SrpGJ/S6kQ8DFxmrlUh46JSKUf8cMKgDZyRpJqbVxy 47 | lzvDVMtbH6xaGJuHwntebi5rkDHnyGY96N0JtpPROsvggq8QB3f+9BR0T8+HQeH/ 48 | LlQvlMr81RuMgw/cKpEFUwKBgDHv/KYv1eNsCaJNUwstJZ/QcrqHb1kPjK1oHRTM 49 | v6r4oJyJSyNKE91rN/4B73L1qT28s8d/jVjqmv+BeXsGzowH6YWwCRs0wnazvq0G 50 | MCueJuU5Up4URBdqyoymwE7scPf2OVcQP5pjFvZxp5RkvsPicBHYrsSL9XS5GV2d 51 | HYRBAoGBALNkTGTtZG3g5BrJ1cHnaWmstBBRQ+g9ISrdmxgP2qVQGRCl+y2ikPrO 52 | wtDFlhVzud1wOmTWuKCR2wYyUA3SOGk3vnYAqPJV1Bnw4iqsqIFQDxAnnxU2T9Gg 53 | 7Q8KbcSz2ELLqPv/xL9THmq+LUC/SFZ5MXRGOyCzJ8uBEhYjf4UU 54 | -----END RSA PRIVATE KEY----- 55 | """.strip() 56 | 57 | MANHOLE_PUBLIC_KEY = """ 58 | ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDjCyj7OIk0vib8LvJyOkMZUQhy60116egJGhR6U6PIJeegEgB9frWJTLRs1JASV7DJBaEq9H8W6/F3OAN66R412NkLgQLNybhKg/ebLjZDHRh7z6fGGlYwpbms8a51M0YAlKtrJqWz9DwNDFYdmdN8fRhoiYueXk4LgIhwp4aHm+mAPJHvY/ib51Gahxecf+yfI2Uaaw7BMEIyIpXymSzF2PCZvEuEWZMKuvH/ghmkwcEHfqoyoa+VUnn6SQmD4wg4Srir5Q0mdAHidb4MxM1+7DLBX1hZv/AVPLfMJNEH341SNnmQyFxt5IoJdcJSZ0fTO9o7ARWKuZwD3b7Xta+d 59 | """.strip() 60 | 61 | 62 | def get_manhole_port(base_port_number): 63 | """ 64 | Returns an unused port number by starting with base_port_number 65 | and incrementing until an unbound port is found. 66 | """ 67 | 68 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 69 | s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) 70 | 71 | port_number = base_port_number 72 | while True: 73 | try: 74 | s.bind(('', port_number)) 75 | except socket.error: 76 | port_number += 1 77 | continue 78 | 79 | return port_number 80 | 81 | 82 | def setup(port, username, password, namespace=None): 83 | port = get_manhole_port(port) 84 | namespace = namespace or {} 85 | 86 | checker = cred.checkers.InMemoryUsernamePasswordDatabaseDontUse() 87 | checker.addUser(username, password) 88 | 89 | realm = manhole_ssh.TerminalRealm() 90 | realm.chainedProtocolFactory = lambda: insults.ServerProtocol( 91 | manhole.ColoredManhole, namespace) 92 | 93 | portal = cred.portal.Portal(realm) 94 | portal.registerChecker(checker) 95 | 96 | factory = manhole_ssh.ConchFactory(portal) 97 | factory.privateKeys["ssh-rsa"] = Key.fromString(MANHOLE_PRIVATE_KEY) 98 | factory.publicKeys["ssh-rsa"] = Key.fromString(MANHOLE_PUBLIC_KEY) 99 | 100 | log.debug("Starting manhole on port %d", port) 101 | reactor.listenTCP(port, factory) 102 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/cinder_integration.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2015, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | import logging 11 | log = logging.getLogger('zen.OpenStack.cinder_integration') 12 | 13 | from zope.interface import implements 14 | import zope.component 15 | from zope.event import notify 16 | from Products.Zuul.catalog.events import IndexingEvent 17 | 18 | 19 | from .catalogs import get_cinder_implementation_catalog, get_cinder_core_catalog 20 | from .interfaces import ICinderImplementationPlugin, ICinderImplementationComponent 21 | from .CinderIntegrationComponent import all_cinder_core_components 22 | 23 | 24 | # Split a comma-separated list, as returned from an ini file, into a list type. 25 | # This is useful in the ini_process method. 26 | def split_list(s): 27 | if s is None: 28 | return [] 29 | else: 30 | return [y for y in [x.strip() for x in s.split(',')] if len(y)] 31 | 32 | 33 | def reindex_core_components(dmd): 34 | log.info("Reindexing all cinder core components") 35 | for obj in all_cinder_core_components(dmd): 36 | obj.index_object() 37 | notify(IndexingEvent(obj)) 38 | 39 | 40 | def reindex_implementation_components(dmd): 41 | for plugin_name, plugin in zope.component.getUtilitiesFor(ICinderImplementationPlugin): 42 | log.info("Asking implementation plugin %s to reindex its components" % plugin_name) 43 | plugin.reindex_implementation_components(dmd) 44 | 45 | 46 | def index_implementation_object(obj): 47 | catalog = get_cinder_implementation_catalog(obj.dmd) 48 | catalog.catalog_object(obj, obj.getPrimaryId()) 49 | 50 | 51 | def unindex_implementation_object(obj): 52 | catalog = get_cinder_implementation_catalog(obj.dmd) 53 | catalog.uncatalog_object(obj.getPrimaryId()) 54 | 55 | 56 | def get_cinder_components(obj): 57 | """ 58 | Returns the cinder (core) components for an implementation object 59 | """ 60 | 61 | keys = obj.getCinderIntegrationKeys() 62 | if not keys: 63 | return [] 64 | 65 | catalog = get_cinder_core_catalog(obj.dmd) 66 | cinder_components = [] 67 | for brain in catalog(getCinderIntegrationKeys=keys): 68 | try: 69 | obj = brain.getObject() 70 | except Exception: 71 | # ignore a stale entry 72 | pass 73 | else: 74 | cinder_components.append(obj) 75 | return cinder_components 76 | 77 | 78 | # Base class for cinder integration plugins which implement ICinderImplementationPlugin 79 | class BaseCinderImplementationPlugin(object): 80 | implements(ICinderImplementationPlugin) 81 | 82 | @classmethod 83 | def ini_required(cls): 84 | return [] 85 | 86 | @classmethod 87 | def ini_optional(cls): 88 | return [] 89 | 90 | @classmethod 91 | def ini_process(cls, filename, section_name, option_name, value): 92 | return value 93 | 94 | @classmethod 95 | def reindex_cinder_implementation_components(cls): 96 | pass 97 | 98 | def getPoolIntegrationKeys(self, pool): 99 | return [] 100 | 101 | def getVolumeIntegrationKeys(self, volume): 102 | return [] 103 | 104 | def getSnapshotIntegrationKeys(self, snapshot): 105 | return [] 106 | 107 | def getBackupIntegrationKeys(self, backup): 108 | return [] 109 | 110 | 111 | # Note: This is provided as an example. In practice, you probably do not want 112 | # to use this class, since inheriting from it will make installation of 113 | # the OpenStackInfrastructure zenpack mandatory. 114 | class BaseCinderImplementationComponent(object): 115 | implements(ICinderImplementationComponent) 116 | 117 | cinder_plugin_name = None 118 | 119 | def getCinderIntegrationKeys(self): 120 | return [] 121 | 122 | def index_cinder_object(self, idxs=None): 123 | if self.cinder_plugin_name is None: 124 | raise ValueError("cinder_plugin_name must be set in subclass %s" % self.__class__) 125 | 126 | index_implementation_object(self) 127 | 128 | def unindex_cinder_object(self): 129 | if self.cinder_plugin_name is None: 130 | raise ValueError("cinder_plugin_name must be set in subclass %s" % self.__class__) 131 | 132 | unindex_implementation_object(self) 133 | -------------------------------------------------------------------------------- /vagrant/rdo-mitaka/bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | yum install -y emacs wget telnet 4 | 5 | # mitaka is very EOL at this point- some gymnastics are 6 | # required to get yum to find the RPMs. 7 | sudo rpm -ivh https://repos.fedorapeople.org/repos/openstack/EOL/openstack-mitaka/rdo-release-mitaka-7.noarch.rpm 8 | sudo perl -p -i -e 's/mirror.centos.org/buildlogs.centos.org/g' /etc/yum.repos.d/rdo-release.repo 9 | sudo perl -p -i -e 's/gpgcheck=1/gpgcheck=0/g' /etc/yum.repos.d/rdo-release.repo 10 | sudo yum update -y 11 | 12 | # Install packstack 13 | sudo yum install -y openstack-packstack openstack-utils 14 | sudo yum install -y libvirt 15 | 16 | sudo systemctl disable firewalld 17 | sudo systemctl stop firewalld 18 | sudo systemctl disable NetworkManager 19 | sudo systemctl stop NetworkManager 20 | sudo systemctl enable network 21 | sudo systemctl start network 22 | 23 | #sudo packstack --allinone 24 | sudo packstack --allinone --os-ceilometer-install=y 25 | #sudo packstack --allinone --os-ceilometer-install=y --os-controller-host=192.168.2.15 --os-compute-hosts=192.168.2.15 --os-network-hosts=192.168.2.15 --vcenter-host=192.168.2.15 --amqp-host=192.168.2.15 --mariadb-host=192.168.2.15 --mongodb-host=192.168.2.15 --novanetwork-pubif=eth1 --novanetwork-fixed-range=192.168.32.0/22 --novanetwork-floating-range=10.3.4.0/22 --os-neutron-ml2-type-drivers=local --os-neutron-ml2-tenant-network-types=local --os-neutron-ml2-mechanism-drivers=openvswitch --use-epel=y 26 | 27 | # Fix libvirt hypervisor so it can run nested under virtualbox. 28 | openstack-config --set /etc/nova/nova.conf libvirt virt_type qemu 29 | 30 | # Enable compute.instance.update events 31 | openstack-config --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_state 32 | 33 | 34 | # bounce most of nova/neutron to pick up those config file changes 35 | for e in openstack-nova-api openstack-nova-compute openstack-nova-conductor openstack-nova-scheduler; do /bin/systemctl restart $e; done 36 | for e in neutron-dhcp-agent neutron-l3-agent neutron-metadata-agent neutron-openvswitch-agent neutron-server; do /bin/systemctl restart $e; done 37 | 38 | /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management 39 | /bin/systemctl restart rabbitmq-server 40 | # (http://:15672/ - log in as guest/guest) 41 | 42 | # When using openvpn, it can picks up a bogus domain name that keeps horizon's 43 | # vhost form working. 44 | perl -p -i -e 's/\.openvpn//g' /etc/httpd/conf.d/15-horizon_vhost.conf /etc/openstack-dashboard/local_settings 45 | /bin/systemctl restart httpd 46 | 47 | # Install zenoss plugin (provides dispatcher_zenoss) 48 | sudo yum install -y python-pip 49 | sudo pip -q install --force-reinstall https://github.com/zenoss/ceilometer_zenoss/archive/master.zip 50 | 51 | # Configure ceilometer 52 | sudo cp /usr/lib/python2.7/site-packages/ceilometer_zenoss/event_definitions.yaml /etc/ceilometer/ 53 | openstack-config --set /etc/ceilometer/ceilometer.conf notification store_events True 54 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT verbose False 55 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT debug True 56 | 57 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT meter_dispatchers zenoss 58 | openstack-config --set /etc/ceilometer/ceilometer.conf DEFAULT event_dispatchers zenoss 59 | 60 | # These will need to be tweaked for your specific setup. 61 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss zenoss_device ostack 62 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss amqp_hostname 192.168.2.2 63 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss amqp_port 5672 64 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss amqp_userid zenoss 65 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss amqp_password zenoss 66 | openstack-config --set /etc/ceilometer/ceilometer.conf dispatcher_zenoss amqp_virtual_host /zenoss 67 | 68 | # bounce ceilometer. 69 | for e in openstack-ceilometer-api openstack-ceilometer-central openstack-ceilometer-collector openstack-ceilometer-compute openstack-ceilometer-notification; do /bin/systemctl restart $e; done 70 | 71 | # Create a zenoss user so that zenoss can monitor this host as well. 72 | adduser zenoss -p '$6$GBeC9/Vf$0/6klsM6XThSI/nXvZTwsn1ESPjKjSbmlXj1Okh1i2CVTCknekldztlvhAF5ki85a94FejZ1cliKd30Met0BT/' 73 | 74 | # Increase MaxSessions for sshd: 75 | perl -p -i -e 's/#MaxSessions 10/MaxSessions 100/g' /etc/ssh/sshd_config 76 | /bin/systemctl restart sshd 77 | 78 | # set up the vagrant user with the right openstack environment so you can just 79 | # log in and run the openstack commandline tools. 80 | cp /root/keystonerc_admin /home/vagrant/keystonerc_admin 81 | chown vagrant /home/vagrant/keystonerc_admin 82 | echo ". /home/vagrant/keystonerc_admin" >> /home/vagrant/.bashrc 83 | -------------------------------------------------------------------------------- /event_definitions/event_definitions.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2019, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | # Parses various versions of the ceilometer event_definitions.yaml file into 11 | # a form that can be easily queried and compared. 12 | 13 | import yaml 14 | from urllib2 import urlopen 15 | from fnmatch import fnmatch 16 | from decorator import decorator 17 | import os.path 18 | 19 | 20 | @decorator 21 | def memoize(f, *args, **kwargs): 22 | sig = repr((args, kwargs)) 23 | cache = f._m_cache = getattr(f, '_m_cache', {}) 24 | if sig not in cache: 25 | cache[sig] = f(*args, **kwargs) 26 | return cache[sig] 27 | 28 | 29 | class EventDefinitions(object): 30 | definitions = None 31 | url = None 32 | 33 | def __init__(self, url=None, with_additions=False): 34 | if url: 35 | self.url = url 36 | 37 | if self.url is None: 38 | raise ValueError("Event Definitions URL Not Set") 39 | 40 | if with_additions: 41 | with open(os.path.dirname(__file__) + "/zenoss_additions.yaml") as za: 42 | self.load_definitions(urlopen(self.url).read() + za.read()) 43 | else: 44 | self.load_definitions(urlopen(self.url).read()) 45 | 46 | def load_definitions(self, definitions_yaml): 47 | defs = yaml.safe_load(definitions_yaml) 48 | 49 | # A single block in the yaml file can contain multiple event_type patterns. 50 | # It's easier for us to work with if we flatten that out, so go ahead 51 | # and make a more convenient structure: 52 | # [ 53 | # (single_event_type_pattern, { traitname => [ fields ] }), ... 54 | # ] 55 | # this is kept in the order of the original definition file. 56 | 57 | self.definitions = [] 58 | for d in defs: 59 | if not isinstance(d['event_type'], list): 60 | d['event_type'] = [d['event_type']] 61 | 62 | for event_type_pattern in d['event_type']: 63 | traits = {} 64 | 65 | for traitname, trait in d['traits'].iteritems(): 66 | if not isinstance(trait['fields'], list): 67 | trait['fields'] = [trait['fields']] 68 | 69 | traits[traitname] = trait['fields'] 70 | 71 | self.definitions.append( 72 | (event_type_pattern, traits) 73 | ) 74 | 75 | # the definitions in the file are to be processed in reverse order, with 76 | # the first matching one being used. (yaml merge syntax is used in the 77 | # file to explicitly include earlier blocks) 78 | self.definitions.reverse() 79 | 80 | @memoize 81 | def get_traits(self, event_type): 82 | for definition in self.definitions: 83 | event_type_pattern, traits = definition 84 | 85 | if fnmatch(event_type, event_type_pattern): 86 | return traits 87 | 88 | def has_trait(self, event_type, trait_name): 89 | return trait_name in self.get_traits(event_type) 90 | 91 | @memoize 92 | def trait_fields(self, event_type, trait_name): 93 | if self.has_trait(event_type, trait_name): 94 | return self.get_traits(event_type)[trait_name] 95 | else: 96 | return [] 97 | 98 | 99 | def get_event_definitions(version, with_additions=True): 100 | version_urls = { 101 | 'legacy': 'https://raw.githubusercontent.com/zenoss/ceilometer_zenoss/1.2.0/ceilometer_zenoss/event_definitions.yaml', 102 | 'newton': 'https://raw.githubusercontent.com/openstack/ceilometer/newton-eol/etc/ceilometer/event_definitions.yaml', 103 | 'ocata': 'https://raw.githubusercontent.com/openstack/ceilometer/stable/ocata/etc/ceilometer/event_definitions.yaml', 104 | 'pike': 'https://raw.githubusercontent.com/openstack/ceilometer/9.0.6/ceilometer/pipeline/data/event_definitions.yaml', 105 | 'queens': 'https://raw.githubusercontent.com/openstack/ceilometer/10.0.1/ceilometer/pipeline/data/event_definitions.yaml', 106 | 'rocky': 'https://raw.githubusercontent.com/openstack/ceilometer/11.0.1/ceilometer/pipeline/data/event_definitions.yaml', 107 | } 108 | 109 | if version == 'legacy': 110 | return EventDefinitions(url=version_urls.get(version), with_additions=False) 111 | else: 112 | return EventDefinitions(url=version_urls.get(version), with_additions=with_additions) 113 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/neutron_integration.py: -------------------------------------------------------------------------------- 1 | ############################################################################## 2 | # 3 | # Copyright (C) Zenoss, Inc. 2015, all rights reserved. 4 | # 5 | # This content is made available according to terms specified in 6 | # License.zenoss under the directory where your Zenoss product is installed. 7 | # 8 | ############################################################################## 9 | 10 | import logging 11 | log = logging.getLogger('zen.OpenStack.neutron_integration') 12 | 13 | from zope.interface import implements 14 | import zope.component 15 | from zope.event import notify 16 | from Products.Zuul.catalog.events import IndexingEvent 17 | 18 | 19 | from .catalogs import get_neutron_implementation_catalog, get_neutron_core_catalog 20 | from .interfaces import INeutronImplementationPlugin, INeutronImplementationComponent 21 | from .NeutronIntegrationComponent import all_core_components 22 | 23 | 24 | # Split a comma-separated list, as returned from an ini file, into a list type. 25 | # This is useful in the ini_process method. 26 | def split_list(s): 27 | if s is None: 28 | return [] 29 | else: 30 | return [y for y in [x.strip() for x in s.split(',')] if len(y)] 31 | 32 | 33 | def reindex_core_components(dmd): 34 | log.info("Reindexing all core neutron components") 35 | for obj in all_core_components(dmd): 36 | obj.index_object() 37 | notify(IndexingEvent(obj)) 38 | 39 | 40 | def reindex_implementation_components(dmd): 41 | for plugin_name, plugin in zope.component.getUtilitiesFor(INeutronImplementationPlugin): 42 | log.info("Asking implementation plugin %s to reindex its components" % plugin_name) 43 | plugin.reindex_implementation_components(dmd) 44 | 45 | 46 | def index_implementation_object(obj): 47 | catalog = get_neutron_implementation_catalog(obj.dmd) 48 | catalog.catalog_object(obj, obj.getPrimaryId()) 49 | 50 | 51 | def unindex_implementation_object(obj): 52 | catalog = get_neutron_implementation_catalog(obj.dmd) 53 | catalog.uncatalog_object(obj.getPrimaryId()) 54 | 55 | 56 | def get_neutron_components(obj): 57 | """ 58 | Returns the neutron (core) components for an implementation object 59 | """ 60 | 61 | keys = obj.getNeutronIntegrationKeys() 62 | if not keys: 63 | return [] 64 | 65 | catalog = get_neutron_core_catalog(obj.dmd) 66 | neutron_components = [] 67 | for brain in catalog(getNeutronIntegrationKeys=keys): 68 | try: 69 | obj = brain.getObject() 70 | except Exception: 71 | # ignore a stale entry 72 | pass 73 | else: 74 | neutron_components.append(obj) 75 | return neutron_components 76 | 77 | 78 | # Base class for neutron integration plugins which implement INeutronImplementationPlugin 79 | class BaseNeutronImplementationPlugin(object): 80 | implements(INeutronImplementationPlugin) 81 | 82 | @classmethod 83 | def ini_required(cls): 84 | return [] 85 | 86 | @classmethod 87 | def ini_optional(cls): 88 | return [] 89 | 90 | @classmethod 91 | def ini_process(cls, filename, section_name, option_name, value): 92 | return value 93 | 94 | @classmethod 95 | def reindex_implementation_components(cls): 96 | pass 97 | 98 | def getTenantIntegrationKeys(self, tenant): 99 | return [] 100 | 101 | def getPortIntegrationKeys(self, port): 102 | return [] 103 | 104 | def getNetworkIntegrationKeys(self, network): 105 | return [] 106 | 107 | def getExternalNetworkIntegrationKeys(self, network): 108 | return [] 109 | 110 | def getSubnetIntegrationKeys(self, subnet): 111 | return [] 112 | 113 | def getRouterIntegrationKeys(self, router): 114 | return [] 115 | 116 | def getFloatingIpIntegrationKeys(self, floatingip): 117 | return [] 118 | 119 | 120 | # Note: This is provided as an example. In practice, you probably do not want 121 | # to use this class, since inheriting from it will make installation of 122 | # the OpenStackInfrastructure zenpack mandatory. 123 | class BaseNeutronImplementationComponent(object): 124 | implements(INeutronImplementationComponent) 125 | 126 | neutron_plugin_name = None 127 | 128 | def getNeutronIntegrationKeys(self): 129 | return [] 130 | 131 | def index_object(self, idxs=None): 132 | if self.neutron_plugin_name is None: 133 | raise ValueError("neutron_plugin_name must be set in subclass %s" % self.__class__) 134 | 135 | index_implementation_object(self) 136 | 137 | def unindex_object(self): 138 | if self.neutron_plugin_name is None: 139 | raise ValueError("neutron_plugin_name must be set in subclass %s" % self.__class__) 140 | 141 | unindex_implementation_object(self) 142 | -------------------------------------------------------------------------------- /ZenPacks/zenoss/OpenStackInfrastructure/resources/Endpoint.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Customizations to Endpoint Overview Page 3 | */ 4 | Ext.onReady(function() { 5 | var DEVICE_OVERVIEW_ID = 'deviceoverviewpanel_summary'; 6 | Ext.ComponentMgr.onAvailable(DEVICE_OVERVIEW_ID, function(){ 7 | var box = Ext.getCmp(DEVICE_OVERVIEW_ID); 8 | box.removeField('uptime'); 9 | box.removeField('memory'); 10 | }); 11 | 12 | var DEVICE_OVERVIEW_IDSUMMARY = 'deviceoverviewpanel_idsummary'; 13 | Ext.ComponentMgr.onAvailable(DEVICE_OVERVIEW_IDSUMMARY, function(){ 14 | var box = Ext.getCmp(DEVICE_OVERVIEW_IDSUMMARY); 15 | box.removeField('tagNumber'); 16 | box.removeField('serialNumber'); 17 | }); 18 | 19 | var DEVICE_OVERVIEW_DESCRIPTION = 'deviceoverviewpanel_descriptionsummary'; 20 | Ext.ComponentMgr.onAvailable(DEVICE_OVERVIEW_DESCRIPTION, function(){ 21 | var box = Ext.getCmp(DEVICE_OVERVIEW_DESCRIPTION); 22 | box.removeField('rackSlot'); 23 | box.removeField('hwManufacturer'); 24 | box.removeField('hwModel'); 25 | }); 26 | 27 | var DEVICE_OVERVIEW_SYSTEMSUMMARY = 'deviceoverviewpanel_systemsummary'; 28 | Ext.ComponentMgr.onAvailable(DEVICE_OVERVIEW_SYSTEMSUMMARY, function(){ 29 | var box = Ext.getCmp(DEVICE_OVERVIEW_SYSTEMSUMMARY); 30 | 31 | box.addField({ 32 | id: 'ceilometer_url_samples-view', 33 | xtype: 'displayfield', 34 | name: 'ceilometer_url_samples', 35 | fieldLabel: _t('Ceilometer Publisher URL (for pipeline.yaml)'), 36 | permission: 'Manage Device' 37 | }) 38 | box.addField({ 39 | id: 'ceilometer_url_events-view', 40 | xtype: 'displayfield', 41 | name: 'ceilometer_url_events', 42 | fieldLabel: _t('Ceilometer Publisher URL (for event_pipeline.yaml)'), 43 | permission: 'Manage Device' 44 | }) 45 | }); 46 | 47 | var DEVICE_OVERVIEW_SNMP = 'deviceoverviewpanel_snmpsummary'; 48 | Ext.ComponentMgr.onAvailable(DEVICE_OVERVIEW_SNMP, function(){ 49 | this.hide(); 50 | }); 51 | 52 | /* Hide Software component, as it always empty */ 53 | var DEVICE_ELEMENTS = "subselecttreepaneldeviceDetailNav" 54 | Ext.ComponentMgr.onAvailable(DEVICE_ELEMENTS, function(){ 55 | var DEVICE_PANEL = Ext.getCmp(DEVICE_ELEMENTS); 56 | Ext.apply(DEVICE_PANEL, { 57 | listeners: { 58 | afterrender: function() { 59 | var tree = Ext.getCmp(DEVICE_PANEL.items.items[0].id); 60 | var items = tree.store.data.items; 61 | for (i in items){ 62 | if (items[i].data.id.match(/software*/)){ 63 | try { 64 | tree.store.remove(items[i]); 65 | tree.store.sync(); 66 | } catch(err){} 67 | } 68 | } 69 | } 70 | } 71 | }) 72 | }) 73 | }); 74 | 75 | 76 | Ext.apply(Zenoss.render, { 77 | openstack_ServiceOperStatus: function(value) { 78 | switch (value) { 79 | case 'UNKNOWN': return Zenoss.render.severity(1); 80 | case 'UP': return Zenoss.render.severity(0); 81 | case 'DOWN': return Zenoss.render.severity(5); 82 | default: return Zenoss.render.severity(1); 83 | } 84 | }, 85 | 86 | openstack_ServiceEnabledStatus: function(value) { 87 | switch (value) { 88 | case true: return Zenoss.render.severity(0); 89 | case false: return Zenoss.render.severity(5); 90 | default: return Zenoss.render.severity(1); 91 | } 92 | }, 93 | 94 | openstack_uppercase_renderer: function(value) { 95 | if (value == null) { 96 | return ""; 97 | } else { 98 | return value.toUpperCase(); 99 | } 100 | }, 101 | 102 | }); 103 | 104 | 105 | Ext.onReady(function(){ 106 | if (Ext.ClassManager.isCreated("Zenoss.dynamicview.DynamicViewComponent")) { 107 | /* 108 | * Add the OpenStack Component View for device page. 109 | */ 110 | 111 | Zenoss.nav.appendTo('Device', [{ 112 | id: 'openstackcomponentview', 113 | text: _t('OpenStack Component View'), 114 | xtype: 'dynamicview', 115 | relationshipFilter: 'openstack_link', 116 | viewName: 'openstack_view' 117 | }]); 118 | 119 | /* 120 | * Enable OpenStack Component View for components as well. 121 | */ 122 | 123 | Zenoss.nav.appendTo('Component', [{ 124 | id: 'component_openstackcomponentview', 125 | text: _t('OpenStack Component View'), 126 | xtype: 'dynamicview', 127 | relationshipFilter: 'openstack_link', 128 | viewName: 'openstack_view' 129 | }]); 130 | } 131 | }); 132 | 133 | --------------------------------------------------------------------------------