自動化巡檢介紹
此巡檢專案在kolla-ansible部署的openstack環境上開發,利用ansible-playbook編排的功能,對巡檢的任務進行編排和資料處理。主要巡檢的物件有IaaS平臺
和OS層面
,IaaS針對openstack平臺的元件的狀態, 資源使用情況等, 及包括ceph叢集、mysql、rabbitmq叢集的狀態檢查。OS針對CPU、記憶體、磁碟等監控指標進行檢查,最終生成excel報告。
專案結構
├── README.md
├── filter_plugins 生成json資料
├── generate_xlsx.yml 生成xlsx檔案
├── group_vars 全域性變數
├── library 資料處理及生成xlsx模組
├── report 最終xlsx報告儲存
├── roles 巡檢程式碼
├── save_data json資料儲存
├── site.yml 巡檢入口
└── xlsx_template 模板
點選檢視專案:IaaS自動化巡檢
注意事項:
部署節點的IP需要放在control主機組的第一位,比如部署節點IP是:1.88.88.1
example:
[control]
1.88.88.1
1.88.88.2
1.88.88.3
執行巡檢並處理json資料
- ansible-playbook -i /etc/ansible/hosts/00-nodes site.yml
資料處理後生成os和platform的json資料(生成xlsx報告使用)
{
"os": {
"1.88.88.1": {
"cpu_usedutilization": "5.17%",
"default_ipv4": "1.88.88.1",
"hostname": "control01",
"mem_usedutilization": "27.46%",
"os_pretty_name": "CentOS Linux 7 (Core)",
"size_usedutilization": "64%",
"uptime": "256"
},
"1.88.88.2": {
"cpu_usedutilization": "9.04%",
"default_ipv4": "1.88.88.2",
"hostname": "control02",
"mem_usedutilization": "37.85%",
"os_pretty_name": "CentOS Linux 7 (Core)",
"size_usedutilization": "56%",
"uptime": "256"
},
"1.88.88.3": {
"cpu_usedutilization": "5.39%",
"default_ipv4": "1.88.88.3",
"hostname": "control03",
"mem_usedutilization": "24.08%",
"os_pretty_name": "CentOS Linux 7 (Core)",
"size_usedutilization": "44%",
"uptime": "256"
},
},
"platform": {
"compute_overview": {
"cinder_volume": true,
"nova_compute": true,
"openvswitch_agent": true
},
"control_overview": {
"control_ceph_mon": true,
"control_cinder": true,
"control_glance": true,
"control_haproxy": true,
"control_heat": true,
"control_horizon": true,
"control_keepalived": true,
"control_keystone": true,
"control_memcached": true,
"control_mysql": true,
"control_network": true,
"control_network_dhcp": true,
"control_neutron": true,
"control_nova": true,
"control_rabbitmq": true
},
"platform_overview": {
"ceph_cluster_overview": {
"ceph_health_status": true,
"ceph_osd_status": true,
"ceph_storage_rate": "1.94%",
"ceph_storage_total": "218TiB",
"ceph_storage_used": "4.2TiB"
},
"cluser_node_count": "8",
"engineer_name": "test",
"iaas_memory_overview": {
"memory_total_gb": "306124GiB",
"memory_total_mb": "3134712",
"memory_used_mb": "245760",
"mepm_used_rate": "7.84%"
},
"iaas_service_overview": {
"ops_cinder": false,
"ops_heat": false,
"ops_neutron": true,
"ops_nova": false
},
"iaas_url": "https://1.88.88253:81",
"iaas_vcpus_overview": {
"vcpus_core_rate": "24.11%",
"vcpus_core_total": "448",
"vcpus_core_used": "108"
},
"iaas_version": "train",
"iaas_vm_sum": 11,
"montior_url": "https://1.88.88.253:3000",
"mysql_cluster_status": true,
"now_day": "2021-03-02",
"rabbitmq_cluster_status": true
}
}
}
生成xlsx巡檢報告
注意:執行前當前節點需要預先安裝openpyxl模組
pip install openpyxl
- ansible-playbook generate_xlsx.yml
xlxs報告模板
IaaS巡檢報告
OS巡檢報告