From b4d666ff63acd269b0acb2c4419643863c683750 Mon Sep 17 00:00:00 2001 From: Vu Tran Date: Tue, 30 Sep 2014 12:22:12 -0400 Subject: add generic monitor framework Instead of having a central file or group of files to describe what data resources should be monitored. The content of these files will depend on what core system monitoring is used ((e.g. Nagios or Monasca). It's desirable to have each recipe describes what it wants be monitored in generic way such that various system monitors can understand and convert these into their format. If a recipe wishes to register itself to system monitor, it inherits monitor bbclass and use MONITOR_SERVICE_PACKAGES and MONITOR_SERVICE_ to indicate what processes should should be monitored. Also MONITOR_CHECKS_ variale can be used to pass list of scripts which will be run on target and if any of these scripts fail then will report. Eventually monitor.bbclass will be expanded to allow recipe to describe more complicated information passed down to system monitor (e.g. Nagios or Monasca) Signed-off-by: Vu Tran Signed-off-by: Bruce Ashfield --- .../recipes-devtools/python/python-barbican_git.bb | 5 ++++- .../recipes-devtools/python/python-ceilometer_git.bb | 5 ++++- .../recipes-devtools/python/python-cinder_git.bb | 5 ++++- .../python/python-cinderclient/cinder-api-check.sh | 14 ++++++++++++++ .../recipes-devtools/python/python-cinderclient_git.bb | 7 ++++++- .../recipes-devtools/python/python-glance_git.bb | 5 ++++- .../python/python-glanceclient/glance-api-check.sh | 14 ++++++++++++++ .../recipes-devtools/python/python-glanceclient_git.bb | 6 +++++- meta-openstack/recipes-devtools/python/python-heat_git.bb | 4 +++- .../recipes-devtools/python/python-horizon_git.bb | 5 ++++- .../recipes-devtools/python/python-keystone_git.bb | 5 ++++- .../python/python-keystoneclient/keystone-api-check.sh | 14 ++++++++++++++ .../recipes-devtools/python/python-keystoneclient_git.bb | 6 +++++- .../recipes-devtools/python/python-neutron_git.bb | 5 ++++- .../python/python-neutronclient/neutron-api-check.sh | 14 ++++++++++++++ .../recipes-devtools/python/python-neutronclient_git.bb | 7 ++++++- meta-openstack/recipes-devtools/python/python-nova_git.bb | 5 ++++- .../python/python-novaclient/nova-api-check.sh | 14 ++++++++++++++ .../recipes-devtools/python/python-novaclient_git.bb | 7 ++++++- 19 files changed, 133 insertions(+), 14 deletions(-) create mode 100644 meta-openstack/recipes-devtools/python/python-cinderclient/cinder-api-check.sh create mode 100644 meta-openstack/recipes-devtools/python/python-glanceclient/glance-api-check.sh create mode 100644 meta-openstack/recipes-devtools/python/python-keystoneclient/keystone-api-check.sh create mode 100644 meta-openstack/recipes-devtools/python/python-neutronclient/neutron-api-check.sh create mode 100644 meta-openstack/recipes-devtools/python/python-novaclient/nova-api-check.sh (limited to 'meta-openstack/recipes-devtools/python') diff --git a/meta-openstack/recipes-devtools/python/python-barbican_git.bb b/meta-openstack/recipes-devtools/python/python-barbican_git.bb index d5c43ff..e683743 100644 --- a/meta-openstack/recipes-devtools/python/python-barbican_git.bb +++ b/meta-openstack/recipes-devtools/python/python-barbican_git.bb @@ -19,7 +19,7 @@ SRCREV="ada968e162d9795613bfb346a1018f63ef7025cc" PV="2014.2.b3+git${SRCPV}" S = "${WORKDIR}/git" -inherit update-rc.d setuptools identity hosts useradd default_configs openstackchef +inherit update-rc.d setuptools identity hosts useradd default_configs openstackchef monitor SERVICECREATE_PACKAGES = "${SRCNAME}-setup" KEYSTONE_HOST="${CONTROLLER_IP}" @@ -136,3 +136,6 @@ RDEPENDS_${PN} += " \ INITSCRIPT_PACKAGES = "${SRCNAME}" INITSCRIPT_NAME_${SRCNAME} = "barbican-api" INITSCRIPT_PARAMS_${SRCNAME} = "${OS_DEFAULT_INITSCRIPT_PARAMS}" + +MONITOR_SERVICE_PACKAGES = "${SRCNAME}" +MONITOR_SERVICE_${SRCNAME} = "barbican" diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb b/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb index d12715d..90ac1c6 100644 --- a/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb +++ b/meta-openstack/recipes-devtools/python/python-ceilometer_git.bb @@ -127,7 +127,7 @@ pkg_postinst_${SRCNAME}-setup () { ceilometer-dbsync } -inherit setuptools identity hosts update-rc.d default_configs openstackchef +inherit setuptools identity hosts update-rc.d default_configs openstackchef monitor PACKAGES += " ${SRCNAME}-tests" PACKAGES += "${SRCNAME}-setup ${SRCNAME}-common ${SRCNAME}-api" @@ -257,3 +257,6 @@ INITSCRIPT_NAME_${SRCNAME}-alarm-evaluator = "${SRCNAME}-alarm-evaluator" INITSCRIPT_PARAMS_${SRCNAME}-alarm-evaluator = "${OS_DEFAULT_INITSCRIPT_PARAMS}" INITSCRIPT_NAME_${SRCNAME}-agent-notification = "${SRCNAME}-agent-notification" INITSCRIPT_PARAMS_${SRCNAME}-agent-notification = "${OS_DEFAULT_INITSCRIPT_PARAMS}" + +MONITOR_SERVICE_PACKAGES = "${SRCNAME}" +MONITOR_SERVICE_${SRCNAME} = "ceilometer" diff --git a/meta-openstack/recipes-devtools/python/python-cinder_git.bb b/meta-openstack/recipes-devtools/python/python-cinder_git.bb index ef66656..5ae149d 100644 --- a/meta-openstack/recipes-devtools/python/python-cinder_git.bb +++ b/meta-openstack/recipes-devtools/python/python-cinder_git.bb @@ -24,7 +24,7 @@ SRCREV="58eda5d1f41082a7e1ffef66239be30b8ac1321a" PV="2014.2.b3+git${SRCPV}" S = "${WORKDIR}/git" -inherit setuptools update-rc.d identity default_configs hosts openstackchef +inherit setuptools update-rc.d identity default_configs hosts openstackchef monitor CINDER_BACKUP_BACKEND_DRIVER ?= "cinder.backup.drivers.swift" @@ -235,3 +235,6 @@ INITSCRIPT_NAME_${SRCNAME}-scheduler = "cinder-scheduler" INITSCRIPT_PARAMS_${SRCNAME}-scheduler = "${OS_DEFAULT_INITSCRIPT_PARAMS}" INITSCRIPT_NAME_${SRCNAME}-backup = "cinder-backup" INITSCRIPT_PARAMS_${SRCNAME}-backup = "${OS_DEFAULT_INITSCRIPT_PARAMS}" + +MONITOR_SERVICE_PACKAGES = "${SRCNAME}" +MONITOR_SERVICE_${SRCNAME} = "cinder" diff --git a/meta-openstack/recipes-devtools/python/python-cinderclient/cinder-api-check.sh b/meta-openstack/recipes-devtools/python/python-cinderclient/cinder-api-check.sh new file mode 100644 index 0000000..9e64f8b --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-cinderclient/cinder-api-check.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +CMD="cinder list" + +data=$($CMD 2>&1) +res=$? +if [ ${res} -eq 127 ]; then + exit 0 +elif [ ${res} -ne 0 ]; then + echo "OpenStack \"cinder api\" failed: " + echo $data + exit $res +fi +exit 0 diff --git a/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb b/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb index c50b84f..9e0b747 100644 --- a/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb +++ b/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb @@ -11,13 +11,14 @@ SRCNAME = "python-cinderclient" SRC_URI = "\ git://github.com/openstack/python-cinderclient.git;branch=master \ file://fix_cinderclient_memory_leak.patch \ + file://cinder-api-check.sh \ " PV="1.1.0+git${SRCPV}" SRCREV="4c8464114f5539706cffc6888ce007d0d3ceba16" S = "${WORKDIR}/git" -inherit setuptools +inherit setuptools monitor DEPENDS += " \ python-pip \ @@ -41,3 +42,7 @@ do_install_append() { PACKAGES =+ "${BPN}-bash-completion" FILES_${BPN}-bash-completion = "${sysconfdir}/bash_completion.d/*" + +MONITOR_CHECKS_${PN} += "\ + cinder-api-check.sh \ +" diff --git a/meta-openstack/recipes-devtools/python/python-glance_git.bb b/meta-openstack/recipes-devtools/python/python-glance_git.bb index fa74aca..53f2d5b 100644 --- a/meta-openstack/recipes-devtools/python/python-glance_git.bb +++ b/meta-openstack/recipes-devtools/python/python-glance_git.bb @@ -19,7 +19,7 @@ PV="2014.2.b3+git${SRCPV}" S = "${WORKDIR}/git" -inherit setuptools update-rc.d identity default_configs hosts openstackchef +inherit setuptools update-rc.d identity default_configs hosts openstackchef monitor GLANCE_DEFAULT_STORE ?= "file" GLANCE_KNOWN_STORES ?= "glance.store.rbd.Store,\ @@ -212,3 +212,6 @@ INITSCRIPT_NAME_${SRCNAME}-api = "glance-api" INITSCRIPT_PARAMS_${SRCNAME}-api = "${OS_DEFAULT_INITSCRIPT_PARAMS}" INITSCRIPT_NAME_${SRCNAME}-registry = "glance-registry" INITSCRIPT_PARAMS_${SRCNAME}-registry = "${OS_DEFAULT_INITSCRIPT_PARAMS}" + +MONITOR_SERVICE_PACKAGES = "${SRCNAME}" +MONITOR_SERVICE_${SRCNAME} = "glance" diff --git a/meta-openstack/recipes-devtools/python/python-glanceclient/glance-api-check.sh b/meta-openstack/recipes-devtools/python/python-glanceclient/glance-api-check.sh new file mode 100644 index 0000000..aa8340a --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-glanceclient/glance-api-check.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +CMD="glance image-list" + +data=$($CMD 2>&1) +res=$? +if [ ${res} -eq 127 ]; then + exit 0 +elif [ ${res} -ne 0 ]; then + echo "OpenStack \"glance api\" failed: " + echo $data + exit $res +fi +exit 0 diff --git a/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb b/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb index 0205c49..1d8529a 100644 --- a/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb +++ b/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb @@ -16,11 +16,12 @@ PR = "r0" SRC_URI = "\ git://github.com/openstack/${BPN}.git;protocol=https \ file://fix_glanceclient_memory_leak.patch \ + file://glance-api-check.sh \ " S = "${WORKDIR}/git" -inherit setuptools +inherit setuptools monitor FILES_${PN} += "${datadir}/${SRCNAME}" @@ -32,3 +33,6 @@ RDEPENDS_${PN} = "gmp \ python-pbr \ " +MONITOR_CHECKS_${PN} += "\ + glance-api-check.sh \ +" diff --git a/meta-openstack/recipes-devtools/python/python-heat_git.bb b/meta-openstack/recipes-devtools/python/python-heat_git.bb index 5c73b99..8971e41 100644 --- a/meta-openstack/recipes-devtools/python/python-heat_git.bb +++ b/meta-openstack/recipes-devtools/python/python-heat_git.bb @@ -127,7 +127,7 @@ pkg_postinst_${SRCNAME}-setup () { heat-manage db_sync } -inherit setuptools identity hosts update-rc.d default_configs openstackchef +inherit setuptools identity hosts update-rc.d default_configs openstackchef monitor PACKAGES += "${SRCNAME}-tests ${SRCNAME}-templates ${SRCNAME}-common ${SRCNAME}-api ${SRCNAME}-api-cfn ${SRCNAME}-engine" PACKAGES += "${SRCNAME}-setup" @@ -224,3 +224,5 @@ INITSCRIPT_PARAMS_${SRCNAME}-api-cfn = "${OS_DEFAULT_INITSCRIPT_PARAMS}" INITSCRIPT_NAME_${SRCNAME}-engine = "${SRCNAME}-engine" INITSCRIPT_PARAMS_${SRCNAME}-engine = "${OS_DEFAULT_INITSCRIPT_PARAMS}" +MONITOR_SERVICE_PACKAGES = "${SRCNAME}" +MONITOR_SERVICE_${SRCNAME} = "heat" diff --git a/meta-openstack/recipes-devtools/python/python-horizon_git.bb b/meta-openstack/recipes-devtools/python/python-horizon_git.bb index a767bee..8ee1bed 100644 --- a/meta-openstack/recipes-devtools/python/python-horizon_git.bb +++ b/meta-openstack/recipes-devtools/python/python-horizon_git.bb @@ -60,7 +60,7 @@ SRCREV="bd998fb6094fb16d084c90de1eed619aca4c31ef" PV="2014.2.b3+git${SRCPV}" S = "${WORKDIR}/git" -inherit setuptools update-rc.d python-dir default_configs openstackchef +inherit setuptools update-rc.d python-dir default_configs openstackchef monitor # no longer required. kept as reference. # do_install[dirs] += "${D}/usr/share/bin" @@ -187,3 +187,6 @@ RDEPENDS_${SRCNAME}-apache = "\ memcached \ python-memcached \ " + +MONITOR_SERVICE_PACKAGES = "${SRCNAME}" +MONITOR_SERVICE_${SRCNAME} = "horizon" diff --git a/meta-openstack/recipes-devtools/python/python-keystone_git.bb b/meta-openstack/recipes-devtools/python/python-keystone_git.bb index 8105d6f..7512742 100644 --- a/meta-openstack/recipes-devtools/python/python-keystone_git.bb +++ b/meta-openstack/recipes-devtools/python/python-keystone_git.bb @@ -22,7 +22,7 @@ PV="2014.2.b3+git${SRCPV}" S = "${WORKDIR}/git" -inherit setuptools update-rc.d identity hosts default_configs openstackchef +inherit setuptools update-rc.d identity hosts default_configs openstackchef monitor SERVICE_TOKEN = "password" TOKEN_FORMAT ?= "PKI" @@ -301,3 +301,6 @@ RDEPENDS_${SRCNAME}-cronjobs = "cronie ${SRCNAME}" INITSCRIPT_PACKAGES = "${SRCNAME}" INITSCRIPT_NAME_${SRCNAME} = "keystone" INITSCRIPT_PARAMS_${SRCNAME} = "${OS_DEFAULT_INITSCRIPT_PARAMS}" + +MONITOR_SERVICE_PACKAGES = "${SRCNAME}" +MONITOR_SERVICE_${SRCNAME} = "keystone" diff --git a/meta-openstack/recipes-devtools/python/python-keystoneclient/keystone-api-check.sh b/meta-openstack/recipes-devtools/python/python-keystoneclient/keystone-api-check.sh new file mode 100644 index 0000000..aba6d5f --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-keystoneclient/keystone-api-check.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +CMD="keystone endpoint-list" + +data=$($CMD 2>&1) +res=$? +if [ ${res} -eq 127 ]; then + exit 0 +elif [ ${res} -ne 0 ]; then + echo "OpenStack \"keystone api\" failed: " + echo $data + exit $res +fi +exit 0 diff --git a/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb b/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb index e0c81db..783dca9 100644 --- a/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb +++ b/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb @@ -11,13 +11,14 @@ SRC_URI = "\ git://github.com/openstack/python-keystoneclient.git;branch=master \ file://fix_keystoneclient_memory_leak.patch \ file://keystoneclient-fix-test-path-to-example-certificates.patch \ + file://keystone-api-check.sh \ " PV="0.10.1+git${SRCPV}" SRCREV="3305c7be4b726de4dcc889006d0be30eb46d3ad9" S = "${WORKDIR}/git" -inherit setuptools +inherit setuptools monitor FILES_${PN}-doc += "${datadir}/keystoneclient" @@ -54,3 +55,6 @@ RDEPENDS_${SRCNAME}-tests += " \ python-httpretty \ " +MONITOR_CHECKS_${PN} += "\ + keystone-api-check.sh \ +" diff --git a/meta-openstack/recipes-devtools/python/python-neutron_git.bb b/meta-openstack/recipes-devtools/python/python-neutron_git.bb index f961487..6a9e66f 100644 --- a/meta-openstack/recipes-devtools/python/python-neutron_git.bb +++ b/meta-openstack/recipes-devtools/python/python-neutron_git.bb @@ -25,7 +25,7 @@ PV="2014.2.b3+git${SRCPV}" S = "${WORKDIR}/git" -inherit setuptools update-rc.d identity hosts default_configs openstackchef +inherit setuptools update-rc.d identity hosts default_configs openstackchef monitor SERVICECREATE_PACKAGES = "${SRCNAME}-setup" KEYSTONE_HOST="${CONTROLLER_IP}" @@ -313,3 +313,6 @@ INITSCRIPT_NAME_${SRCNAME}-l3-agent = "neutron-l3-agent" INITSCRIPT_PARAMS_${SRCNAME}-l3-agent = "${OS_DEFAULT_INITSCRIPT_PARAMS}" INITSCRIPT_NAME_${SRCNAME}-metadata-agent = "neutron-metadata-agent" INITSCRIPT_PARAMS_${SRCNAME}-metadata-agent = "${OS_DEFAULT_INITSCRIPT_PARAMS}" + +MONITOR_SERVICE_PACKAGES = "${SRCNAME}" +MONITOR_SERVICE_${SRCNAME} = "neutron" diff --git a/meta-openstack/recipes-devtools/python/python-neutronclient/neutron-api-check.sh b/meta-openstack/recipes-devtools/python/python-neutronclient/neutron-api-check.sh new file mode 100644 index 0000000..160acd2 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-neutronclient/neutron-api-check.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +CMD="neutron net-list" + +data=$($CMD 2>&1) +res=$? +if [ ${res} -eq 127 ]; then + exit 0 +elif [ ${res} -ne 0 ]; then + echo "OpenStack \"neutron api\" failed: " + echo $data + exit $res +fi +exit 0 diff --git a/meta-openstack/recipes-devtools/python/python-neutronclient_git.bb b/meta-openstack/recipes-devtools/python/python-neutronclient_git.bb index b4e34e3..cbad874 100644 --- a/meta-openstack/recipes-devtools/python/python-neutronclient_git.bb +++ b/meta-openstack/recipes-devtools/python/python-neutronclient_git.bb @@ -22,13 +22,14 @@ PR = "r0" SRC_URI = "git://github.com/openstack/python-neutronclient.git;branch=master \ file://neutronclient-use-csv-flag-instead-of-json.patch \ + file://neutron-api-check.sh \ " PV="2.3.7+git${SRCPV}" SRCREV="1452193f935f5be0bb2f5f01b54bd4947d27331b" S = "${WORKDIR}/git" -inherit setuptools +inherit setuptools monitor PACKAGECONFIG ?= "bash-completion" PACKAGECONFIG[bash-completion] = ",,bash-completion,bash-completion ${BPN}-bash-completion" @@ -40,3 +41,7 @@ do_install_append() { PACKAGES =+ "${BPN}-bash-completion" FILES_${BPN}-bash-completion = "${sysconfdir}/bash_completion.d/*" + +MONITOR_CHECKS_${PN} += "\ + neutron-api-check.sh \ +" diff --git a/meta-openstack/recipes-devtools/python/python-nova_git.bb b/meta-openstack/recipes-devtools/python/python-nova_git.bb index 5a8ba84..e79302b 100644 --- a/meta-openstack/recipes-devtools/python/python-nova_git.bb +++ b/meta-openstack/recipes-devtools/python/python-nova_git.bb @@ -30,7 +30,7 @@ PV="2014.2.b3+git${SRCPV}" S = "${WORKDIR}/git" -inherit update-rc.d setuptools identity hosts useradd default_configs openstackchef +inherit update-rc.d setuptools identity hosts useradd default_configs openstackchef monitor LIBVIRT_IMAGES_TYPE ?= "default" @@ -368,3 +368,6 @@ INITSCRIPT_PARAMS_${SRCNAME}-novncproxy = "${OS_DEFAULT_INITSCRIPT_PARAMS}" INITSCRIPT_NAME_${SRCNAME}-spicehtml5proxy = "nova-spicehtml5proxy" INITSCRIPT_PARAMS_${SRCNAME}-spicehtml5proxy = "${OS_DEFAULT_INITSCRIPT_PARAMS}" + +MONITOR_SERVICE_PACKAGES = "${SRCNAME}" +MONITOR_SERVICE_${SRCNAME} = "nova-api nova-cert nova-conductor nova-consoleauth nova-scheduler" diff --git a/meta-openstack/recipes-devtools/python/python-novaclient/nova-api-check.sh b/meta-openstack/recipes-devtools/python/python-novaclient/nova-api-check.sh new file mode 100644 index 0000000..b9ba6bc --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-novaclient/nova-api-check.sh @@ -0,0 +1,14 @@ +#! /bin/bash + +CMD="nova list" + +data=$($CMD 2>&1) +res=$? +if [ ${res} -eq 127 ]; then + exit 0 +elif [ ${res} -ne 0 ]; then + echo "OpenStack \"nova api\" failed: " + echo $data + exit $res +fi +exit 0 diff --git a/meta-openstack/recipes-devtools/python/python-novaclient_git.bb b/meta-openstack/recipes-devtools/python/python-novaclient_git.bb index e8f5aa3..a7a501c 100644 --- a/meta-openstack/recipes-devtools/python/python-novaclient_git.bb +++ b/meta-openstack/recipes-devtools/python/python-novaclient_git.bb @@ -10,13 +10,14 @@ SRC_URI = "\ git://github.com/openstack/python-novaclient.git;branch=master \ file://fix_novaclient_memory_leak.patch \ file://novaclient-specify-full-path-to-test-certificate.patch \ + file://nova-api-check.sh \ " PV="2.18.1+git${SRCPV}" SRCREV="2a1c07e790cc95b1e847974e4c757f826507834f" S = "${WORKDIR}/git" -inherit setuptools +inherit setuptools monitor DEPENDS = "python-setuptools-git" DEPENDS += " \ @@ -44,3 +45,7 @@ do_install_append() { PACKAGES =+ "${BPN}-bash-completion" FILES_${BPN}-bash-completion = "${sysconfdir}/bash_completion.d/*" + +MONITOR_CHECKS_${PN} += "\ + nova-api-check.sh \ +" -- cgit v1.2.3-54-g00ecf