警告
NOTICE: THIS DOCUMENTATION SITE HAS BEEN SUPERSEDED.
For the current documentation site goto: http://docs.cloudstack.apache.org
事件本质上是与云环境相关的虚拟和物理资源的状态显著或有意义的变化。事件用于监控系统,使用率和计费系统,或者是用于辨别模式和做出正确商业决定的其他任何事件驱动工作流系统。在 CloudStack 中的事件可以是虚拟或物理资源的状态变化,用户(操作事件)执行的操作,或基于策略的事件(警告)。
这里有两种类型的事件记录在&PRODUCT;事件日志。标准事件记录一个事件的成功或失败,并且可以用于鉴别哪些是已经失败的任务或进程。这里也记录长时间运行任务事件。异步任务的制定,启动,完成这些事件都被记录。长时间运行的同步和异步事件日志可用于获取挂起任务更多的状态信息,也可以用来识别任务是被挂起或还未开始。以下各节提供有关这些事件的详细信息。
Event notification framework provides a means for the Management Server components to publish and subscribe to CloudStack events. Event notification is achieved by implementing the concept of event bus abstraction in the Management Server.
状态变化,资源状态变化的新事件作为事件通知架构的一部分被引入。每个资源,例如用户VM,卷VM,网卡,网络,公共IP,快照以及模板,使用机器状态和常规事件被关联起来作为状态变化的一部分。这意味着,一个资源状态的变化产生了一个状态变化事件,并且该事件被公布到相应的状态事件总线。所有的 CloudStack 事件(报警,动作事件,使用事件)和 资源状态变化事件的附加条目将被公布到事件总线。
An event bus is introduced in the Management Server that allows the CloudStack components and extension plug-ins to subscribe to the events by using the Advanced Message Queuing Protocol (AMQP) client. In CloudStack, a default implementation of event bus is provided as a plug-in that uses the RabbitMQ AMQP client. The AMQP client pushes the published events to a compatible AMQP server. Therefore all the CloudStack events are published to an exchange in the AMQP server.
Additionally, both an in-memory implementation and an Apache Kafka implementation are also available.
以下是一些使用场景:
作为一个 CloudStack 管理员,执行下列一次性配置启用事件通知框架。在运行时不能修改控件行为。
Create the folder /etc/cloudstack/management/META-INF/cloudstack/core
Inside that folder, open spring-event-bus-context.xml
.
按照以下实例顶一个叫做 “ eventNotificationBus ” 的实体:
名字:为实体指定一个名字。
服务器: RabbitMQ AMQP 的名字或IP地址
端口 : RabbitMQ服务器运行端口.
用户名: 用户名关联访问 RabbitMQ 服务器的账号。
密码: 密码关联访问 RabbitMQ 服务器账号的用户名。
交流:其中 CloudStack 中事件发布的 RabbitMQ 的服务器上的交流名称。
下面给出一个实体实例:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="eventNotificationBus" class="org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus">
<property name="name" value="eventNotificationBus"/>
<property name="server" value="127.0.0.1"/>
<property name="port" value="5672"/>
<property name="username" value="guest"/>
<property name="password" value="guest"/>
<property name="exchange" value="cloudstack-events"/>
</bean>
</beans>
The eventNotificationBus
bean represents the
org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus
class.
If you want to use encrypted values for the username and password, you have to include a bean to pass those as variables from a credentials file.
A sample is given below
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
>
<bean id="eventNotificationBus" class="org.apache.cloudstack.mom.rabbitmq.RabbitMQEventBus">
<property name="name" value="eventNotificationBus"/>
<property name="server" value="127.0.0.1"/>
<property name="port" value="5672"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
<property name="exchange" value="cloudstack-events"/>
</bean>
<bean id="environmentVariablesConfiguration" class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
<property name="algorithm" value="PBEWithMD5AndDES" />
<property name="passwordEnvName" value="APP_ENCRYPTION_PASSWORD" />
</bean>
<bean id="configurationEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
<property name="config" ref="environmentVariablesConfiguration" />
</bean>
<bean id="propertyConfigurer" class="org.jasypt.spring3.properties.EncryptablePropertyPlaceholderConfigurer">
<constructor-arg ref="configurationEncryptor" />
<property name="location" value="classpath:/cred.properties" />
</bean>
</beans>
Create a new file in the same folder called cred.properties
and the specify the values for username and password as jascrypt encrypted strings
Sample, with guest
as values for both fields:
username=nh2XrM7jWHMG4VQK18iiBQ==
password=nh2XrM7jWHMG4VQK18iiBQ==
重启管理服务器。
作为一个 CloudStack 管理员,执行下列一次性配置启用事件通知框架。在运行时不能修改控件行为。
Create an appropriate configuration file in /etc/cloudstack/management/kafka.producer.properties
which contains valid kafka configuration properties as documented in http://kafka.apache.org/documentation.html#newproducerconfigs
The properties may contain an additional topic
property which if not provided will default to cloudstack
.
While key.serializer
and value.serializer
are usually required for a producer to correctly start, they may be omitted and
will default to org.apache.kafka.common.serialization.StringSerializer
.
Create the folder /etc/cloudstack/management/META-INF/cloudstack/core
Inside that folder, open spring-event-bus-context.xml
.
Define a bean named eventNotificationBus
with a single name
attribute, A sample bean is given below:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="eventNotificationBus" class="org.apache.cloudstack.mom.kafka.KafkaEventBus">
<property name="name" value="eventNotificationBus"/>
</bean>
</beans>
重启管理服务器。
事件日志记录三种类型的标准事件
事件日志记录三种类型的标准事件
可以通过用户接口查询数据库日志。系统收集了以下列表事件:
CloudStack 提供你删除或归档那些再也不使用的现存警告和事件的能力。您可以定期删除或存档的任何那些您不能或不想从数据库来解决的警报或事件,
您可以通过快速查看或详情页面直接删除或归档个别警报或事件。如果你想同时删除多个警报或事件,您可以分别使用相应的快捷菜单。您可以按类别删除某个时期的警报或事件。例如,您可以选择诸如 ** USER.LOGOUT**,** VM.DESTROY**,** VM.AG.UPDATE**,** CONFIGURATION.VALUE.EDI** 等类别,依此类推。您还可以查看事件和警报归档或删除的数量。
为了支持删除或归档报警,增加了以下全局参数:
注解
不能同通过UI 或 API 来归档报警或者事件。它们都存放在数据库中用于升级或其他目的。