csoc
@ -1,11 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# @Time : 2025/03/11 16:07
|
||||
# @Author : 李星辰
|
||||
# @FileName: test.yaml
|
||||
|
||||
#公网防火墙cookie
|
||||
cookie: vindex==41=10=0AB00=0R;supportLang=cn%2Cen;lang=cn;sessionid=200001c53906386d042ccfb219dd9f942b72;loginid=4b66b6a063127e0810278173fc7e4200;200001c53906386d042ccfb219dd9f942b72=true;abcd1234=true;login=false;
|
||||
cookie: vindex==41=18=0AB00=0R;supportLang=cn%2Cen;lang=cn;sessionid=200001f9ff0de95f682d1eb4068b3d58503b;loginid=9f819ffdc670736d76cf2e28a68511e8;200001f9ff0de95f682d1eb4068b3d58503b=true;abcd1234=true;login=false;
|
||||
dtcloud_cookie: Hm_lvt_d980fb2543f406139975c7a72a5a0387=1740971050,1740974075,1741246647; ea6ee7ef65afa3fa0312817d0b12190e=787b65e4f93b05a0765ee0e7a6e2d24c; CECLOUD_OPS_SID=Tm1Sa01tUTRaakF0WW1FeE1DMDBNelUwTFdJMFl6QXROR1ppWWpWallqVXdNMlZsfGRYTmxjaTVvYkhjdVpIUmpiRzkxWkM1amIyMD0=; CECLOUD_OPS_CID=TmpObVpEbG1ORGd0WmpjNU1DMDBObUZtTFdKbVptWXRZVEJpWkRNd1pERTFOakk1fGRYTmxjaTVvYkhjdVpIUmpiRzkxWkM1amIyMD0=
|
||||
mysql:
|
||||
root: SROH9rAd7V+xC9GAaf4ougPGUPaeddd/KB5Or5qn6v9BHp286pZWHWbILgvUqA5j3WcBoRuQhVZ126KryjRTZKbbWuG3b7P7aHVZa2BTd4g/Dk8OCRWDZ0idCbi+68ZY4BCtSNhRHJ3yGvxphR6jeKoRpiNfnQ6iMJkHj00LJi/kQ/Gv/AW+ZLLJFU3PN3LkdbVt6qaexNhZoo7dDL7fyWxlpn/pfpa2kI41MvY8U3c14McB2MSwID8jyHCnk02HFPZC+xkDQU4RLEd+Br8/jcoWRlZvkFx/PW86CDdkskK2Fyun2/Zpo4pzQ1FrjdMpTgO1kR8LTcLLheS8zdSFBg==
|
||||
password: sLy1ZxZBEroGcoSv75P/xigUJ59/Yhsz1Z7896WzArcImdobrwg5+N6QEo4yT6CcpW22Y6bYy6a0ZWYAEzDaKZhOQG0odaUAv/SDP7JM7l7hH987XFJkUauaETu97Ev0kObsbS4laEiEg/+VG8fQrPuD2iRax1IWGXTKOtn+gHlyzSp016OhKOUUKKdW16OaC8AbVX9F3tVp10c2hsQNvLJl27MN5m3jXpoq9CTdcXsk15oHZVuIp3Kj9RWa8azpauiCPEKVE1KPvuJAhPYYakZBAdxGNU7Ye/YPZq68PJZHm6otEsaQxGJB1+DRNYh0oFWN9+aSYph6kAn0p5/c4g==
|
||||
|
||||
root: SROH9rAd7V+xC9GAaf4ougPGUPaeddd/KB5Or5qn6v9BHp286pZWHWbILgvUqA5j3WcBoRuQhVZ126KryjRTZKbbWuG3b7P7aHVZa2BTd4g/Dk8OCRWDZ0idCbi+68ZY4BCtSNhRHJ3yGvxphR6jeKoRpiNfnQ6iMJkHj00LJi/kQ/Gv/AW+ZLLJFU3PN3LkdbVt6qaexNhZoo7dDL7fyWxlpn/pfpa2kI41MvY8U3c14McB2MSwID8jyHCnk02HFPZC+xkDQU4RLEd+Br8/jcoWRlZvkFx/PW86CDdkskK2Fyun2/Zpo4pzQ1FrjdMpTgO1kR8LTcLLheS8zdSFBg==
|
||||
|
300
dtcloud/csoc.json
Normal file
@ -0,0 +1,300 @@
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"message": "成功",
|
||||
"total": 20,
|
||||
"page": 1,
|
||||
"pageSize": 10,
|
||||
"data": [
|
||||
{
|
||||
"id": 55,
|
||||
"uid": "bc23986941ba41a1910f4c118d4b4ce7",
|
||||
"name": "csoc-bcb5cdf6",
|
||||
"clientNum": 1,
|
||||
"logClientNum": 1,
|
||||
"scanClientNum": 1,
|
||||
"payMode": "OnDemand",
|
||||
"regionCode": "dtcloud1",
|
||||
"zoneCode": "az0",
|
||||
"serviceType": 1,
|
||||
"serviceTypeStr": "企业版",
|
||||
"manageStatus": 1,
|
||||
"startTime": "2025-1-21 18:08:29",
|
||||
"expireTime": "2099-11-30 00:00:00",
|
||||
"createTime": "2025-1-21 18:08:29",
|
||||
"updateTime": "2025-1-21 18:08:53",
|
||||
"pin": "",
|
||||
"pinName": "",
|
||||
"createOrderId": "CSOC-1881645028992880640",
|
||||
"tenantId": "1785054946119412649",
|
||||
"deptId": "1926681431100521513",
|
||||
"resourceGroup": "",
|
||||
"tenantName": "一体化政务服务",
|
||||
"departmentName": "一体化新增_秒批秒办",
|
||||
"resourceGroupName": "",
|
||||
"expireDays": 0,
|
||||
"expireHours": 0
|
||||
},
|
||||
{
|
||||
"id": 54,
|
||||
"uid": "306dab13186a46edb789305a4dc03f6a",
|
||||
"name": "csoc-91aa2434",
|
||||
"clientNum": 1,
|
||||
"logClientNum": 1,
|
||||
"scanClientNum": 1,
|
||||
"payMode": "OnDemand",
|
||||
"regionCode": "dtcloud1",
|
||||
"zoneCode": "az0",
|
||||
"serviceType": 1,
|
||||
"serviceTypeStr": "企业版",
|
||||
"manageStatus": 1,
|
||||
"startTime": "2025-1-21 18:07:37",
|
||||
"expireTime": "2099-11-30 00:00:00",
|
||||
"createTime": "2025-1-21 18:07:37",
|
||||
"updateTime": "2025-1-21 18:08:03",
|
||||
"pin": "",
|
||||
"pinName": "",
|
||||
"createOrderId": "CSOC-1881644808183746560",
|
||||
"tenantId": "1785054946119412649",
|
||||
"deptId": "1926681366676012073",
|
||||
"resourceGroup": "",
|
||||
"tenantName": "一体化政务服务",
|
||||
"departmentName": "一体化新增_全市通办",
|
||||
"resourceGroupName": "",
|
||||
"expireDays": 0,
|
||||
"expireHours": 0
|
||||
},
|
||||
{
|
||||
"id": 53,
|
||||
"uid": "abf43491ebb24d3a9ddf40ec114b4a85",
|
||||
"name": "csoc-883189cf",
|
||||
"clientNum": 9,
|
||||
"logClientNum": 9,
|
||||
"scanClientNum": 3,
|
||||
"payMode": "OnDemand",
|
||||
"regionCode": "dtcloud1",
|
||||
"zoneCode": "az0",
|
||||
"serviceType": 1,
|
||||
"serviceTypeStr": "企业版",
|
||||
"manageStatus": 1,
|
||||
"startTime": "2025-2-27 08:03:26",
|
||||
"expireTime": "2099-11-30 00:00:00",
|
||||
"createTime": "2024-12-9 17:13:43",
|
||||
"updateTime": "2025-2-27 16:03:53",
|
||||
"pin": "",
|
||||
"pinName": "",
|
||||
"createOrderId": "CSOC-1895021914234032128",
|
||||
"tenantId": "1910822955311431701",
|
||||
"deptId": "1910822955311431702",
|
||||
"resourceGroup": "",
|
||||
"tenantName": "大同党建网",
|
||||
"departmentName": "大同党建网",
|
||||
"resourceGroupName": "",
|
||||
"expireDays": 0,
|
||||
"expireHours": 0
|
||||
},
|
||||
{
|
||||
"id": 52,
|
||||
"uid": "2fcc2643ad314f3abdbd00ae52b6da6c",
|
||||
"name": "csoc-b884a676",
|
||||
"clientNum": 2,
|
||||
"logClientNum": 2,
|
||||
"scanClientNum": 1,
|
||||
"payMode": "OnDemand",
|
||||
"regionCode": "dtcloud1",
|
||||
"zoneCode": "az0",
|
||||
"serviceType": 1,
|
||||
"serviceTypeStr": "企业版",
|
||||
"manageStatus": 1,
|
||||
"startTime": "2024-12-19 15:08:05",
|
||||
"expireTime": "2099-11-30 00:00:00",
|
||||
"createTime": "2024-12-9 11:39:01",
|
||||
"updateTime": "2024-12-19 15:08:05",
|
||||
"pin": "",
|
||||
"pinName": "",
|
||||
"createOrderId": "CSOC-1865964337005334528",
|
||||
"tenantId": "1910734655078793234",
|
||||
"deptId": "1910734655078793235",
|
||||
"resourceGroup": "",
|
||||
"tenantName": "组织部12380举报网站",
|
||||
"departmentName": "组织部12380举报网站",
|
||||
"resourceGroupName": "",
|
||||
"expireDays": 0,
|
||||
"expireHours": 0
|
||||
},
|
||||
{
|
||||
"id": 50,
|
||||
"uid": "89b2f7bfb86b43719bcb5f5e984b5711",
|
||||
"name": "csoc-f5c5c81c",
|
||||
"clientNum": 2,
|
||||
"logClientNum": 2,
|
||||
"scanClientNum": 0,
|
||||
"payMode": "OnDemand",
|
||||
"regionCode": "dtcloud1",
|
||||
"zoneCode": "az0",
|
||||
"serviceType": 1,
|
||||
"serviceTypeStr": "企业版",
|
||||
"manageStatus": 1,
|
||||
"startTime": "2024-12-6 17:18:57",
|
||||
"expireTime": "2099-11-30 00:00:00",
|
||||
"createTime": "2024-12-6 17:18:57",
|
||||
"updateTime": "2024-12-6 17:19:18",
|
||||
"pin": "",
|
||||
"pinName": "",
|
||||
"createOrderId": "CSOC-1864962718767779840",
|
||||
"tenantId": "1909718143425576967",
|
||||
"deptId": "1909718143425576968",
|
||||
"resourceGroup": "",
|
||||
"tenantName": "大同市委组织部_考核信息管理系统",
|
||||
"departmentName": "大同市委组织部_考核信息管理系统",
|
||||
"resourceGroupName": "",
|
||||
"expireDays": 0,
|
||||
"expireHours": 0
|
||||
},
|
||||
{
|
||||
"id": 49,
|
||||
"uid": "9197fb402f494aef959e4f83f4da6c5b",
|
||||
"name": "csoc-4e2dd013",
|
||||
"clientNum": 2,
|
||||
"logClientNum": 2,
|
||||
"scanClientNum": 0,
|
||||
"payMode": "OnDemand",
|
||||
"regionCode": "dtcloud1",
|
||||
"zoneCode": "az0",
|
||||
"serviceType": 1,
|
||||
"serviceTypeStr": "企业版",
|
||||
"manageStatus": 1,
|
||||
"startTime": "2024-12-6 09:54:26",
|
||||
"expireTime": "2099-11-30 00:00:00",
|
||||
"createTime": "2024-12-6 15:27:04",
|
||||
"updateTime": "2024-12-6 09:54:26",
|
||||
"pin": "",
|
||||
"pinName": "",
|
||||
"createOrderId": "CSOC-1864934566221844480",
|
||||
"tenantId": "1909688108987711503",
|
||||
"deptId": "1909688108987711504",
|
||||
"resourceGroup": "",
|
||||
"tenantName": "行政审批服务管理局_便民系统",
|
||||
"departmentName": "行政审批服务管理局_便民系统",
|
||||
"resourceGroupName": "",
|
||||
"expireDays": 0,
|
||||
"expireHours": 0
|
||||
},
|
||||
{
|
||||
"id": 48,
|
||||
"uid": "02ca086ef44c4d4a96de2c55eb2e8992",
|
||||
"name": "csoc-157c95e0",
|
||||
"clientNum": 7,
|
||||
"logClientNum": 7,
|
||||
"scanClientNum": 0,
|
||||
"payMode": "OnDemand",
|
||||
"regionCode": "dtcloud1",
|
||||
"zoneCode": "az0",
|
||||
"serviceType": 1,
|
||||
"serviceTypeStr": "企业版",
|
||||
"manageStatus": 1,
|
||||
"startTime": "2024-11-14 08:54:34",
|
||||
"expireTime": "2099-11-30 00:00:00",
|
||||
"createTime": "2024-11-14 16:40:13",
|
||||
"updateTime": "2024-11-14 08:54:34",
|
||||
"pin": "",
|
||||
"pinName": "",
|
||||
"createOrderId": "CSOC-1856980440657694720",
|
||||
"tenantId": "1901541651243859980",
|
||||
"deptId": "1901541651243859981",
|
||||
"resourceGroup": "",
|
||||
"tenantName": "煤矿安全风险监测预警系统",
|
||||
"departmentName": "煤矿安全风险监测预警系统",
|
||||
"resourceGroupName": "",
|
||||
"expireDays": 0,
|
||||
"expireHours": 0
|
||||
},
|
||||
{
|
||||
"id": 47,
|
||||
"uid": "8abdd18c2fa343b6b4e6b65d9bd81989",
|
||||
"name": "csoc-93898c0e",
|
||||
"clientNum": 2,
|
||||
"logClientNum": 2,
|
||||
"scanClientNum": 0,
|
||||
"payMode": "OnDemand",
|
||||
"regionCode": "dtcloud1",
|
||||
"zoneCode": "az0",
|
||||
"serviceType": 1,
|
||||
"serviceTypeStr": "企业版",
|
||||
"manageStatus": 1,
|
||||
"startTime": "2024-11-19 03:38:26",
|
||||
"expireTime": "2099-11-30 00:00:00",
|
||||
"createTime": "2024-11-8 16:07:24",
|
||||
"updateTime": "2024-11-19 03:38:26",
|
||||
"pin": "",
|
||||
"pinName": "",
|
||||
"createOrderId": "CSOC-1854797854221012992",
|
||||
"tenantId": "1899308289456340996",
|
||||
"deptId": "1899308289456340997",
|
||||
"resourceGroup": "",
|
||||
"tenantName": "知识产权公共服务平台",
|
||||
"departmentName": "知识产权公共服务平台",
|
||||
"resourceGroupName": "",
|
||||
"expireDays": 0,
|
||||
"expireHours": 0
|
||||
},
|
||||
{
|
||||
"id": 46,
|
||||
"uid": "b52a8f5c84044bdc8e1d81c6e902eabb",
|
||||
"name": "csoc-c95a56d3",
|
||||
"clientNum": 1,
|
||||
"logClientNum": 1,
|
||||
"scanClientNum": 0,
|
||||
"payMode": "OnDemand",
|
||||
"regionCode": "dtcloud1",
|
||||
"zoneCode": "az0",
|
||||
"serviceType": 1,
|
||||
"serviceTypeStr": "企业版",
|
||||
"manageStatus": 1,
|
||||
"startTime": "2024-11-6 02:39:31",
|
||||
"expireTime": "2099-11-30 00:00:00",
|
||||
"createTime": "2024-11-6 10:34:01",
|
||||
"updateTime": "2024-11-6 02:39:31",
|
||||
"pin": "",
|
||||
"pinName": "",
|
||||
"createOrderId": "CSOC-1853989180950974464",
|
||||
"tenantId": "1898482788152115201",
|
||||
"deptId": "1898482788152115202",
|
||||
"resourceGroup": "",
|
||||
"tenantName": "云州区委员会宣传部",
|
||||
"departmentName": "云州区委员会宣传部",
|
||||
"resourceGroupName": "",
|
||||
"expireDays": 0,
|
||||
"expireHours": 0
|
||||
},
|
||||
{
|
||||
"id": 45,
|
||||
"uid": "9bcaea0788c24eac8009929f76e0396e",
|
||||
"name": "csoc-a7d05da0",
|
||||
"clientNum": 2,
|
||||
"logClientNum": 2,
|
||||
"scanClientNum": 0,
|
||||
"payMode": "OnDemand",
|
||||
"regionCode": "dtcloud1",
|
||||
"zoneCode": "az0",
|
||||
"serviceType": 1,
|
||||
"serviceTypeStr": "企业版",
|
||||
"manageStatus": 1,
|
||||
"startTime": "2024-10-24 03:19:38",
|
||||
"expireTime": "2099-11-30 00:00:00",
|
||||
"createTime": "2024-10-24 11:16:36",
|
||||
"updateTime": "2024-10-24 03:19:38",
|
||||
"pin": "",
|
||||
"pinName": "",
|
||||
"createOrderId": "CSOC-1849288855308472320",
|
||||
"tenantId": "1893669818003881990",
|
||||
"deptId": "1893669818003881991",
|
||||
"resourceGroup": "",
|
||||
"tenantName": "大同市市场监督管理局",
|
||||
"departmentName": "大同市市场监督管理局",
|
||||
"resourceGroupName": "",
|
||||
"expireDays": 0,
|
||||
"expireHours": 0
|
||||
}
|
||||
]
|
||||
}
|
@ -1,342 +1,355 @@
|
||||
package dtcloud
|
||||
|
||||
import (
|
||||
"dt_automate/conn"
|
||||
"dt_automate/tool"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/Esword618/unioffice/schema/soo/sml"
|
||||
"github.com/Esword618/unioffice/spreadsheet"
|
||||
)
|
||||
|
||||
var cookieStr = `Hm_lvt_d980fb2543f406139975c7a72a5a0387=1739002779,1741256044; ea6ee7ef65afa3fa0312817d0b12190e=07085eba3fa17d4a9d05f56fdcecab2f; CECLOUD_OPS_CID=WkRBMU1USXlPRGd0WkdZellTMDBZek5pTFdFMll6Z3RNR0UyWm1OaE1qUmxZVFEzfGRYTmxjaTU2ZDNjdVpIUmpiRzkxWkM1amIyMD0=; CECLOUD_OPS_SID=TXpKbE16Um1NR010TkRrek5TMDBORGN4TFdJMU5UY3RPVEptWWpsaU16Z3lOMkprfGRYTmxjaTU2ZDNjdVpIUmpiRzkxWkM1amIyMD0=`
|
||||
|
||||
// 运营平台-获取单个ecs的cpu使用情况
|
||||
func Cpu() {
|
||||
fileData, err := ioutil.ReadFile("dtcloud/cpu.json")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var data map[string]interface{}
|
||||
err = json.Unmarshal(fileData, &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Println(data)
|
||||
}
|
||||
|
||||
// 运营平台-获取单个ecs的memory使用情况
|
||||
func Memory() {
|
||||
fileData, err := ioutil.ReadFile("dtcloud/memory.json")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var data map[string]interface{}
|
||||
err = json.Unmarshal(fileData, &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Println(data)
|
||||
}
|
||||
|
||||
// 运营平台-获取租户列表
|
||||
func TenantList() {
|
||||
ss := spreadsheet.New()
|
||||
sheet := ss.AddSheet()
|
||||
// sheet.SetFrozen(true, false)
|
||||
v := sheet.InitialView()
|
||||
v.SetState(sml.ST_PaneStateFrozen)
|
||||
v.SetXSplit(0) //冻结列
|
||||
v.SetYSplit(1) //冻结行
|
||||
sheet.Cell("A1").SetString("序号")
|
||||
sheet.Cell("B1").SetString("租户ID")
|
||||
sheet.Cell("C1").SetString("用户ID")
|
||||
sheet.Cell("D1").SetString("创建者")
|
||||
sheet.Cell("E1").SetString("昵称")
|
||||
sheet.Cell("F1").SetString("租户用户名")
|
||||
sheet.Cell("G1").SetString("使用状态")
|
||||
sheet.Cell("H1").SetString("创建时间")
|
||||
log.Println("生成表格列名完成")
|
||||
// fileData, err := ioutil.ReadFile("dtcloud/user.json")
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
var num = 1 //页数
|
||||
url := "https://user.zww.dtcloud.com/api/account-tenant/v1/tenant/pageList?pageSize=10&pageNum=" + strconv.Itoa(num) + "&tenantName=&id=&userAdminCode=&userAdminId=&isIdentity=&status=&tenantIdentity=&enterpriseName=&creator="
|
||||
header := map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"cookie": cookieStr,
|
||||
}
|
||||
ecslistStr := conn.DT_GET(url, header, nil)
|
||||
var data map[string]interface{}
|
||||
err := json.Unmarshal([]byte(ecslistStr), &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if data["data"].(map[string]interface{})["total"].(float64) <= 10 {
|
||||
for _, usr := range data["data"].(map[string]interface{})["list"].([]interface{}) {
|
||||
log.Println(len(sheet.Rows()))
|
||||
con := len(sheet.Rows()) + 1
|
||||
a, _ := strconv.ParseInt(usr.(map[string]interface{})["createTime"].(string), 10, 64)
|
||||
sheet.Cell("A" + strconv.Itoa(con)).SetString(strconv.Itoa(len(sheet.Rows()) - 1))
|
||||
sheet.Cell("B" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["id"].(string))
|
||||
sheet.Cell("C" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["userAdminId"].(string))
|
||||
sheet.Cell("D" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["creator"].(string))
|
||||
sheet.Cell("E" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["tenantName"].(string))
|
||||
sheet.Cell("F" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["userAdminCode"].(string))
|
||||
if condition := usr.(map[string]interface{})["useStatus"].(float64); condition == 0 {
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString("正常")
|
||||
} else {
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString("禁用")
|
||||
}
|
||||
sheet.Cell("H" + strconv.Itoa(con)).SetString(time.Unix(a/1000, 0).Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
} else {
|
||||
totalPages := int(math.Floor(data["data"].(map[string]interface{})["total"].(float64))/float64(10) + 1)
|
||||
for i := 0; i < totalPages; i++ {
|
||||
url := "https://user.zww.dtcloud.com/api/account-tenant/v1/tenant/pageList?pageSize=10&pageNum=" + strconv.Itoa(num) + "&tenantName=&id=&userAdminCode=&userAdminId=&isIdentity=&status=&tenantIdentity=&enterpriseName=&creator="
|
||||
header := map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"cookie": cookieStr,
|
||||
}
|
||||
ecslistStr := conn.DT_GET(url, header, nil)
|
||||
var data map[string]interface{}
|
||||
err := json.Unmarshal([]byte(ecslistStr), &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for _, usr := range data["data"].(map[string]interface{})["list"].([]interface{}) {
|
||||
log.Println(len(sheet.Rows()))
|
||||
con := len(sheet.Rows()) + 1
|
||||
a, _ := strconv.ParseInt(usr.(map[string]interface{})["createTime"].(string), 10, 64)
|
||||
sheet.Cell("A" + strconv.Itoa(con)).SetString(strconv.Itoa(len(sheet.Rows()) - 1))
|
||||
sheet.Cell("B" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["id"].(string))
|
||||
sheet.Cell("C" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["userAdminId"].(string))
|
||||
sheet.Cell("D" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["creator"].(string))
|
||||
sheet.Cell("E" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["tenantName"].(string))
|
||||
sheet.Cell("F" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["userAdminCode"].(string))
|
||||
if condition := usr.(map[string]interface{})["useStatus"].(float64); condition == 0 {
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString("正常")
|
||||
} else {
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString("禁用")
|
||||
}
|
||||
sheet.Cell("H" + strconv.Itoa(con)).SetString(time.Unix(a/1000, 0).Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
num++
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 保存修改后的 Excel 文件
|
||||
if err := ss.Validate(); err != nil {
|
||||
log.Fatalf("验证文件时出错: %s", err)
|
||||
}
|
||||
|
||||
if err := ss.SaveToFile("互联网区-运营平台租户列表" + time.Unix(tool.Timestamp("second"), 0).Format("20060102") + ".xlsx"); err != nil {
|
||||
log.Fatalf("保存文件时出错: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 运营平台-获取单ecs进程使用情况
|
||||
func Process() {
|
||||
fileData, err := ioutil.ReadFile("dtcloud/pid.json")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var data map[string]interface{}
|
||||
err = json.Unmarshal(fileData, &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Println(data)
|
||||
}
|
||||
|
||||
// 运营平台-获取ecs列表及其详情
|
||||
func EcsList() {
|
||||
ss := spreadsheet.New()
|
||||
sheet := ss.AddSheet()
|
||||
// sheet.SetFrozen(true, false)
|
||||
v := sheet.InitialView()
|
||||
v.SetState(sml.ST_PaneStateFrozen)
|
||||
v.SetXSplit(0) //冻结列
|
||||
v.SetYSplit(1) //冻结行
|
||||
sheet.Cell("A1").SetString("序号")
|
||||
sheet.Cell("B1").SetString("创建时间")
|
||||
sheet.Cell("C1").SetString("更新时间")
|
||||
sheet.Cell("D1").SetString("过期时间")
|
||||
sheet.Cell("E1").SetString("ECS_ID")
|
||||
sheet.Cell("F1").SetString("租住ID")
|
||||
sheet.Cell("G1").SetString("显示名称")
|
||||
sheet.Cell("H1").SetString("租户名称")
|
||||
sheet.Cell("I1").SetString("所属区域")
|
||||
sheet.Cell("J1").SetString("CPU架构")
|
||||
sheet.Cell("K1").SetString("系统类型")
|
||||
sheet.Cell("L1").SetString("运行状态")
|
||||
sheet.Cell("M1").SetString("CPU核心数")
|
||||
sheet.Cell("N1").SetString("内存/GB")
|
||||
sheet.Cell("O1").SetString("系统磁盘/GB")
|
||||
sheet.Cell("P1").SetString("存储磁盘/GB")
|
||||
sheet.Cell("Q1").SetString("宿主机IP")
|
||||
sheet.Cell("R1").SetString("MAC地址")
|
||||
sheet.Cell("S1").SetString("安全组")
|
||||
sheet.Cell("T1").SetString("网络类型")
|
||||
sheet.Cell("U1").SetString("EIP")
|
||||
sheet.Cell("V1").SetString("带宽大小(入/出)")
|
||||
sheet.Cell("W1").SetString("部门名称")
|
||||
sheet.Cell("X1").SetString("部门ID")
|
||||
sheet.Cell("Y1").SetString("主机型号")
|
||||
sheet.Cell("Z1").SetString("CPU型号")
|
||||
sheet.Cell("AA1").SetString("CPU模式")
|
||||
sheet.Cell("AB1").SetString("nodeName")
|
||||
sheet.Cell("AC1").SetString("cpu超出比率")
|
||||
log.Println("生成表格列名完成")
|
||||
// 加载json文件
|
||||
// fileData, err := ioutil.ReadFile("dtcloud/ecs.json")
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
// var data map[string]interface{}
|
||||
// err = json.Unmarshal(fileData, &data)
|
||||
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
var num = 1 //页数
|
||||
url := "https://user.zww.dtcloud.com/api/ecs/v1/instances?requestInfo=dtcloud2&pageSize=10&pageNumber=" + strconv.Itoa(num) + "&filter=&orderBy=created_at:desc"
|
||||
header := map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"cookie": cookieStr,
|
||||
}
|
||||
ecslistStr := conn.DT_GET(url, header, nil)
|
||||
var data map[string]interface{}
|
||||
err := json.Unmarshal([]byte(ecslistStr), &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if data["data"].(map[string]interface{})["totalCount"].(float64) <= 10 {
|
||||
for _, ecs := range data["data"].(map[string]interface{})["virtualMachines"].([]interface{}) {
|
||||
log.Println(len(sheet.Rows()))
|
||||
con := len(sheet.Rows()) + 1
|
||||
sheet.Cell("A" + strconv.Itoa(con)).SetString(strconv.Itoa(len(sheet.Rows()) - 1)) //序号
|
||||
sheet.Cell("B" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["createdAt"].(string)) //创建时间
|
||||
sheet.Cell("C" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["updatedAt"].(string)) //更新时间
|
||||
sheet.Cell("D" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["expiredAt"].(string)) //过期时间
|
||||
sheet.Cell("E" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["ecsId"].(string)) //ECS_ID
|
||||
sheet.Cell("F" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["tenantId"].(string)) //租住ID
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["displayName"].(string)) //显示名称
|
||||
sheet.Cell("H" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["tenantName"].(string)) //租户名称
|
||||
sheet.Cell("I" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["region"].(string) + "/" + ecs.(map[string]interface{})["az"].(string) + "/" + ecs.(map[string]interface{})["cell"].(string)) //所属区域(X/X/X)
|
||||
sheet.Cell("J" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["cpuArch"].(string)) //CPU架构
|
||||
sheet.Cell("K" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["osType"].(string)) //系统类型
|
||||
sheet.Cell("L" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["status"].(string)) //运行状态
|
||||
sheet.Cell("M" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["vCpus"].(float64))) + "核") //CPU核心数
|
||||
sheet.Cell("N" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["ram"].(float64))/1024/1024/1024) + "GB") //内存/GB
|
||||
var diskStrsys string
|
||||
var diskStrdata string
|
||||
for _, disk := range ecs.(map[string]interface{})["blockDeviceMappings"].([]interface{}) {
|
||||
if disk.(map[string]interface{})["isOSDisk"] != nil {
|
||||
if condition := disk.(map[string]interface{})["isOSDisk"].(bool); condition == true {
|
||||
diskStrsys += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块系统盘拼接
|
||||
} else {
|
||||
diskStrdata += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块存储盘拼接
|
||||
}
|
||||
} else {
|
||||
diskStrdata += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块存储盘拼接
|
||||
}
|
||||
}
|
||||
sheet.Cell("O" + strconv.Itoa(con)).SetString(diskStrsys) //系统磁盘/GB
|
||||
sheet.Cell("P" + strconv.Itoa(con)).SetString(diskStrdata) //存储磁盘/GB
|
||||
sheet.Cell("Q" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["ipv4Address"].(string)) //宿主机IP
|
||||
sheet.Cell("R" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["macAddress"].(string)) //MAC地址
|
||||
sheet.Cell("S" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["portType"].(string)) //安全组
|
||||
sheet.Cell("T" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["networkType"].(string)) //网络类型
|
||||
sheet.Cell("U" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["ipAddress"].(string)) //EIP
|
||||
sheet.Cell("V" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["bandwidthInSize"].(float64))) + "/" + strconv.Itoa(int(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["bandwidthOutSize"].(float64)))) //带宽大小(入/出)
|
||||
sheet.Cell("W" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["departmentName"].(string)) //部门名称
|
||||
sheet.Cell("X" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["departmentId"].(string)) //部门ID
|
||||
sheet.Cell("Y" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["flavor"].(map[string]interface{})["flavorType"].(map[string]interface{})["name"].(string)) //主机型号
|
||||
sheet.Cell("Z" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["flavor"].(map[string]interface{})["flavorType"].(map[string]interface{})["cpuModel"].(string)) //CPU型号
|
||||
sheet.Cell("AA" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["vcpuType"].(string)) //CPU模式
|
||||
sheet.Cell("AB" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["nodeName"].(string))
|
||||
sheet.Cell("AC" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["cpuExceedRatio"].(float64)))) //cpu超出比率
|
||||
}
|
||||
} else {
|
||||
totalPages := int(math.Floor(data["data"].(map[string]interface{})["totalCount"].(float64))/float64(10) + 1)
|
||||
for i := 0; i < totalPages; i++ {
|
||||
url := "https://user.zww.dtcloud.com/api/ecs/v1/instances?requestInfo=dtcloud2&pageSize=10&pageNumber=" + strconv.Itoa(num) + "&filter=&orderBy=created_at:desc"
|
||||
header := map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"cookie": cookieStr,
|
||||
}
|
||||
ecslistStr := conn.DT_GET(url, header, nil)
|
||||
var data map[string]interface{}
|
||||
err := json.Unmarshal([]byte(ecslistStr), &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for _, ecs := range data["data"].(map[string]interface{})["virtualMachines"].([]interface{}) {
|
||||
log.Println(len(sheet.Rows()))
|
||||
con := len(sheet.Rows()) + 1
|
||||
sheet.Cell("A" + strconv.Itoa(con)).SetString(strconv.Itoa(len(sheet.Rows()) - 1)) //序号
|
||||
sheet.Cell("B" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["createdAt"].(string)) //创建时间
|
||||
sheet.Cell("C" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["updatedAt"].(string)) //更新时间
|
||||
sheet.Cell("D" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["expiredAt"].(string)) //过期时间
|
||||
sheet.Cell("E" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["ecsId"].(string)) //ECS_ID
|
||||
sheet.Cell("F" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["tenantId"].(string)) //租住ID
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["displayName"].(string)) //显示名称
|
||||
sheet.Cell("H" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["tenantName"].(string)) //租户名称
|
||||
sheet.Cell("I" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["region"].(string) + "/" + ecs.(map[string]interface{})["az"].(string) + "/" + ecs.(map[string]interface{})["cell"].(string)) //所属区域(X/X/X)
|
||||
sheet.Cell("J" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["cpuArch"].(string)) //CPU架构
|
||||
sheet.Cell("K" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["osType"].(string)) //系统类型
|
||||
sheet.Cell("L" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["status"].(string)) //运行状态
|
||||
sheet.Cell("M" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["vCpus"].(float64))) + "核") //CPU核心数
|
||||
sheet.Cell("N" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["ram"].(float64))/1024/1024/1024) + "GB") //内存/GB
|
||||
var diskStrsys string
|
||||
var diskStrdata string
|
||||
for _, disk := range ecs.(map[string]interface{})["blockDeviceMappings"].([]interface{}) {
|
||||
if disk.(map[string]interface{})["isOSDisk"] != nil {
|
||||
if condition := disk.(map[string]interface{})["isOSDisk"].(bool); condition == true {
|
||||
diskStrsys += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块系统盘拼接
|
||||
} else {
|
||||
diskStrdata += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块存储盘拼接
|
||||
}
|
||||
} else {
|
||||
diskStrdata += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块存储盘拼接
|
||||
}
|
||||
}
|
||||
sheet.Cell("O" + strconv.Itoa(con)).SetString(diskStrsys) //系统磁盘/GB
|
||||
sheet.Cell("P" + strconv.Itoa(con)).SetString(diskStrdata) //存储磁盘/GB
|
||||
sheet.Cell("Q" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["ipv4Address"].(string)) //宿主机IP
|
||||
sheet.Cell("R" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["macAddress"].(string)) //MAC地址
|
||||
sheet.Cell("S" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["portType"].(string)) //安全组
|
||||
sheet.Cell("T" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["networkType"].(string)) //网络类型
|
||||
sheet.Cell("U" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["ipAddress"].(string)) //EIP
|
||||
sheet.Cell("V" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["bandwidthInSize"].(float64))) + "/" + strconv.Itoa(int(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["bandwidthOutSize"].(float64)))) //带宽大小(入/出)
|
||||
sheet.Cell("W" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["departmentName"].(string)) //部门名称
|
||||
sheet.Cell("X" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["departmentId"].(string)) //部门ID
|
||||
sheet.Cell("Y" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["flavor"].(map[string]interface{})["flavorType"].(map[string]interface{})["name"].(string)) //主机型号
|
||||
sheet.Cell("Z" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["flavor"].(map[string]interface{})["flavorType"].(map[string]interface{})["cpuModel"].(string)) //CPU型号
|
||||
sheet.Cell("AA" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["vcpuType"].(string)) //CPU模式
|
||||
sheet.Cell("AB" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["nodeName"].(string))
|
||||
sheet.Cell("AC" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["cpuExceedRatio"].(float64)))) //cpu超出比率
|
||||
}
|
||||
num++
|
||||
}
|
||||
}
|
||||
// 保存修改后的 Excel 文件
|
||||
|
||||
if err := ss.Validate(); err != nil {
|
||||
log.Fatalf("验证文件时出错: %s", err)
|
||||
}
|
||||
|
||||
if err := ss.SaveToFile("互联网区-运营平台ECS列表" + time.Unix(tool.Timestamp("second"), 0).Format("20060102") + ".xlsx"); err != nil {
|
||||
log.Fatalf("保存文件时出错: %s", err)
|
||||
}
|
||||
}
|
||||
package dtcloud
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"dt_automate/conf"
|
||||
"dt_automate/conn"
|
||||
"dt_automate/tool"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"math"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/Esword618/unioffice/schema/soo/sml"
|
||||
"github.com/Esword618/unioffice/spreadsheet"
|
||||
)
|
||||
|
||||
var cookieStr = conf.GET_Config_yaml("dtcloud_cookie").(string)
|
||||
|
||||
// 运营平台-获取单个ecs的cpu使用情况
|
||||
func Cpu() {
|
||||
fileData, err := ioutil.ReadFile("dtcloud/cpu.json")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var data map[string]interface{}
|
||||
err = json.Unmarshal(fileData, &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Println(data)
|
||||
}
|
||||
|
||||
// 运营平台-获取单个ecs的memory使用情况
|
||||
func Memory() {
|
||||
fileData, err := ioutil.ReadFile("dtcloud/memory.json")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var data map[string]interface{}
|
||||
err = json.Unmarshal(fileData, &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Println(data)
|
||||
}
|
||||
|
||||
// 运营平台-获取租户列表
|
||||
func TenantList() {
|
||||
ss := spreadsheet.New()
|
||||
sheet := ss.AddSheet()
|
||||
// sheet.SetFrozen(true, false)
|
||||
v := sheet.InitialView()
|
||||
v.SetState(sml.ST_PaneStateFrozen)
|
||||
v.SetXSplit(0) //冻结列
|
||||
v.SetYSplit(1) //冻结行
|
||||
sheet.Cell("A1").SetString("序号")
|
||||
sheet.Cell("B1").SetString("租户ID")
|
||||
sheet.Cell("C1").SetString("用户ID")
|
||||
sheet.Cell("D1").SetString("创建者")
|
||||
sheet.Cell("E1").SetString("昵称")
|
||||
sheet.Cell("F1").SetString("租户用户名")
|
||||
sheet.Cell("G1").SetString("使用状态")
|
||||
sheet.Cell("H1").SetString("创建时间")
|
||||
log.Println("生成表格列名完成")
|
||||
// fileData, err := ioutil.ReadFile("dtcloud/user.json")
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
var num = 1 //页数
|
||||
url := "https://user.hlw.dtcloud.com/api/account-tenant/v1/tenant/pageList?pageSize=10&pageNum=" + strconv.Itoa(num) + "&tenantName=&id=&userAdminCode=&userAdminId=&isIdentity=&status=&tenantIdentity=&enterpriseName=&creator="
|
||||
header := map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"cookie": cookieStr,
|
||||
}
|
||||
ecslistStr := conn.DT_GET(url, header, nil)
|
||||
var data map[string]interface{}
|
||||
err := json.Unmarshal([]byte(ecslistStr), &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if data["data"].(map[string]interface{})["total"].(float64) <= 10 {
|
||||
for _, usr := range data["data"].(map[string]interface{})["list"].([]interface{}) {
|
||||
log.Println(len(sheet.Rows()))
|
||||
con := len(sheet.Rows()) + 1
|
||||
a, _ := strconv.ParseInt(usr.(map[string]interface{})["createTime"].(string), 10, 64)
|
||||
sheet.Cell("A" + strconv.Itoa(con)).SetString(strconv.Itoa(len(sheet.Rows()) - 1))
|
||||
sheet.Cell("B" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["id"].(string))
|
||||
sheet.Cell("C" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["userAdminId"].(string))
|
||||
sheet.Cell("D" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["creator"].(string))
|
||||
sheet.Cell("E" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["tenantName"].(string))
|
||||
sheet.Cell("F" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["userAdminCode"].(string))
|
||||
if condition := usr.(map[string]interface{})["useStatus"].(float64); condition == 0 {
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString("正常")
|
||||
} else {
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString("禁用")
|
||||
}
|
||||
sheet.Cell("H" + strconv.Itoa(con)).SetString(time.Unix(a/1000, 0).Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
} else {
|
||||
totalPages := int(math.Floor(data["data"].(map[string]interface{})["total"].(float64))/float64(10) + 1)
|
||||
for i := 0; i < totalPages; i++ {
|
||||
url := "https://user.hlw.dtcloud.com/api/account-tenant/v1/tenant/pageList?pageSize=10&pageNum=" + strconv.Itoa(num) + "&tenantName=&id=&userAdminCode=&userAdminId=&isIdentity=&status=&tenantIdentity=&enterpriseName=&creator="
|
||||
header := map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"cookie": cookieStr,
|
||||
}
|
||||
ecslistStr := conn.DT_GET(url, header, nil)
|
||||
var data map[string]interface{}
|
||||
err := json.Unmarshal([]byte(ecslistStr), &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for _, usr := range data["data"].(map[string]interface{})["list"].([]interface{}) {
|
||||
log.Println(len(sheet.Rows()))
|
||||
con := len(sheet.Rows()) + 1
|
||||
a, _ := strconv.ParseInt(usr.(map[string]interface{})["createTime"].(string), 10, 64)
|
||||
sheet.Cell("A" + strconv.Itoa(con)).SetString(strconv.Itoa(len(sheet.Rows()) - 1))
|
||||
sheet.Cell("B" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["id"].(string))
|
||||
sheet.Cell("C" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["userAdminId"].(string))
|
||||
sheet.Cell("D" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["creator"].(string))
|
||||
sheet.Cell("E" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["tenantName"].(string))
|
||||
sheet.Cell("F" + strconv.Itoa(con)).SetString(usr.(map[string]interface{})["userAdminCode"].(string))
|
||||
if condition := usr.(map[string]interface{})["useStatus"].(float64); condition == 0 {
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString("正常")
|
||||
} else {
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString("禁用")
|
||||
}
|
||||
sheet.Cell("H" + strconv.Itoa(con)).SetString(time.Unix(a/1000, 0).Format("2006-01-02 15:04:05"))
|
||||
}
|
||||
num++
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// 保存修改后的 Excel 文件
|
||||
if err := ss.Validate(); err != nil {
|
||||
log.Fatalf("验证文件时出错: %s", err)
|
||||
}
|
||||
|
||||
if err := ss.SaveToFile("互联网区-运营平台租户列表" + time.Unix(tool.Timestamp("second"), 0).Format("20060102") + ".xlsx"); err != nil {
|
||||
log.Fatalf("保存文件时出错: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 运营平台-获取单ecs进程使用情况
|
||||
func Process() {
|
||||
fileData, err := ioutil.ReadFile("dtcloud/pid.json")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
var data map[string]interface{}
|
||||
err = json.Unmarshal(fileData, &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Println(data)
|
||||
}
|
||||
|
||||
// 运营平台-获取ecs列表及其详情
|
||||
func EcsList() {
|
||||
ss := spreadsheet.New()
|
||||
sheet := ss.AddSheet()
|
||||
// sheet.SetFrozen(true, false)
|
||||
v := sheet.InitialView()
|
||||
v.SetState(sml.ST_PaneStateFrozen)
|
||||
v.SetXSplit(0) //冻结列
|
||||
v.SetYSplit(1) //冻结行
|
||||
sheet.Cell("A1").SetString("序号")
|
||||
sheet.Cell("B1").SetString("创建时间")
|
||||
sheet.Cell("C1").SetString("更新时间")
|
||||
sheet.Cell("D1").SetString("过期时间")
|
||||
sheet.Cell("E1").SetString("ECS_ID")
|
||||
sheet.Cell("F1").SetString("租住ID")
|
||||
sheet.Cell("G1").SetString("显示名称")
|
||||
sheet.Cell("H1").SetString("租户名称")
|
||||
sheet.Cell("I1").SetString("所属区域")
|
||||
sheet.Cell("J1").SetString("CPU架构")
|
||||
sheet.Cell("K1").SetString("系统类型")
|
||||
sheet.Cell("L1").SetString("运行状态")
|
||||
sheet.Cell("M1").SetString("CPU核心数")
|
||||
sheet.Cell("N1").SetString("内存/GB")
|
||||
sheet.Cell("O1").SetString("系统磁盘/GB")
|
||||
sheet.Cell("P1").SetString("存储磁盘/GB")
|
||||
sheet.Cell("Q1").SetString("宿主机IP")
|
||||
sheet.Cell("R1").SetString("MAC地址")
|
||||
sheet.Cell("S1").SetString("安全组")
|
||||
sheet.Cell("T1").SetString("网络类型")
|
||||
sheet.Cell("U1").SetString("EIP")
|
||||
sheet.Cell("V1").SetString("带宽大小(入/出)")
|
||||
sheet.Cell("W1").SetString("部门名称")
|
||||
sheet.Cell("X1").SetString("部门ID")
|
||||
sheet.Cell("Y1").SetString("主机型号")
|
||||
sheet.Cell("Z1").SetString("CPU型号")
|
||||
sheet.Cell("AA1").SetString("CPU模式")
|
||||
sheet.Cell("AB1").SetString("nodeName")
|
||||
sheet.Cell("AC1").SetString("cpu超出比率")
|
||||
log.Println("生成表格列名完成")
|
||||
// 加载json文件
|
||||
// fileData, err := ioutil.ReadFile("dtcloud/ecs.json")
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
// var data map[string]interface{}
|
||||
// err = json.Unmarshal(fileData, &data)
|
||||
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
url := "https://user.hlw.dtcloud.com/api/ecs/v1/instances?requestInfo=dtcloud2&pageSize=10&pageNumber=1&filter=&orderBy=created_at:desc"
|
||||
header := map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"cookie": cookieStr,
|
||||
}
|
||||
ecslistStr := conn.DT_GET(url, header, nil)
|
||||
var data map[string]interface{}
|
||||
err := json.Unmarshal([]byte(ecslistStr), &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if data["data"].(map[string]interface{})["totalCount"].(float64) <= 10 {
|
||||
for _, ecs := range data["data"].(map[string]interface{})["virtualMachines"].([]interface{}) {
|
||||
log.Println(len(sheet.Rows()))
|
||||
con := len(sheet.Rows()) + 1
|
||||
sheet.Cell("A" + strconv.Itoa(con)).SetString(strconv.Itoa(len(sheet.Rows()) - 1)) //序号
|
||||
sheet.Cell("B" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["createdAt"].(string)) //创建时间
|
||||
sheet.Cell("C" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["updatedAt"].(string)) //更新时间
|
||||
sheet.Cell("D" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["expiredAt"].(string)) //过期时间
|
||||
sheet.Cell("E" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["ecsId"].(string)) //ECS_ID
|
||||
sheet.Cell("F" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["tenantId"].(string)) //租住ID
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["displayName"].(string)) //显示名称
|
||||
sheet.Cell("H" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["tenantName"].(string)) //租户名称
|
||||
sheet.Cell("I" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["region"].(string) + "/" + ecs.(map[string]interface{})["az"].(string) + "/" + ecs.(map[string]interface{})["cell"].(string)) //所属区域(X/X/X)
|
||||
sheet.Cell("J" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["cpuArch"].(string)) //CPU架构
|
||||
sheet.Cell("K" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["osType"].(string)) //系统类型
|
||||
sheet.Cell("L" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["status"].(string)) //运行状态
|
||||
sheet.Cell("M" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["vCpus"].(float64))) + "核") //CPU核心数
|
||||
sheet.Cell("N" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["ram"].(float64))/1024/1024/1024) + "GB") //内存/GB
|
||||
var diskStrsys string
|
||||
var diskStrdata string
|
||||
for _, disk := range ecs.(map[string]interface{})["blockDeviceMappings"].([]interface{}) {
|
||||
if disk.(map[string]interface{})["isOSDisk"] != nil {
|
||||
if condition := disk.(map[string]interface{})["isOSDisk"].(bool); condition == true {
|
||||
diskStrsys += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块系统盘拼接
|
||||
} else {
|
||||
diskStrdata += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块存储盘拼接
|
||||
}
|
||||
} else {
|
||||
diskStrdata += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块存储盘拼接
|
||||
}
|
||||
}
|
||||
sheet.Cell("O" + strconv.Itoa(con)).SetString(diskStrsys) //系统磁盘/GB
|
||||
sheet.Cell("P" + strconv.Itoa(con)).SetString(diskStrdata) //存储磁盘/GB
|
||||
sheet.Cell("Q" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["ipv4Address"].(string)) //宿主机IP
|
||||
sheet.Cell("R" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["macAddress"].(string)) //MAC地址
|
||||
sheet.Cell("S" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["portType"].(string)) //安全组
|
||||
sheet.Cell("T" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["networkType"].(string)) //网络类型
|
||||
sheet.Cell("U" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["ipAddress"].(string)) //EIP
|
||||
sheet.Cell("V" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["bandwidthInSize"].(float64))) + "/" + strconv.Itoa(int(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["bandwidthOutSize"].(float64)))) //带宽大小(入/出)
|
||||
sheet.Cell("W" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["departmentName"].(string)) //部门名称
|
||||
sheet.Cell("X" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["departmentId"].(string)) //部门ID
|
||||
sheet.Cell("Y" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["flavor"].(map[string]interface{})["flavorType"].(map[string]interface{})["name"].(string)) //主机型号
|
||||
sheet.Cell("Z" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["flavor"].(map[string]interface{})["flavorType"].(map[string]interface{})["cpuModel"].(string)) //CPU型号
|
||||
sheet.Cell("AA" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["vcpuType"].(string)) //CPU模式
|
||||
sheet.Cell("AB" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["nodeName"].(string))
|
||||
sheet.Cell("AC" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["cpuExceedRatio"].(float64)))) //cpu超出比率
|
||||
}
|
||||
} else {
|
||||
totalPages := int(math.Floor(data["data"].(map[string]interface{})["totalCount"].(float64))/float64(10) + 1)
|
||||
for i := 0; i < totalPages; i++ {
|
||||
url := "https://user.hlw.dtcloud.com/api/ecs/v1/instances?requestInfo=dtcloud2&pageSize=10&pageNumber=" + strconv.Itoa(i+1) + "&filter=&orderBy=created_at:desc"
|
||||
header := map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"cookie": cookieStr,
|
||||
}
|
||||
ecslistStr := conn.DT_GET(url, header, nil)
|
||||
var data map[string]interface{}
|
||||
err := json.Unmarshal([]byte(ecslistStr), &data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
for _, ecs := range data["data"].(map[string]interface{})["virtualMachines"].([]interface{}) {
|
||||
log.Println(len(sheet.Rows()))
|
||||
con := len(sheet.Rows()) + 1
|
||||
sheet.Cell("A" + strconv.Itoa(con)).SetString(strconv.Itoa(len(sheet.Rows()) - 1)) //序号
|
||||
sheet.Cell("B" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["createdAt"].(string)) //创建时间
|
||||
sheet.Cell("C" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["updatedAt"].(string)) //更新时间
|
||||
sheet.Cell("D" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["expiredAt"].(string)) //过期时间
|
||||
sheet.Cell("E" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["ecsId"].(string)) //ECS_ID
|
||||
sheet.Cell("F" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["tenantId"].(string)) //租住ID
|
||||
sheet.Cell("G" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["displayName"].(string)) //显示名称
|
||||
sheet.Cell("H" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["tenantName"].(string)) //租户名称
|
||||
sheet.Cell("I" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["region"].(string) + "/" + ecs.(map[string]interface{})["az"].(string) + "/" + ecs.(map[string]interface{})["cell"].(string)) //所属区域(X/X/X)
|
||||
sheet.Cell("J" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["cpuArch"].(string)) //CPU架构
|
||||
sheet.Cell("K" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["osType"].(string)) //系统类型
|
||||
sheet.Cell("L" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["status"].(string)) //运行状态
|
||||
sheet.Cell("M" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["vCpus"].(float64))) + "核") //CPU核心数
|
||||
sheet.Cell("N" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["ram"].(float64))/1024/1024/1024) + "GB") //内存/GB
|
||||
var diskStrsys string
|
||||
var diskStrdata string
|
||||
for _, disk := range ecs.(map[string]interface{})["blockDeviceMappings"].([]interface{}) {
|
||||
if disk.(map[string]interface{})["isOSDisk"] != nil {
|
||||
if condition := disk.(map[string]interface{})["isOSDisk"].(bool); condition == true {
|
||||
diskStrsys += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块系统盘拼接
|
||||
} else {
|
||||
diskStrdata += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块存储盘拼接
|
||||
}
|
||||
} else {
|
||||
diskStrdata += fmt.Sprintf("%sGB/", strconv.Itoa(int(disk.(map[string]interface{})["volumeSize"].(float64)))) //多块存储盘拼接
|
||||
}
|
||||
}
|
||||
sheet.Cell("O" + strconv.Itoa(con)).SetString(diskStrsys) //系统磁盘/GB
|
||||
sheet.Cell("P" + strconv.Itoa(con)).SetString(diskStrdata) //存储磁盘/GB
|
||||
sheet.Cell("Q" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["ipv4Address"].(string)) //宿主机IP
|
||||
sheet.Cell("R" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["macAddress"].(string)) //MAC地址
|
||||
sheet.Cell("S" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["portType"].(string)) //安全组
|
||||
sheet.Cell("T" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["networkMappings"].([]interface{})[0].(map[string]interface{})["networkType"].(string)) //网络类型
|
||||
sheet.Cell("U" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["ipAddress"].(string)) //EIP
|
||||
sheet.Cell("V" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["bandwidthInSize"].(float64))) + "/" + strconv.Itoa(int(ecs.(map[string]interface{})["eipMappings"].([]interface{})[0].(map[string]interface{})["bandwidthOutSize"].(float64)))) //带宽大小(入/出)
|
||||
sheet.Cell("W" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["departmentName"].(string)) //部门名称
|
||||
sheet.Cell("X" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["departmentId"].(string)) //部门ID
|
||||
sheet.Cell("Y" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["flavor"].(map[string]interface{})["flavorType"].(map[string]interface{})["name"].(string)) //主机型号
|
||||
sheet.Cell("Z" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["flavor"].(map[string]interface{})["flavorType"].(map[string]interface{})["cpuModel"].(string)) //CPU型号
|
||||
sheet.Cell("AA" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["vcpuType"].(string)) //CPU模式
|
||||
sheet.Cell("AB" + strconv.Itoa(con)).SetString(ecs.(map[string]interface{})["nodeName"].(string))
|
||||
sheet.Cell("AC" + strconv.Itoa(con)).SetString(strconv.Itoa(int(ecs.(map[string]interface{})["cpuExceedRatio"].(float64)))) //cpu超出比率
|
||||
}
|
||||
}
|
||||
}
|
||||
// 保存修改后的 Excel 文件
|
||||
|
||||
if err := ss.Validate(); err != nil {
|
||||
log.Fatalf("验证文件时出错: %s", err)
|
||||
}
|
||||
|
||||
if err := ss.SaveToFile("互联网区-运营平台ECS列表" + time.Unix(tool.Timestamp("second"), 0).Format("20060102") + ".xlsx"); err != nil {
|
||||
log.Fatalf("保存文件时出错: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取云安全中心csoc实例
|
||||
func CsocList() {
|
||||
json := `{"pageSize":10,"pageNum":1}`
|
||||
header := map[string]string{
|
||||
"Content-Type": "application/json",
|
||||
"cookie": cookieStr,
|
||||
}
|
||||
data := conn.DT_POST("https://user.hlw.dtcloud.com/api/soc/v1/instance/page", header, bytes.NewBufferString(json))
|
||||
log.Println(data)
|
||||
}
|
||||
|
||||
//
|
@ -1 +1 @@
|
||||
package dtcloud
|
||||
package dtcloud
|
Before Width: | Height: | Size: 182 KiB After Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 248 KiB After Width: | Height: | Size: 250 KiB |
BIN
img/capt.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
img/hw_baolj.png
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 200 KiB |
Before Width: | Height: | Size: 268 KiB After Width: | Height: | Size: 269 KiB |
Before Width: | Height: | Size: 252 KiB After Width: | Height: | Size: 251 KiB |
Before Width: | Height: | Size: 977 KiB After Width: | Height: | Size: 246 KiB |
Before Width: | Height: | Size: 224 KiB After Width: | Height: | Size: 223 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 244 KiB After Width: | Height: | Size: 118 KiB |
Before Width: | Height: | Size: 175 KiB After Width: | Height: | Size: 695 KiB |
Before Width: | Height: | Size: 997 KiB After Width: | Height: | Size: 999 KiB |
BIN
img/hw_fw1.png
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 381 KiB |
BIN
img/hw_tsgz.png
Before Width: | Height: | Size: 229 KiB After Width: | Height: | Size: 203 KiB |
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 194 KiB |
Before Width: | Height: | Size: 259 KiB After Width: | Height: | Size: 259 KiB |
Before Width: | Height: | Size: 251 KiB After Width: | Height: | Size: 250 KiB |
Before Width: | Height: | Size: 254 KiB After Width: | Height: | Size: 241 KiB |
Before Width: | Height: | Size: 227 KiB After Width: | Height: | Size: 226 KiB |
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 242 KiB After Width: | Height: | Size: 242 KiB |
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 694 KiB |
Before Width: | Height: | Size: 288 KiB After Width: | Height: | Size: 287 KiB |
BIN
img/zww_fw1.png
Before Width: | Height: | Size: 214 KiB After Width: | Height: | Size: 189 KiB |
BIN
img/zww_tsgz.png
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 133 KiB |
17
main.go
@ -2,7 +2,10 @@ package main
|
||||
|
||||
import (
|
||||
"dt_automate/auth"
|
||||
_ "dt_automate/method"
|
||||
"dt_automate/tool"
|
||||
"dt_automate/wps"
|
||||
_ "dt_automate/wps"
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
@ -66,7 +69,7 @@ func main() {
|
||||
} else {
|
||||
log.Printf("授权未到期,剩余时间:%d天 %d小时 %d分钟 %d秒", days, hours, minutes, secod)
|
||||
//可执行程序位置
|
||||
// // 互联网区截图
|
||||
// 互联网区截图
|
||||
// method.HW_FAC1() //截取流量清洗的图片
|
||||
// method.HW_FW1() //截取防火墙的图片
|
||||
// method.HW_TSGZ() //截取态势感知的图片
|
||||
@ -74,16 +77,16 @@ func main() {
|
||||
// method.HW_BAOLJ() //截取堡垒机的图片
|
||||
|
||||
// //政务网区截图
|
||||
// method.ZWW_FW1() //截取防火墙的图片
|
||||
// method.ZWW_FW1() //截取防火墙的图片
|
||||
// method.ZWW_TSGZ() //截取态势感知的图片
|
||||
// method.ZWW_DTCLOUD() //截取运维中心的图片
|
||||
// method.ZWWW_BAOLJ() //截取堡垒机的图片
|
||||
// 互联网区运维巡检文档生成
|
||||
// wps.HW_SYS_Word() //运维平台word文档生成
|
||||
// // // //政务网区运维巡检文档生成
|
||||
// wps.ZWW_SYS_Word() //运维平台word文档生成
|
||||
// // // //安全巡检文档生成
|
||||
// wps.SAFET_Word() //安全巡检文档生成
|
||||
wps.HW_SYS_Word() //运维平台word文档生成
|
||||
// // //政务网区运维巡检文档生成
|
||||
wps.ZWW_SYS_Word() //运维平台word文档生成
|
||||
// // //安全巡检文档生成
|
||||
wps.SAFET_Word() //安全巡检文档生成
|
||||
//安全事件表格生成(需要先执行互联网区防火墙截图)
|
||||
// attackevent.Fw_event(attackevent.HW_fw1_cookie(), "2025-03-10") //将防火墙安全事件存放到xlsx文件中
|
||||
//nessus的csv文件生成docx报告
|
||||
|