linuxstr

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B  = 1
	KB = 1024 * B
	MB = 1024 * KB
	GB = 1024 * MB
)

Variables

View Source
var (
	LinuxSystem string = "centos"
)
View Source
var ProcessorStat = make(map[string]int)
View Source
var ResultCount = 50

Functions

func AnalyzeLine2HDDevUsageInfo

func AnalyzeLine2HDDevUsageInfo(lineInfo string) (model.HDDevUsage, error)

func DiskUsage

func DiskUsage(path string) (disk model.DiskStatus)

disk usage of path/disk

func GetAppUser

func GetAppUser() (myUsers []model.AppUser)

func GetApplicationInfo

func GetApplicationInfo() (myApplicationInfos model.ApplicationInfo)

func GetConnectionStatInfo

func GetConnectionStatInfo(max int) ([]model.ConnectionStat, error)

GetConnectionStatInfo 获取netstat信息 max为获取数据限制数量 0=all

func GetCpuInfo

func GetCpuInfo() (c model.Cpu, err error)

func GetCronTask

func GetCronTask() (myCrons []model.CronTask)

func GetDisksInfo

func GetDisksInfo() (d []model.Disk, err error)

func GetHardwareInfo

func GetHardwareInfo() (h model.HardwareInfo, err error)

func GetHistoryLog

func GetHistoryLog(num int, str string) (historyLog model.HistoryLog)

GetHistoryLog 通过命令 cat ~/.bash_history | tail -n 50 获取历史命令行输入 传入参数为tail数量、grep的字符串

func GetHostInfo

func GetHostInfo() (s model.HostInfoService, err error)

func GetHostInfoFunc

func GetHostInfoFunc(list []string) (s model.HostInfoService, cnName map[string]string, hostInfo []string)

func GetHostLog

func GetHostLog(num int, str string) (s model.HostLog)

GetHostLog 通过命令 cat /var/log/secure | tail -n 50 获取Secure 传入参数为tail数量、grep的字符串

func GetIPTableInfo

func GetIPTableInfo() (i model.Iptable, err error)

func GetLastLog

func GetLastLog(num int, str string) (result []model.LoginLog)

GetLastLog 通过命令 last -n 50 --time-format iso -R 获取登录日志 传入参数为tail数量、grep的字符串

func GetLogInfo

func GetLogInfo(num int, hostStr, historyStr, lastStr string) (s model.LogInfo)

func GetLoginInfo

func GetLoginInfo(list []string) (name, remote, time, status string)

func GetMemoryInfo

func GetMemoryInfo() (m model.Memory, err error)

func GetNetCardInfo

func GetNetCardInfo() (NetCardList []model.NetCard, err error)

func GetNetCardUUid

func GetNetCardUUid(name string) (string, error)

GetNetCardUUid 获取网卡UUid信息

func GetNetworkInfo

func GetNetworkInfo() (s model.NetworkInfo)

func GetPasswordPolicy

func GetPasswordPolicy() (p model.PasswordPolicy, err error)

func GetPolicyInfo

func GetPolicyInfo() (p model.PolicyInfo, err error)

func GetRunTimeInfo

func GetRunTimeInfo() (s model.RunTimeInfo, err error)

func GetServiceInfo

func GetServiceInfo() (myServices []model.Service)

func GetSpecialStatus

func GetSpecialStatus() (R, S, T, I, Z, W, L, count int)

GetSpecialStatus 状态返回进程状态。返回值可能是其中之一。R:运行 S:睡眠 T:停止 I:空闲 Z:僵尸 W:等待 L:锁定

func GetSwapInfo

func GetSwapInfo() (s model.Swap, err error)

func GetSysMTabInfo

func GetSysMTabInfo() ([]model.HDDevUsage, error)

func GetTaskInfo

func GetTaskInfo() (taskList []model.Task, err error)

func GetWebLog

func GetWebLog() (s model.WebLog, err error)

GetWebLog Apache Nginx Tomcat

func SetLinuxStr added in v1.0.2

func SetLinuxStr()

SetLinuxStr 每次配置本项目版本

func SetLinuxSystem added in v1.0.2

func SetLinuxSystem(s string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL