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

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

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

http://officeopenxml.com/WPspacing.php

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

package main

import (
	"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 []byte
	name 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   信息项目   描述值  状态 颜色
	// cpu
	CpuAndMemInfo = 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 DiskInfoStruct
		fmt.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      string
	InfoDescValue string
	InfoStatus    string
	InfoColor     string
}

//展示第磁盘信息数据样式的结构体
type DiskInfoStruct struct {
	//序号	盘符信息	使用率(%)	总空间(GB)	使用量(GB)	剩余量(GB)	状态  颜色
	InfoDiskName    string
	InfoDiskPercent string
	InfoTotalSpace  string
	InfoUsedSpace   string
	InfoFreeSpace   string
	InfoStatus      string
	InfoColor       string
}

// GetCPUPercent 获取CPU使用率
func GetCPUPercent() CpuAndMemStruct {
	var cpuPercentInfo CpuAndMemStruct
	cpuPercentInfo.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 CpuAndMemStruct
	memTotalInfo.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 / 1024
		memTotalInfo.InfoDescValue = Float64ToString(value)
		memTotalInfo.InfoColor = "000000"
		memTotalInfo.InfoStatus = "/"
	}
	fmt.Println(memTotalInfo.InfoDescValue)
	return memTotalInfo
}

// GetMemPercent 获取内存使用率
func GetMemPercent() CpuAndMemStruct {
	var memPercentInfo CpuAndMemStruct
	memPercentInfo.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 CpuAndMemStruct
	fmt.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 / 1024
		swapMemTotalInfo.InfoDescValue = Float64ToString(value)
		fmt.Println(swapMemTotalInfo.InfoDescValue)
		swapMemTotalInfo.InfoColor = "000000"
		swapMemTotalInfo.InfoStatus = "/"
	}
	return swapMemTotalInfo
}

// 获取虚拟内存使用率信息
func GetSwapMemPercent() CpuAndMemStruct {
	var swapMemPercentInfo CpuAndMemStruct
	fmt.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) - 3
	return 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>`

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值