1. 物理服务器配置
1.1安装
#yum install -y net-snmp net-snmp-utils
1.2 配置
复制【附件】中snmpd.conf文件到/etc/snmp/目录下。(原有的重命名,保存)
关闭selinux和防火墙
#setenforce 0 #vi /etc/sysconfig/selinux 修改为:SELINUX=disabled #service snmpd start #chkconfig snmpd on
2. 在Ceilometer中测试
添加一个已存在的meter
2.1在pipline.yaml新增meter
增加一个内存meter,/etc/ceilometer/pipline.yaml
- name: hardware_memory_source
interval: 60
meters:
- "hardware.memory.*"
resources:
- snmp://172.16.1.212
sinks:
- meter_sink
2.2重启ceilometer
#systemctl restart openstack-ceilometer-central.service
2.3 获取meter
#ceilometer meter-list | grep hardware #ceilometer sample-list -m hardware.memory.total
示例
+--------------+-----------------------+-------+-------------+------+---------------------+
| Resource ID | Name | Type | Volume | Unit | Timestamp |
+--------------+-----------------------+-------+-------------+------+---------------------+
| 172.16.1.212 | hardware.memory.total | gauge | 198293684.0 | B | 2014-12-05T03:41:10 |
| 172.16.1.212 | hardware.memory.total | gauge | 198293684.0 | B | 2014-12-05T03:31:10 |
| 172.16.1.212 | hardware.memory.total | gauge | 198293684.0 | B | 2014-12-05T03:21:10 |
| 172.16.1.212 | hardware.memory.total | gauge | 198293684.0 | B | 2014-12-05T03:11:10 |
| 172.16.1.212 | hardware.memory.total | gauge | 198293684.0 | B | 2014-12-05T03:01:10 |
| 172.16.1.212 | hardware.memory.total | gauge | 198293684.0 | B | 2014-12-05T02:51:10 |
| 172.16.1.212 | hardware.memory.total | gauge | 198293684.0 | B | 2014-12-05T02:41:10 |
| 172.16.1.212 | hardware.memory.total | gauge | 198293684.0 | B | 2014-12-05T02:31:10 |
| 172.16.1.212 | hardware.memory.total | gauge | 198293684.0 | B | 2014-12-05T02:21:10 |
+--------------+-----------------------+-------+-------------+------+---------------------+
3. Ceilometer中使用snmp新增meter
3.1Ceilomter目前支持的OID
分类 |
名称 |
OID |
说明 |
CPU |
_cpu_1_min_load_oid |
1.3.6.1.4.1.2021.10.1.3.1 |
1分钟CPU负载 |
_cpu_5_min_load_oid |
1.3.6.1.4.1.2021.10.1.3.2 |
5分钟CPU负载 |
|
_cpu_15_min_load_oid |
1.3.6.1.4.1.2021.10.1.3.3 |
15分钟CPU负载 |
|
Memory |
_memory_total_oid |
1.3.6.1.4.1.2021.4.5.0 |
内存总量 |
_memory_used_oid |
1.3.6.1.4.1.2021.4.6.0 |
内存已使用 |
|
_memory_total_swap_oid |
1.3.6.1.4.1.2021.4.3.0 |
||
_memory_avail_swap_oid |
1.3.6.1.4.1.2021.4.4.0 |
||
Disk |
_disk_index_oid |
1.3.6.1.4.1.2021.9.1.1 |
磁盘索引 |
_disk_path_oid |
1.3.6.1.4.1.2021.9.1.2 |
磁盘挂载位置 |
|
_disk_device_oid |
1.3.6.1.4.1.2021.9.1.3 |
磁盘挂载名称 |
|
_disk_size_oid |
1.3.6.1.4.1.2021.9.1.6 |
磁盘大小 |
|
_disk_used_oid |
1.3.6.1.4.1.2021.9.1.8 |
磁盘已使用 |
|
Network Interface |
_interface_index_oid |
1.3.6.1.2.1.2.2.1.1 |
网卡索引 |
_interface_name_oid |
1.3.6.1.2.1.2.2.1.2 |
网卡名称 |
|
_interface_speed_oid |
1.3.6.1.2.1.2.2.1.5 |
网卡速度 |
|
_interface_mac_oid |
1.3.6.1.2.1.2.2.1.6 |
网卡mac地址 |
|
_interface_ip_oid |
1.3.6.1.2.1.4.20.1.2 |
网卡ip |
|
_interface_received_oid |
1.3.6.1.2.1.2.2.1.10 |
网卡进流量 |
|
_interface_transmitted_oid |
1.3.6.1.2.1.2.2.1.16 |
网卡出流量 |
|
_interface_error_oid |
1.3.6.1.2.1.2.2.1.20 |
网卡错误包 |
|
System stats |
_system_stats_cpu_idle_oid |
1.3.6.1.4.1.2021.11.11.0 |
系统CPU空闲 |
_system_stats_io_raw_sent_oid |
1.3.6.1.4.1.2021.11.57.0 |
磁盘出IO |
|
_system_stats_io_raw_received_oid |
1.3.6.1.4.1.2021.11.58.0 |
磁盘进IO |
|
_network_ip_out_requests_oid |
1.3.6.1.2.1.4.10.0 |
网卡出访问量 |
|
_network_ip_in_receives_oid |
1.3.6.1.2.1.4.3.0 |
网卡进访问量 |
3.2 新增OID
Pro-path/hardware/inspector/snmp.py SNMPInspector类
#system uptime _system_uptime_oid = ".1.3.6.1.2.1.1.3.0"
3.3 新增Mapping
Pro-path/hardware/inspector/snmp.py
'system.uptime':{ 'matching_type':EXACT, 'metric_oid':(_system_uptime_oid,str), 'metadata':{}, 'post_op':None, }
3.4 处理类
Pro-path/hardware/pollsters/system.py
class SystemUptimePollster(_SystemBase): IDENTIFIER = 'system.uptime' TYPE = sample.TYPE_GAUGE UNIT = '%'
3.5 新增模块
/usr/lib/python2.7/site-packages/ceilometer-2014.2-py2.7.egg-info/entry_points.txt
[ceilometer.poll.central] hardware.system.uptime = ceilometer.hardware.pollsters.system:SystemUptimePollster
3.6测试
参考1.3