警告
NOTICE: THIS DOCUMENTATION SITE HAS BEEN SUPERSEDED.
For the current documentation site goto: http://docs.cloudstack.apache.org
标签是一类存储云中资源元数据的键值对。其主要用来分类资源,例如,可以将一个用户的虚拟机打上标签,以表明用户所在的城市。在这个例子中,键就是城市,而值可能是Toronto或是Tokyo。可以让cloudstack发现所有打上标签的资源。例如,发现指定城市里用户的虚拟机。
可以给用户虚拟机,磁盘卷,快照,来宾网络,模板,ISO镜像,防火墙规则,端口转发规则,公共IP地址,安全组,负载均衡规则,项目,VPC,网络访问列表或者静态路由器等等,都打上标签。但不能给远程登录VPN打上标签。
可以通过CloudStack的界面或者API来创建标签,删除标签或者列出标签。也可以为每一个资源定义多个标签。没有数量的限制。并且,每个标签可以达到255个字符的长度。用户可以定义自己拥有的资源的标签,而管理员可以定义云中所有资源的标签。
一个可选的输入参数,标签,存在于多个API中。下面的例子展示了如何应用这个新参数来查找带有 地域=加拿大或城市=多伦多 标签的所有磁盘卷。
command=listVolumes
&listAll=true
&tags[0].key=region
&tags[0].value=canada
&tags[1].key=city
&tags[1].value=Toronto
下面的API命令具有以下输入参数:
CloudStack manages different types of hosts that contains one or more physical CPU sockets. CPU socket is considered as a unit of measure used for licensing and billing cloud infrastructure. CloudStack provides both UI and API support to collect the CPU socket statistics for billing purpose. The Infrastructure tab has a new tab for CPU sockets. You can view the statistics for CPU sockets managed by CloudStack, which in turn reflects the size of the cloud. The CPU Socket page will give you the number of hosts and sockets used for each host type.
Log in to the CloudStack UI.
在左侧导航栏中,点击基础架构
在CPU Sockets中,点击查看全部。
显示CPU插槽页。此页会显示主机数量以及基于虚拟机类型的CPU插槽数量。
CloudStack管理服务器存储了数据库配置信息(如主机名,端口,凭证),这些信息在/etc/cloudstack/management/db.properties文件中,为使更改生效,编辑每个管理服务器上的此文件,然后重启管理服务器
可能会需要更改CloudStack使用的mysql账户密码。如果要更改,需要在MySQL中更改密码,同时要将加密的密码加入到/etc/cloudstack/management/db.properties文件中。
在更改密码之前,需要停止CloudStack管理服务器,如果部署了使用引擎,也需要关闭使用引擎。
# service cloudstack-management stop
# service cloudstack-usage stop
接下来,你将在MySQL服务器上更新CloudStack的用户密码。
# mysql -u root -p
在MySQL命令行下,你将更改密码并且刷新权限:
update mysql.user set password=PASSWORD("newpassword123") where User='cloud';
flush privileges;
quit;
下一步是加密密码然后拷贝加密后的密码到CloudStack的数据库配置中(/etc/cloudstack/management/db.properties
)。
# java -classpath /usr/share/cloudstack-common/lib/jasypt-1.9.0.jar \ org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI encrypt.sh \ input="newpassword123" password="`cat /etc/cloudstack/management/key`" \ verbose=false
请注意这是给文件加密类型准备的。如果你使用web加密类型,那么你要使用password=”management_server_secret_key”
现在,你会在 /etc/cloudstack/management/db.properties
中更新心的密文。使用文本编辑器打开``/etc/cloudstack/management/db.properties`` ,然后更新这些参数:
db.cloud.password=ENC(encrypted_password_from_above)
db.usage.password=ENC(encrypted_password_from_above)
在复制新的密码过去之后,你可以启动CloudStack了(如果需要的话,还有用量引擎)。
# service cloudstack-management start
# service cloud-usage start
系统提供告警和事件用以帮助云的管理。告警通知管理员,一般用邮件发送,提醒管理员云中有错误发生。告警的行为可以进行配置。
事件会追踪云中所有用户和管理员的操作事件。比如,每个客户虚拟机的启动会建立一个对应的事件。每个时间都存储在管理节点的数据库中。
在以下情况,系统会发送邮件给管理员:
除了在CloudStack UI中的仪表板上给管理员显示警告和发送电子邮件之外,CloudStack还可以发送同样的警告给外部的SNMP或者Syslog管理软件。如果你更愿意使用SNMP或者Syslog管理器来监视你的云的话,那这么做很有用。
可以发送的警告有:
以下是告警类型的列表。当前告警可以通过调用listAlerts得知。
MEMORY = 0 // Available Memory below configured threshold
CPU = 1 // Unallocated CPU below configured threshold
STORAGE =2 // Available Storage below configured threshold
STORAGE_ALLOCATED = 3 // Remaining unallocated Storage is below configured threshold
PUBLIC_IP = 4 // Number of unallocated virtual network public IPs is below configured threshold
PRIVATE_IP = 5 // Number of unallocated private IPs is below configured threshold
SECONDARY_STORAGE = 6 // Available Secondary Storage in availability zone is below configured threshold
HOST = 7 // Host related alerts like host disconnected
USERVM = 8 // User VM stopped unexpectedly
DOMAIN_ROUTER = 9 // Domain Router VM stopped unexpectedly
CONSOLE_PROXY = 10 // Console Proxy VM stopped unexpectedly
ROUTING = 11 // Lost connection to default route (to the gateway)
STORAGE_MISC = 12 // Storage issue in system VMs
USAGE_SERVER = 13 // No usage server process running
MANAGMENT_NODE = 14 // Management network CIDR is not configured originally
DOMAIN_ROUTER_MIGRATE = 15 // Domain Router VM Migration was unsuccessful
CONSOLE_PROXY_MIGRATE = 16 // Console Proxy VM Migration was unsuccessful
USERVM_MIGRATE = 17 // User VM Migration was unsuccessful
VLAN = 18 // Number of unallocated VLANs is below configured threshold in availability zone
SSVM = 19 // SSVM stopped unexpectedly
USAGE_SERVER_RESULT = 20 // Usage job failed
STORAGE_DELETE = 21 // Failed to delete storage pool
UPDATE_RESOURCE_COUNT = 22 // Failed to update the resource count
USAGE_SANITY_RESULT = 23 // Usage Sanity Check failed
DIRECT_ATTACHED_PUBLIC_IP = 24 // Number of unallocated shared network IPs is low in availability zone
LOCAL_STORAGE = 25 // Remaining unallocated Local Storage is below configured threshold
RESOURCE_LIMIT_EXCEEDED = 26 //Generated when the resource limit exceeds the limit. Currently used for recurring snapshots only
通过调用API命令 listAlerts
,你还可以显示最新的列表。
CloudStack为每个警告生成一个syslog信息。每个syslog信息包含下列格式的字段alertType、message、podId、dataCenterId和clusterId。如果任何字段没有有效值的话,它将不会包含在内。
Date severity_level Management_Server_IP_Address/Name alertType:: value dataCenterId:: value podId:: value clusterId:: value message:: value
例如:
Mar 4 10:13:47 WARN localhost alertType:: managementNode message:: Management server node 127.0.0.1 is up
要配置一个或多个SNMP管理器或者Syslog管理器来接收来自CloudStack 的警告:
对于SNMP管理器,一个安装在你的SNMP管理系统上安装的CloudStack MIB文件。它映射SNMP OIDs到陷阱类型,目的让用户更容易阅读。这个文件必须是公开的。关于如何安装这个文件的更多信息,参阅SNMP管理器提供的文档。
编辑 /etc/cloudstack/management/log4j-cloud.xml文件。
# vi /etc/cloudstack/management/log4j-cloud.xml
使用下面给出的语法添加一个条目。选择你是要添加一个SNMP管理器还是一个Syslog管理器,然后按照适当的示例操作。要指定多个外部管理器,使用逗号(,)将IP地址和其他配置值隔开。
注解
SNMP或Syslog管理器推荐的最大值是20。
下面的例子展示了如果配置两个IP分别为10.1.1.1和10.1.1.2的SNMP管理器。在实际使用中请替换成你的IP、ports和communities。不要改变其他值(name、threshold、class和layout值)。
<appender name="SNMP" class="org.apache.cloudstack.alert.snmp.SnmpTrapAppender">
<param name="Threshold" value="WARN"/> <!-- Do not edit. The alert feature assumes WARN. -->
<param name="SnmpManagerIpAddresses" value="10.1.1.1,10.1.1.2"/>
<param name="SnmpManagerPorts" value="162,162"/>
<param name="SnmpManagerCommunities" value="public,public"/>
<layout class="org.apache.cloudstack.alert.snmp.SnmpEnhancedPatternLayout"> <!-- Do not edit -->
<param name="PairDelimeter" value="//"/>
<param name="KeyValueDelimeter" value="::"/>
</layout>
</appender>
下面的例子展示了如果配置两个IP分别为10.1.1.1和10.1.1.2的Syslog管理器。在实际是使用中请替换成你的IP。你可以设置Facility为任何syslog-defined的值,如 LOCAL0 - LOCAL7。不要改变其他的值。
<appender name="ALERTSYSLOG">
<param name="Threshold" value="WARN"/>
<param name="SyslogHosts" value="10.1.1.1,10.1.1.2"/>
<param name="Facility" value="LOCAL6"/>
<layout>
<param name="ConversionPattern" value=""/>
</layout>
</appender>
如果你的云有多个管理服务器节点,在编辑每个节点中log4j-cloud.xml的时候,重复这些步骤。
当管理服务器正在运行的时候,你做了这些变更,等待一会让变更生效。
**排错:**如果一段之后,在配置的SNMP或者Syslog管理器中没有警告出现,那么log4j-cloud.xml中<appender>的语法可能有错误。检查并确定格式和设置都是正确的。
要移除一个外部SNMP管理器或者Syslog管理器以便它不再接收来自CloudStack 的警告,请删除``/etc/cloudstack/management/log4j-cloud.xml``文件中对应的条目。
根管理员在网络, 帐户,域, 资源域以及整个CloudStack级别可选择设置DNS后缀,域管理员可以在自己的域做这样的设置。要自定义域名并使其有效, 请按照下面的步骤操作。
你使用的网络域的源取决于下面的一些规则。
超级管理员需要经常性的关闭和重启管理服务。
例如,修改全局配置参数之后,要求重启管理服务器。如果您有多个管理服务器节点,请全部重启,以便使新参数值在整个云中生效。
要停止管理服务,在管理服务节点所在的操作系统中运行如下命令:
# service cloudstack-management stop
启动管理服务:
# service cloudstack-management start