nginx

package module
v0.0.0-...-08ceb09 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2017 License: MIT Imports: 13 Imported by: 0

README

nginx-go

Go 语言实现Nginx控制器

Documentation

Overview

************************************************************************

> File Name: nginx.go
> Author: Kee
> Mail: chinboy2012@gmail.com
> Created Time: 2017.12.04

***********************************************************************

************************************************************************

> File Name: nginx_status.go
> Author: Kee
> Mail: chinboy2012@gmail.com
> Created Time: 2017.12.06

***********************************************************************

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addr

type Addr struct {
	IP   string `json:"ip"`
	Port uint32 `json:port`
}

type Memory

type Memory struct {
	Percent     float32 `json:"percent"`
	VirtualSize uint64  `json:"virtual_byte"`
	RealSize    uint64  `json:"real_byte"`
}

func (*Memory) String

func (obj *Memory) String() string

String returns JSON value of the memory info

type Network

type Network struct {
	Stat  string `json:"stat"`
	Laddr string `json:"local_address"`
	Raddr string `json:"remote_address"`
}

type Networks

type Networks struct {
	Network    []*Network            `json:"network"`
	IOCounters []pnet.IOCountersStat `json:"io_counters"`
	Total      map[string]int        `json:"total"`
}

type Nginx

type Nginx struct {
	Pid   string // Nginx PID文件
	Nginx string // Nginx 可执行文件
}

func (*Nginx) Reload

func (this *Nginx) Reload() (bool, error)

重载 Nginx 服务

func (*Nginx) Start

func (this *Nginx) Start() (bool, error)

启动 Nginx 服务

func (*Nginx) Status

func (this *Nginx) Status() (*Status, error)

*

  • 获取 Nginx 状态 *
  • @return *Status, error

func (*Nginx) Stop

func (this *Nginx) Stop() (bool, error)

停止 Nginx 服务

func (*Nginx) Test

func (this *Nginx) Test() (bool, error)

测试 Nginx 配置

type Process

type Process struct {
	Pid     int32
	Process *process.Process
}

func (*Process) Children

func (this *Process) Children() []int32

子进程 PID 列表

func (*Process) Cpu

func (this *Process) Cpu() float64

CPU占用比例

func (*Process) CreateTime

func (this *Process) CreateTime() int64

启动时间

func (*Process) Host

func (this *Process) Host() *host.InfoStat

主机名

func (*Process) Internal

func (this *Process) Internal() []string

获取网卡IP

func (*Process) Memory

func (this *Process) Memory() *Memory

内存信息

func (*Process) Networks

func (this *Process) Networks() *Networks

获取网络情况

func (*Process) New

func (this *Process) New(pid int32) (*Process, error)

func (*Process) StartDateTime

func (this *Process) StartDateTime() string

启动时间格式化

func (*Process) Status

func (this *Process) Status() string

运行状态

func (*Process) Time

func (this *Process) Time() float32

运行时长

type Result

type Result struct {
	Code int32        `json:"code"`
	Msg  string       `json:"msg"`
	Data *interface{} `json:"data"`
}

type Status

type Status struct {
	PID      int32          `json:"pid"`
	CPU      float32        `json:"cpu"`
	Memory   *Memory        `json:"memory"`
	Status   string         `json:"status"`
	Start    string         `json:"start_at"`
	Time     float32        `json:"time"`
	Host     *host.InfoStat `json:"host"`
	Subpid   []int32        `json:"sub_pid"`
	IpAddrs  []string       `json:"ip_address"`
	Networks *Networks      `json:"networks"`
}

func (*Status) String

func (obj *Status) String() string

String returns JSON value of the status info

Jump to

Keyboard shortcuts

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