office文档本质上是一个 zip压缩文件

内部包含的是一些 xml 文件,按照规范生成对应的xml文件,并进行打包就可以得到office文件,下面这个是一个网站,可以上去看看学习一下

http://officeopenxml.com/WPspacing.php

这个代码可以检查服务器资源信息,并生成一个简单的报告

package mainimport ("fmt""log""strconv""archive/zip"_ "embed""net""github.com/shirou/gopsutil/cpu""github.com/shirou/gopsutil/mem""github.com/shirou/gopsutil/disk""os""time"
)// 静态变量信息
var dotRels []byte = []byte(rels)var docPropsApp []byte = []byte(app)var docPropsCore []byte = []byte(core)var wordRels []byte = []byte(wordrels)var wordSettings []byte = []byte(wordSetting)var wordStyles []byte = []byte(wordStyle)var contentTypes []byte = []byte(contentType)// 文档结构体
type Part struct {data []bytename string
}//主函数
func main() {parts := []Part{{dotRels, "_rels/.rels"},{docPropsApp, "docProps/app.xml"},{docPropsCore, "docProps/core.xml"},{wordRels, "word/_rels/document.xml.rels"},{wordSettings, "word/settings.xml"},{wordStyles, "word/styles.xml"},{contentTypes, "[Content_Types].xml"},}//文件名称docFileName := time.Now().Format("20060102150405")// 创建压缩文件对象zipFile, _ := os.Create("XXX平台运行健康检查-" + docFileName + ".docx")//是最终延时4秒defer time.Sleep(4 * time.Second)//关闭对象方法defer zipFile.Close()//创建流对象zipWriter := zip.NewWriter(zipFile)//关闭流对象defer zipWriter.Close()//遍历文件数组对象for _, p := range parts {partFile, _ := zipWriter.Create(p.name)partFile.Write(p.data)}partFile, _ := zipWriter.Create("word/document.xml")//下面这个方法是在加内容partFile.Write([]byte(docContesnts01 + GetCpuAndMemInfo() + docContesnts02 + GetDiskInfo() + docContesnts03 + GetNowDate() + docContesnts04))//
}//获取CPU和内存信息
func GetCpuAndMemInfo() string {var CpuAndMemInfo string = ""// ip   信息项目   描述值  状态 颜色// cpuCpuAndMemInfo = CpuAndMemStringAppend(CpuAndMemInfo, GetCPUPercent())// 内存总量CpuAndMemInfo = CpuAndMemStringAppend(CpuAndMemInfo, GetMemTotal())// 内存使用率CpuAndMemInfo = CpuAndMemStringAppend(CpuAndMemInfo, GetMemPercent())// 虚拟内存总量CpuAndMemInfo = CpuAndMemStringAppend(CpuAndMemInfo, GetSwapMemTotal())//    虚拟内存使用率CpuAndMemInfo = CpuAndMemStringAppend(CpuAndMemInfo, GetSwapMemPercent())return CpuAndMemInfo
}//获取磁盘信息
func GetDiskInfo() string {fmt.Println("获取磁盘信息")//空字符串var diskInfoSring string = ""//序号    盘符信息    使用率(%)  总空间(GB) 使用量(GB) 剩余量(GB) 状态  颜色// var diskInfoStructs []DiskInfoStruct///parts, err := disk.Partitions(true)if err != nil {fmt.Printf("get Partitions failed, err:%v\n", err)return ""}for key, part := range parts {var diskInfoStruct DiskInfoStructfmt.Printf("part:%v\n", part.String())// 盘符信息diskInfoStruct.InfoDiskName = part.Mountpoint// 获取盘符具体信息diskInfo, _ := disk.Usage(part.Mountpoint)// 使用率(%)diskInfoStruct.InfoDiskPercent = Float64ToString(diskInfo.UsedPercent)// 总空间(GB)// diskInfo.diskInfoStruct.InfoTotalSpace = Float64ToString(float64(diskInfo.Total) / 1024 / 1024 / 1024)// 使用量(GB)diskInfoStruct.InfoUsedSpace = Float64ToString(float64(diskInfo.Used) / 1024 / 1024 / 1024)// 剩余量(GB)diskInfoStruct.InfoFreeSpace = Float64ToString(float64(diskInfo.Free) / 1024 / 1024 / 1024)if diskInfo.UsedPercent > 80 {// 状态diskInfoStruct.InfoStatus = "磁盘使用率超过80%"// 颜色diskInfoStruct.InfoColor = "FF0000"} else {// 状态diskInfoStruct.InfoStatus = "正常"// 颜色diskInfoStruct.InfoColor = "00FF00"}fmt.Printf("disk info:used:%v free:%v\n", diskInfo.UsedPercent, diskInfo.Free)diskInfoSring = DiskStringAppend(diskInfoSring, strconv.Itoa(key+1), diskInfoStruct)}//获取存储盘信息return diskInfoSring
}//展示第一个数据的样式的结构体
type CpuAndMemStruct struct {InfoName      stringInfoDescValue stringInfoStatus    stringInfoColor     string
}//展示第磁盘信息数据样式的结构体
type DiskInfoStruct struct {//序号   盘符信息    使用率(%)  总空间(GB) 使用量(GB) 剩余量(GB) 状态  颜色InfoDiskName    stringInfoDiskPercent stringInfoTotalSpace  stringInfoUsedSpace   stringInfoFreeSpace   stringInfoStatus      stringInfoColor       string
}// GetCPUPercent 获取CPU使用率
func GetCPUPercent() CpuAndMemStruct {var cpuPercentInfo CpuAndMemStructcpuPercentInfo.InfoName = "cpu使用率(%)"fmt.Println(cpuPercentInfo.InfoName)percent, err := cpu.Percent(time.Second, false)if err != nil {log.Fatalln(err.Error())cpuPercentInfo.InfoDescValue = "获取CPU使用率信息失败"cpuPercentInfo.InfoStatus = "获取CPU使用率信息失败"cpuPercentInfo.InfoColor = "FF0000"} else {if percent[0] > 80.0 {cpuPercentInfo.InfoStatus = "CPU使用率过高"cpuPercentInfo.InfoColor = "FF0000"} else {cpuPercentInfo.InfoStatus = "正常"cpuPercentInfo.InfoColor = "00FF00"}cpuPercentInfo.InfoDescValue = Float64ToString(percent[0])}// fmt.Println(percent)fmt.Println(cpuPercentInfo.InfoDescValue)return cpuPercentInfo
}// GetMemTotal 获取内存总量
func GetMemTotal() CpuAndMemStruct {var memTotalInfo CpuAndMemStructmemTotalInfo.InfoName = "内存总量(GB)"fmt.Println(memTotalInfo.InfoName)memInfo, err := mem.VirtualMemory()if err != nil {log.Fatalln(err.Error())memTotalInfo.InfoDescValue = ""memTotalInfo.InfoColor = "FF0000"memTotalInfo.InfoStatus = "获取内存总量信息失败"} else {value := float64(memInfo.Total) / 1024 / 1024 / 1024memTotalInfo.InfoDescValue = Float64ToString(value)memTotalInfo.InfoColor = "000000"memTotalInfo.InfoStatus = "/"}fmt.Println(memTotalInfo.InfoDescValue)return memTotalInfo
}// GetMemPercent 获取内存使用率
func GetMemPercent() CpuAndMemStruct {var memPercentInfo CpuAndMemStructmemPercentInfo.InfoName = "内存使用率(%)"memInfo, err := mem.VirtualMemory()if err != nil {log.Fatalln(err.Error())memPercentInfo.InfoDescValue = ""memPercentInfo.InfoStatus = "内存使用率信息获取失败"memPercentInfo.InfoColor = "FF0000"} else {if memInfo.UsedPercent > 80 {memPercentInfo.InfoStatus = "内存使用率过高"memPercentInfo.InfoColor = "FF0000"} else {memPercentInfo.InfoStatus = "正常"memPercentInfo.InfoColor = "00FF00"}memPercentInfo.InfoDescValue = Float64ToString(memInfo.UsedPercent)}fmt.Println(memPercentInfo.InfoName)fmt.Println(memPercentInfo.InfoDescValue)return memPercentInfo
}// 获取虚拟内存总量信息
func GetSwapMemTotal() CpuAndMemStruct {var swapMemTotalInfo CpuAndMemStructfmt.Println("虚拟内存总量(GB)")swapMemTotalInfo.InfoName = "虚拟内存总量(GB)"memInfo, err := mem.SwapMemory()if err != nil {log.Fatalln(err.Error())swapMemTotalInfo.InfoDescValue = ""swapMemTotalInfo.InfoColor = "FF0000"swapMemTotalInfo.InfoStatus = "获取虚拟内存总量失败"fmt.Println("获取虚拟内存总量失败")} else {value := float64(memInfo.Total) / 1024 / 1024 / 1024swapMemTotalInfo.InfoDescValue = Float64ToString(value)fmt.Println(swapMemTotalInfo.InfoDescValue)swapMemTotalInfo.InfoColor = "000000"swapMemTotalInfo.InfoStatus = "/"}return swapMemTotalInfo
}// 获取虚拟内存使用率信息
func GetSwapMemPercent() CpuAndMemStruct {var swapMemPercentInfo CpuAndMemStructfmt.Println("虚拟内存使用率(%)")swapMemPercentInfo.InfoName = "虚拟内存使用率(%)"memInfo, err := mem.SwapMemory()if err != nil {log.Fatalln(err.Error())swapMemPercentInfo.InfoDescValue = ""swapMemPercentInfo.InfoStatus = "虚拟内存使用率信息获取失败"swapMemPercentInfo.InfoColor = "FF0000"} else {if memInfo.UsedPercent > 80 {swapMemPercentInfo.InfoStatus = "虚拟内存使用率过高"swapMemPercentInfo.InfoColor = "FF0000"} else {swapMemPercentInfo.InfoStatus = "正常"swapMemPercentInfo.InfoColor = "00FF00"}swapMemPercentInfo.InfoDescValue = Float64ToString(memInfo.UsedPercent)}fmt.Println(swapMemPercentInfo.InfoDescValue)return swapMemPercentInfo
}// 获取当前巡检时间  巡检日期:2022年11月09日
func GetNowDate() string {return `巡检日期:` + time.Now().Format("2006") + `年` + time.Now().Format("01") + `月` + time.Now().Format("02") + `日`
}//获取IP地址
func GetIPInfo() string {var iplist string = ""name, err := os.Hostname()if err != nil {fmt.Printf("Oops: %v\n", err)return iplist}addrs, err := net.LookupHost(name)if err != nil {fmt.Printf("Oops: %v\n", err)return iplist}for _, a := range addrs {if a == "::1" || a == "127.0.0.1" {continue}iplist = iplist + a + ",  "}// 返回前截取一下字符串x := len(iplist) - 3return iplist[0:x]
}// float64转string
func Float64ToString(num float64) string {return strconv.FormatFloat(num, 'f', 2, 32)// return fmt.Sprintf("%f", num)
}//合并CPU和内存信息XML字符串
func CpuAndMemStringAppend(CpuAndMemInfo string, cpuAndMemStruct CpuAndMemStruct) string {return CpuAndMemInfo + `<w:tr><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:t>` + GetIPInfo() + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:t>` + cpuAndMemStruct.InfoName + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:t>` + cpuAndMemStruct.InfoDescValue + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:rPr><w:color w:val="` + cpuAndMemStruct.InfoColor + `"/><w:sz w:val="22"/></w:rPr><w:t>` + cpuAndMemStruct.InfoStatus + `</w:t></w:r></w:p></w:tc></w:tr>`
}//合并磁盘信息XML字符串
func DiskStringAppend(diskInfoSring string, countNum string, diskInfoStruct DiskInfoStruct) string {return diskInfoSring + `<w:tr><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>` + countNum + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>` + diskInfoStruct.InfoDiskName + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>` + diskInfoStruct.InfoDiskPercent + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>` + diskInfoStruct.InfoTotalSpace + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>` + diskInfoStruct.InfoUsedSpace + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>` + diskInfoStruct.InfoFreeSpace + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:rPr><w:color w:val="` + diskInfoStruct.InfoColor + `"/><w:sz w:val="22"/></w:rPr><w:t>` + diskInfoStruct.InfoStatus + `</w:t></w:r></w:p></w:tc></w:tr>`// return diskInfoString + `<w:tr><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:t>` + GetIPInfo() + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:t>` + cpuAndMemStruct.InfoName + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:t>` + cpuAndMemStruct.InfoDescValue + `</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:rPr><w:color w:val="` + cpuAndMemStruct.InfoColor + `"/><w:sz w:val="22"/></w:rPr><w:t>` + cpuAndMemStruct.InfoStatus + `</w:t></w:r></w:p></w:tc></w:tr>`
}const app = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes" xmlns:xml="http://www.w3.org/XML/1998/namespace"><Company>www.ndxsl.cn</Company><LinksUpToDate>false</LinksUpToDate><Application>www.ndxsl.cn</Application><AppVersion>00.8000</AppVersion><DocSecurity>0</DocSecurity></Properties>`const core = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cp:coreProperties xmlns="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xml="http://www.w3.org/XML/1998/namespace"/>`const contentType = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types" xmlns:xml="http://www.w3.org/XML/1998/namespace"><Default Extension="xml" ContentType="application/xml"/><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="png" ContentType="image/png"/><Default Extension="jpeg" ContentType="image/jpeg"/><Default Extension="jpg" ContentType="image/jpg"/><Default Extension="wmf" ContentType="image/x-wmf"/><Override ContentType="application/vnd.openxmlformats-package.core-properties+xml" PartName="/docProps/core.xml"/><Override ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml" PartName="/docProps/app.xml"/><Override ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml" PartName="/word/document.xml"/><Override ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml" PartName="/word/settings.xml"/><Override ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml" PartName="/word/numbering.xml"/><Override ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml" PartName="/word/styles.xml"/><Override ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml" PartName="/word/footer1.xml"/><Override ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml" PartName="/word/header1.xml"/></Types>`const rels = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:xml="http://www.w3.org/XML/1998/namespace"><Relationship Target="docProps/core.xml" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Id="rId1"/><Relationship Target="docProps/app.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Id="rId2"/><Relationship Target="word/document.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Id="rId3"/></Relationships>`const wordrels = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:xml="http://www.w3.org/XML/1998/namespace"><Relationship Target="settings.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Id="rId1"/><Relationship Target="numbering.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Id="rId2"/><Relationship Target="styles.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Id="rId3"/><Relationship Target="footer1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" Id="rId4"/><Relationship Target="header1.xml" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" Id="rId5"/></Relationships>`const wordSetting = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:settings xmlns="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:ma="http://schemas.openxmlformats.org/schemaLibrary/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:s="http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:xml="http://www.w3.org/XML/1998/namespace"><w:compat><w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="15"/></w:compat></w:settings>`const wordStyle = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:styles xmlns="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:ma="http://schemas.openxmlformats.org/schemaLibrary/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:s="http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:xml="http://www.w3.org/XML/1998/namespace"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:asciiTheme="majorAscii" w:hAnsiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:cstheme="majorBidi"/><w:sz w:val="24"/><w:szCs w:val="24"/><w:lang w:val="en-US" w:eastAsia="en-US" w:bidi="ar-SA"/></w:rPr></w:rPrDefault><w:pPrDefault/></w:docDefaults><w:style w:type="paragraph" w:styleId="Normal" w:default="true"><w:name w:val="Normal"/><w:qFormat/></w:style><w:style w:type="character" w:styleId="DefaultParagraphFont" w:default="true"><w:name w:val="Default Paragraph Font"/><w:uiPriority w:val="1"/><w:semiHidden/><w:unhideWhenUsed/></w:style><w:style w:type="character" w:styleId="TitleChar"><w:name w:val="Title Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="Title"/><w:uiPriority w:val="10"/><w:rPr><w:rFonts w:asciiTheme="majorAscii" w:hAnsiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:cstheme="majorBidi"/><w:spacing w:val="-10"/><w:kern w:val="28"/><w:sz w:val="56"/><w:szCs w:val="56"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Title"><w:name w:val="Title"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:link w:val="TitleChar"/><w:uiPriority w:val="10"/><w:qFormat/><w:pPr><w:contextualSpacing/></w:pPr><w:rPr><w:rFonts w:asciiTheme="majorAscii" w:hAnsiTheme="majorHAnsi" w:eastAsiaTheme="majorEastAsia" w:cstheme="majorBidi"/><w:spacing w:val="-10"/><w:kern w:val="28"/><w:sz w:val="56"/><w:szCs w:val="56"/></w:rPr></w:style><w:style w:type="table" w:styleId="TableNormal"><w:name w:val="Normal Table"/><w:uiPriority w:val="99"/><w:semiHidden/><w:unhideWhenUsed/><w:tblPr><w:tblInd w:w="0" w:type="dxa"/><w:tblCellMar><w:top w:w="0" w:type="dxa"/><w:left w:w="108" w:type="dxa"/><w:bottom w:w="0" w:type="dxa"/><w:right w:w="108" w:type="dxa"/></w:tblCellMar></w:tblPr></w:style><w:style w:type="numbering" w:styleId="NoList"><w:name w:val="No List"/><w:uiPriority w:val="1"/><w:semiHidden/><w:unhideWhenUsed/></w:style><w:style w:type="character" w:styleId="Heading1Char"><w:name w:val="Heading 1 Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="Heading1"/><w:uiPriority w:val="9"/><w:rPr><w:sz w:val="32"/><w:szCs w:val="32"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading1"><w:name w:val="heading 1"/><w:next w:val="Normal"/><w:link w:val="Heading1"/><w:uiPriority w:val="9"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="240"/><w:outlineLvl w:val="0"/></w:pPr><w:rPr><w:sz w:val="32"/><w:szCs w:val="32"/></w:rPr></w:style><w:style w:type="character" w:styleId="Heading2Char"><w:name w:val="Heading 2 Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="Heading2"/><w:uiPriority w:val="10"/><w:rPr><w:sz w:val="26"/><w:szCs w:val="26"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading2"><w:name w:val="heading 2"/><w:next w:val="Normal"/><w:link w:val="Heading2"/><w:uiPriority w:val="10"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="40"/><w:outlineLvl w:val="1"/></w:pPr><w:rPr><w:sz w:val="26"/><w:szCs w:val="26"/></w:rPr></w:style><w:style w:type="character" w:styleId="Heading3Char"><w:name w:val="Heading 3 Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="Heading3"/><w:uiPriority w:val="11"/><w:rPr><w:sz w:val="24"/><w:szCs w:val="24"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading3"><w:name w:val="heading 3"/><w:next w:val="Normal"/><w:link w:val="Heading3"/><w:uiPriority w:val="11"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="40"/><w:outlineLvl w:val="2"/></w:pPr><w:rPr><w:sz w:val="24"/><w:szCs w:val="24"/></w:rPr></w:style><w:style w:type="character" w:styleId="Heading4Char"><w:name w:val="Heading 4 Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="Heading4"/><w:uiPriority w:val="12"/><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading4"><w:name w:val="heading 4"/><w:next w:val="Normal"/><w:link w:val="Heading4"/><w:uiPriority w:val="12"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="40"/><w:outlineLvl w:val="3"/></w:pPr><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="character" w:styleId="Heading5Char"><w:name w:val="Heading 5 Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="Heading5"/><w:uiPriority w:val="13"/><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading5"><w:name w:val="heading 5"/><w:next w:val="Normal"/><w:link w:val="Heading5"/><w:uiPriority w:val="13"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="40"/><w:outlineLvl w:val="4"/></w:pPr><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="character" w:styleId="Heading6Char"><w:name w:val="Heading 6 Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="Heading6"/><w:uiPriority w:val="14"/><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading6"><w:name w:val="heading 6"/><w:next w:val="Normal"/><w:link w:val="Heading6"/><w:uiPriority w:val="14"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="40"/><w:outlineLvl w:val="5"/></w:pPr><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="character" w:styleId="Heading7Char"><w:name w:val="Heading 7 Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="Heading7"/><w:uiPriority w:val="15"/><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading7"><w:name w:val="heading 7"/><w:next w:val="Normal"/><w:link w:val="Heading7"/><w:uiPriority w:val="15"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="40"/><w:outlineLvl w:val="6"/></w:pPr><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="character" w:styleId="Heading8Char"><w:name w:val="Heading 8 Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="Heading8"/><w:uiPriority w:val="16"/><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading8"><w:name w:val="heading 8"/><w:next w:val="Normal"/><w:link w:val="Heading8"/><w:uiPriority w:val="16"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="40"/><w:outlineLvl w:val="7"/></w:pPr><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="character" w:styleId="Heading9Char"><w:name w:val="Heading 9 Char"/><w:basedOn w:val="DefaultParagraphFont"/><w:link w:val="Heading9"/><w:uiPriority w:val="17"/><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Heading9"><w:name w:val="heading 9"/><w:next w:val="Normal"/><w:link w:val="Heading9"/><w:uiPriority w:val="17"/><w:qFormat/><w:pPr><w:keepNext/><w:spacing w:before="40"/><w:outlineLvl w:val="8"/></w:pPr><w:rPr><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:style></w:styles>`const docContesnts01 = `<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mo="http://schemas.microsoft.com/office/mac/office/2008/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 wp14"><w:body><w:p><w:pPr><w:pStyle w:val="Heading1"/><w:jc w:val="center"/></w:pPr><w:r><w:t>xxxx办公平台服务运行环境每日巡检表</w:t></w:r></w:p><w:p/><w:p><w:r><w:rPr><w:color w:val="FF0000"/></w:rPr><w:t>注意:如果服务器存在多个,请将其他几个服务器的指标内容,复制粘贴到对应的文档中,完成所有服务器的内容整合至一个文档</w:t></w:r></w:p><w:p><w:r><w:rPr><w:b/></w:rPr><w:t>1.服务器cpu和内存资源状态</w:t></w:r></w:p><w:tbl><w:tblPr><w:tblW w:type="auto" w:w="0"/><w:tblLook w:firstColumn="1" w:firstRow="1" w:lastColumn="0" w:lastRow="0" w:noHBand="0" w:noVBand="1" w:val="04A0"/></w:tblPr><w:tblGrid><w:gridCol w:w="2160"/><w:gridCol w:w="2160"/><w:gridCol w:w="2160"/><w:gridCol w:w="2160"/></w:tblGrid><w:tr><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:t>IP</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:t>信息项目</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:t>描述值</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="2160"/></w:tcPr><w:p><w:r><w:t>状态</w:t></w:r></w:p></w:tc></w:tr>`const docContesnts02 = `</w:tbl><w:p><w:r><w:rPr><w:b/></w:rPr><w:t>2.服务器磁盘资源状态</w:t></w:r></w:p><w:tbl><w:tblPr><w:tblW w:type="auto" w:w="0"/><w:tblLook w:firstColumn="1" w:firstRow="1" w:lastColumn="0" w:lastRow="0" w:noHBand="0" w:noVBand="1" w:val="04A0"/></w:tblPr><w:tblGrid><w:gridCol w:w="1234"/><w:gridCol w:w="1234"/><w:gridCol w:w="1234"/><w:gridCol w:w="1234"/><w:gridCol w:w="1234"/><w:gridCol w:w="1234"/><w:gridCol w:w="1234"/></w:tblGrid><w:tr><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>序号</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>盘符信息</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>使用率(%)</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>总空间(GB)</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>使用量(GB)</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>剩余量(GB)</w:t></w:r></w:p></w:tc><w:tc><w:tcPr><w:tcW w:type="dxa" w:w="1234"/></w:tcPr><w:p><w:r><w:t>状态</w:t></w:r></w:p></w:tc></w:tr>`const docContesnts03 = `</w:tbl><w:p/><w:p><w:r><w:rPr><w:color w:val="FF0000"/></w:rPr><w:t>注意:红色内容需手动填写完成</w:t></w:r></w:p><w:p><w:r><w:rPr><w:b/></w:rPr><w:t>3.系统监控情况</w:t></w:r></w:p><w:p><w:r><w:t xml:space="preserve">    当前G1 Old Gen年老代使用比例</w:t></w:r><w:r><w:rPr><w:color w:val="FF0000"/></w:rPr><w:t>10%</w:t></w:r><w:r><w:rPr><w:color w:val="000000"/></w:rPr><w:t>,未超过80%,peak ratio系统运行期间最高峰值为</w:t></w:r><w:r><w:rPr><w:color w:val="FF0000"/></w:rPr><w:t>11%</w:t></w:r><w:r><w:rPr><w:color w:val="000000"/></w:rPr><w:t>,未超过90%,系统运行状态良好。</w:t></w:r></w:p><w:p/><w:p><w:r><w:t>当前数据库繁忙的连接</w:t></w:r><w:r><w:rPr><w:color w:val="FF0000"/></w:rPr><w:t>8</w:t></w:r><w:r><w:rPr><w:color w:val="000000"/></w:rPr><w:t>,Peak connections:最高峰数据库连接数</w:t></w:r><w:r><w:rPr><w:color w:val="FF0000"/></w:rPr><w:t>14</w:t></w:r><w:r><w:rPr><w:color w:val="000000"/></w:rPr><w:t>,未超过400,应用线程数Thread Count</w:t></w:r><w:r><w:rPr><w:color w:val="FF0000"/></w:rPr><w:t>322</w:t></w:r><w:r><w:rPr><w:color w:val="000000"/></w:rPr><w:t>:Peak Thread Count应用线程数峰值为</w:t></w:r><w:r><w:rPr><w:color w:val="FF0000"/></w:rPr><w:t>325</w:t></w:r><w:r><w:rPr><w:color w:val="000000"/></w:rPr><w:t>,未超过2000,系统运行状态良好。</w:t></w:r></w:p><w:p/><w:p><w:pPr><w:jc w:val="right"/></w:pPr><w:r><w:rPr><w:sz w:val="20"/></w:rPr><w:t>`// 巡检日期:2022年11月09日
const docContesnts04 = `</w:t></w:r></w:p><w:p><w:pPr><w:jc w:val="right"/></w:pPr><w:r><w:rPr><w:sz w:val="20"/></w:rPr><w:t xml:space="preserve">巡检人:xxx                           </w:t></w:r></w:p><w:sectPr w:rsidR="00FC693F" w:rsidRPr="0006063C" w:rsidSect="00034616"><w:pgSz w:w="12240" w:h="15840"/><w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:header="720" w:footer="720" w:gutter="0"/><w:cols w:space="720"/><w:docGrid w:linePitch="360"/></w:sectPr></w:body></w:document>`

golang检查服务器资源并输出docx报告文档相关推荐

  1. 简单的golang游戏服务器框架《railgun》的文档目录索引

    使用golang写的框架.使用的是require response的状态同步 使用了第三方protobuf库作为报文和序列化,关于如何在windows下安装参考:windows下安装golang pr ...

  2. 命令更新之sum2docx:将描述性统计输出至Word文档 ——转自李春涛老师团队 爬虫俱乐部 微信公众号

    命令更新之sum2docx:将描述性统计输出至Word文档 原创 爬虫俱乐部 Stata and Python数据分析 2019-05-20 本文作者:孙雪丽 文字编辑:张语盈 技术总编:薛   原 ...

  3. 输出数据库设计文档Pgsql版本

    背景 懒人必备导设计文档的数据库表结构 制作时间:2022年9月5日12:39:36 作者:huishao 用途:一键输出数据库设计文档中的数据表 准备工作 导库 备注:docx是python3版本的 ...

  4. 文档预览服务器,特色 - I Doc View在线文档预览

    使用对象 个人和第三方应用均可使用:个人:可以在示例页面上传和预览文档 第三方应用:通过我们提供的第三方应用API接口来调用,或者将预览服务部署到您自己的服务器上. 预览本地文档 您可以上传并在线查看 ...

  5. Java:多个文档合并输出到一个文档

    多个文档合并输出到一个文档 方法:Java NIO package First;import java.io.File; import java.io.FileInputStream; import ...

  6. java docx文档解析_带有docx4j的Java Word(.docx)文档

    java docx文档解析 几个月前,我需要创建一个包含许多表和段落的动态Word文档. 过去,我曾使用POI来实现此目的,但是我发现它很难使用,并且在创建更复杂的文档时对我来说效果不佳. 因此,对于 ...

  7. 基于java web servlet生鲜商城管理系统源码含报告文档

    (一)目的 电子商务的迅速兴起,网上购物也为人们的生活提供了极大的便利,不受时间和空间的限制.商城系统的兴起,扩大了消费市场的空间,对于大型企业来说,建设商城系统是正确的选择,不仅要扩大销售渠道,而且 ...

  8. 基于Java Swing实现的日历记事本系统【源码+报告文档】

    一.项目简介 本项目是一套基于Java Swing实现的日历记事本系统,主要针对计算机相关专业的正在学习java的学生与需要项目实战练习的Java学习者. 包含:项目源码.报告文档等. 项目都经过严格 ...

  9. Golang 见证 godoc 的强大(生成API文档,打印文档)

    Golang 见证 godoc 的强大(生成API文档,打印文档) 文章目录 Golang 见证 godoc 的强大(生成API文档,打印文档) 一.godoc 介绍 二.godoc 安装 ① 系统环 ...

最新文章

  1. python 中的下划线
  2. 需要在Emulator上模拟来电 效果
  3. POJ 3164 Command Network (最小树形图)
  4. Qt Creator将应用程序部署到QNX Neutrino设备
  5. ie和谷歌在java中空格兼容,谷歌和IE浏览器的兼容性问题,相同的html结构竟然在两个浏览器不一样...
  6. Linux下源码安装ElasticResearch
  7. SpringBoot优缺点总结
  8. saltstack管理二之saltstack的安装
  9. YYtext简单使用
  10. 教学演示软件 模型八 医学的人体模型
  11. 工作中使用到的单词(软件开发)
  12. uniapp运行到微信小程序开发工具
  13. Unity打包后播放视频黑屏问题
  14. n1服务器系统和小钢炮,教你N1小钢炮系统设置中其他一些应用和服务器的设置的相关方法教程...
  15. 乒乓球比赛赛程_2020年乒乓球比赛赛事赛程表(优个网独家整理)
  16. 如何使用Julius搭建一个语音识别引擎?
  17. 云计算------容器部署情感分析
  18. Android 实践:做一款新闻 APP
  19. JDK8新特性知识点总结
  20. 【小社交】谁是下一个陌陌?陌生人社交网络大起底!

热门文章

  1. 无意中发现的一个好设计:不浸水的香皂盒
  2. Pytorch踩坑: RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0.
  3. 目标检测网络进展跟踪
  4. 蒙古人真的靠骑射征服欧亚吗?《黑鞑事略》告诉你答案
  5. 基于模型的系统工程(MBSE)是什么?有什么用?怎么学习?
  6. 什么是响应式编程框架
  7. C语言结构体函数指针
  8. 接口限流、服务降级、熔断
  9. java和大数据哪个就业前景好的专业_大数据Java学哪个好,哪个更有发展前景?...
  10. 电视和计算机屏幕有哪三中颜色组成,合成彩色电视机和计算机屏幕上艳丽画面的色光是:[]A.红、绿、蓝...