OpenStack ironic sends physical machine SEL information to Ceilometer

Source: Internet
Author: User

The previous period took part in a tournament, which was broadly applied and extended OpenStack, as shown in the requirements:


Ironic manages and controls the physical machine by periodically executing the Ipmitool command on the physical machine to obtain the SEL (System event log) information for the physical machine, ironic sends the collected SEL information to the Ceilometer via the AMQP protocol, Ceilometer persists the collected SEL information and displays the SEL information in horizon.

Here is a brief introduction to the implementation of sending SEL information on the ironic side and receiving the SEL information on the Ceilometer side.

Ironic send the SEL information code as follows and modify it in ironic.conductor.manager.py:

    @periodic_task. Periodic_task (Spacing=conf.conductor.send_sel_data_interval) def _send_sel_data (self, CO                 ntext): # do nothing if send_sel_data option was False if not CONF.conductor.send_sel_data:return columns = [' uuid ', ' driver '] node_list = self.dbapi.get_nodeinfo_list (columns=columns) for ( Node_uuid, driver) in Node_list:try:with Task_manager.acquire (context,node_uuid,shared=true) A S Task:task.driver.management.validate (Task) Sel_data = task.driver.management.get_ Sel_data (Task) for One_sel in sel_data:message = {' record_id ': one_sel[0], ' Recor                                   D_type ': one_sel[1], ' timestamp ': one_sel[2], ' level ': one_sel[3], ' Description ': one_sel[4], ' info ': str (one_sel[5]), ' node_uuid ': node_uuid, ' event_t Ype ': ' Hardware.sel.updatE '} self.notifier.info (Context, "hardware.sel.metric", message) except Notimplementederro R:log.warn (_LW (' Get_sel_data is not implemented for driver "% (driver) s, Node_uuid is % (node) s '), {' node ': node_uuid, ' Driver ': driver}) except exception. NodeNotFound:LOG.warn (_LW ("During send_sel_data, node% (node) s is not" "found and presumed deleted by another process. "), {' node ': Node_uuid}) except Exception as E:log.warn (_LW ("Failed to get SEL data for node (node) s." "Error:% (Error) S"), {' Node ': Node_uuid, ' ERROR ': str (e)})

A sample record is added to the database every time a message is received on the Ceilometer side, which is added to the sample regardless of whether the message is duplicated or not, but one SEL record also includes other data, which is the resource data for the sample. These resource data do not exist in the database duplication, before inserting the database first query operation, if there is not inserted, resource data in the form of Key-value in the database, and according to the key value type of different (int, string, etc.), Distributed in four different tables. The Ceilometer receives and stores the code as follows:

Class Selnotification (plugin. Notificationbase):    event_types = [' Hardware.sel.metric ']    @staticmethod    def get_targets (conf):        "" " Oslo.messaging.TargetS for this plugin.        "" " return [Messaging. Target (Topic=topic,                                 exchange=conf.ironic_exchange) for                topic in Conf.notification_topics]    def process_ Notification (self, message):        Logger.info (' Received SEL message: ' +STR (message))                yield sample. Sample.from_notification (            name= ' Hardware.sel ',            type=sample. Type_gauge,            unit= ' SEL ',            volume= ' 1 ',            resource_id=message[' payload ' [' node_uuid '],            message= message[' payload '],            user_id=none,            project_id=none)


OpenStack ironic sends physical machine SEL information to Ceilometer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.