[轉][自動化]基於kolla部署的openstack自動化巡檢生成xlsx報告
阿新 • • 發佈:2022-03-02
原文:https://www.cnblogs.com/acommoners/p/15948594.html
------------------------
自動化巡檢介紹#
此巡檢專案在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"