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