netscaler

package
v0.0.0-...-9c2c23d Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(c *NitroClient) error

Connect initiates a connection to a NetScaler and returns the session token

func Disconnect

func Disconnect(c *NitroClient) error

Disconnect logs out of the NetScaler

Types

type AAAStats

type AAAStats struct {
	AuthSuccess               string `json:"aaaauthsuccess"`
	AuthFail                  string `json:"aaaauthfail"`
	AuthOnlyHTTPSuccess       string `json:"aaaauthonlyhttpsuccess"`
	AuthOnlyHTTPFail          string `json:"aaaauthonlyhttpfail"`
	CurrentIcaSessions        string `json:"aaacuricasessions"`
	CurrentIcaOnlyConnections string `json:"aaacuricaonlyconn"`
}

AAAStats represents the data returned from the /stat/aaa Nitro API endpoint

type CSVirtualServerStats

type CSVirtualServerStats struct {
	Name                          string `json:"name"`
	State                         string `json:"state"`
	TotalHits                     string `json:"tothits"`
	TotalRequests                 string `json:"totalrequests"`
	TotalResponses                string `json:"totalresponses"`
	TotalRequestBytes             string `json:"totalrequestbytes"`
	TotalResponseBytes            string `json:"totalresponsebytes"`
	CurrentClientConnections      string `json:"curclntconnections"`
	CurrentServerConnections      string `json:"cursrvrconnections"`
	EstablishedConnections        string `json:"establishedconn"`
	TotalPacketsReceived          string `json:"totalpktsrecvd"`
	TotalPacketsSent              string `json:"totalpktssent"`
	TotalSpillovers               string `json:"totspillovers"`
	DeferredRequests              string `json:"deferredreq"`
	InvalidRequestResponse        string `json:"invalidrequestresponse"`
	InvalidRequestResponseDropped string `json:"invalidrequestresponsedropped"`
	TotalVServerDownBackupHits    string `json:"totvserverdownbackuphits"`
	CurrentMultipathSessions      string `json:"curmptcpsessions"`
	CurrentMultipathSubflows      string `json:"cursubflowconn"`
}

CSVirtualServerStats represents the data returned from the /stat/csvserver Nitro API endpoint

type DisconnectPayload

type DisconnectPayload struct {
	Logout struct {
	} `json:"logout"`
}

DisconnectPayload is the JSON that needs to be sent to NetScaler to logout

type GSLBServiceStats

type GSLBServiceStats struct {
	Name                     string `json:"servicename"`
	State                    string `json:"state"`
	TotalRequests            string `json:"totalrequests"`
	TotalResponses           string `json:"totalresponses"`
	TotalRequestBytes        string `json:"totalrequestbytes"`
	TotalResponseBytes       string `json:"totalresponsebytes"`
	CurrentClientConnections string `json:"curclntconnections"`
	CurrentServerConnections string `json:"cursrvrconnections"`
	EstablishedConnections   string `json:"establishedconn"`
	CurrentLoad              string `json:"curload"`
	ServiceHits              string `json:"vsvrservicehits"`
}

GSLBServiceStats represents the data returned from the /stat/gslbservice Nitro API endpoint

type GSLBVirtualServerStats

type GSLBVirtualServerStats struct {
	Name                     string `json:"name"`
	State                    string `json:"state"`
	Health                   string `json:"vslbhealth"`
	InactiveServices         string `json:"inactsvcs"`
	ActiveServices           string `json:"actsvcs"`
	TotalHits                string `json:"tothits"`
	TotalRequests            string `json:"totalrequests"`
	TotalResponses           string `json:"totalresponses"`
	TotalRequestBytes        string `json:"totalrequestbytes"`
	TotalResponseBytes       string `json:"totalresponsebytes"`
	CurrentClientConnections string `json:"curclntconnections"`
	CurrentServerConnections string `json:"cursrvrconnections"`
}

GSLBVirtualServerStats represents the data returned from the /stat/gslbvserver Nitro API endpoint

type InterfaceStats

type InterfaceStats struct {
	ID                      string `json:"id"`
	TotalReceivedBytes      string `json:"totrxbytes"`
	TotalTransmitBytes      string `json:"tottxbytes"`
	TotalReceivedPackets    string `json:"totrxpkts"`
	TotalTransmitPackets    string `json:"tottxpkts"`
	JumboPacketsReceived    string `json:"jumbopktsreceived"`
	JumboPacketsTransmitted string `json:"jumbopktstransmitted"`
	ErrorPacketsReceived    string `json:"errpktrx"`
	Alias                   string `json:"interfacealias"`
}

InterfaceStats represents the data returned from the /stat/interface Nitro API endpoint

type LoginCreds

type LoginCreds struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

LoginCreds contains the username and password

type LoginPayload

type LoginPayload struct {
	Login LoginCreds `json:"login"`
}

LoginPayload is the request body that needs to be sent to NetScaler to login

type NSAPIResponse

type NSAPIResponse struct {
	Errorcode               int64                     `json:"errorcode"`
	Message                 string                    `json:"message"`
	Severity                string                    `json:"severity"`
	NSLicense               NSLicense                 `json:"nslicense"`
	NSStats                 NSStats                   `json:"ns"`
	InterfaceStats          []InterfaceStats          `json:"Interface"`
	VirtualServerStats      []VirtualServerStats      `json:"lbvserver"`
	ServiceStats            []ServiceStats            `json:"service"`
	ServiceGroups           []ServiceGroups           `json:"servicegroup"`
	ServiceGroupMemberStats []ServiceGroupMemberStats `json:"servicegroupmember"`
	GSLBServiceStats        []GSLBServiceStats        `json:"gslbservice"`
	GSLBVirtualServerStats  []GSLBVirtualServerStats  `json:"gslbvserver"`
	CSVirtualServerStats    []CSVirtualServerStats    `json:"csvserver"`
	VPNVirtualServerStats   []VPNVirtualServerStats   `json:"vpnvserver"`
	AAAStats                AAAStats                  `json:"aaa"`
}

NSAPIResponse represents the main portion of the Nitro API response

func GetAAAStats

func GetAAAStats(c *NitroClient, querystring string) (NSAPIResponse, error)

GetAAAStats queries the Nitro API for AAA stats

func GetCSVirtualServerStats

func GetCSVirtualServerStats(c *NitroClient, querystring string) (NSAPIResponse, error)

GetCSVirtualServerStats queries the Nitro API for Content Switching virtual server stats

func GetGSLBServiceStats

func GetGSLBServiceStats(c *NitroClient, querystring string) (NSAPIResponse, error)

GetGSLBServiceStats queries the Nitro API for service stats

func GetGSLBVirtualServerStats

func GetGSLBVirtualServerStats(c *NitroClient, querystring string) (NSAPIResponse, error)

GetGSLBVirtualServerStats queries the Nitro API for virtual server stats

func GetInterfaceStats

func GetInterfaceStats(c *NitroClient, querystring string) (NSAPIResponse, error)

GetInterfaceStats queries the Nitro API for interface stats

func GetNSLicense

func GetNSLicense(c *NitroClient, querystring string) (NSAPIResponse, error)

GetNSLicense queries the Nitro API for license config

func GetNSStats

func GetNSStats(c *NitroClient, querystring string) (NSAPIResponse, error)

GetNSStats queries the Nitro API for ns stats

func GetServiceGroupMemberStats

func GetServiceGroupMemberStats(c *NitroClient, querystring string) (NSAPIResponse, error)

GetServiceGroupMemberStats queries the Nitro API for servicegroup member stats

func GetServiceGroups

func GetServiceGroups(c *NitroClient, querystring string) (NSAPIResponse, error)

GetServiceGroups queries the Nitro API for service group config

func GetServiceStats

func GetServiceStats(c *NitroClient, querystring string) (NSAPIResponse, error)

GetServiceStats queries the Nitro API for service stats

func GetVPNVirtualServerStats

func GetVPNVirtualServerStats(c *NitroClient, querystring string) (NSAPIResponse, error)

GetVPNVirtualServerStats queries the Nitro API for VPN virtual server stats

func GetVirtualServerStats

func GetVirtualServerStats(c *NitroClient, querystring string) (NSAPIResponse, error)

GetVirtualServerStats queries the Nitro API for virtual server stats

type NSLicense

type NSLicense struct {
	ModelID string `json:"modelid"`
}

NSLicense represents the data returned from the /config/nslicense Nitro API endpoint

type NSStats

type NSStats struct {
	CPUUsagePcnt                           float64 `json:"cpuusagepcnt"`
	MemUsagePcnt                           float64 `json:"memusagepcnt"`
	MgmtCPUUsagePcnt                       float64 `json:"mgmtcpuusagepcnt"`
	PktCPUUsagePcnt                        float64 `json:"pktcpuusagepcnt"`
	FlashPartitionUsage                    float64 `json:"disk0perusage"`
	VarPartitionUsage                      float64 `json:"disk1perusage"`
	TotalReceivedMB                        string  `json:"totrxmbits"`
	TotalTransmitMB                        string  `json:"tottxmbits"`
	HTTPRequests                           string  `json:"httptotrequests"`
	HTTPResponses                          string  `json:"httptotresponses"`
	TCPCurrentClientConnections            string  `json:"tcpcurclientconn"`
	TCPCurrentClientConnectionsEstablished string  `json:"tcpcurclientconnestablished"`
	TCPCurrentServerConnections            string  `json:"tcpcurserverconn"`
	TCPCurrentServerConnectionsEstablished string  `json:"tcpcurserverconnestablished"`
}

NSStats represents the data returned from the /stat/ns Nitro API endpoint

type NitroClient

type NitroClient struct {
	// contains filtered or unexported fields
}

NitroClient represents the client used to connect to the API

func NewNitroClient

func NewNitroClient(url string, username string, password string, ignoreCert bool) (*NitroClient, error)

NewNitroClient creates a new client used to interact with the Nitro API. URL, username and password are passed to this function to allow connections to any NetScaler endpoint. The ignoreCert parameter allows self-signed certificates to be accepted. It should be used sparingly and only when you fully trust the endpoint.

func (*NitroClient) CloseIdleConnections

func (c *NitroClient) CloseIdleConnections()

func (*NitroClient) GetConfig

func (c *NitroClient) GetConfig(configType string, querystring string) ([]byte, error)

GetConfig sends a request to the Nitro API and retrieves configuration for the given type.

func (*NitroClient) GetStats

func (c *NitroClient) GetStats(statsType string, querystring string) ([]byte, error)

GetStats sends a request to the Nitro API and retrieves stats for the given type.

type ServiceGroupMemberStats

type ServiceGroupMemberStats struct {
	PrimaryPort                  int    `json:"primaryport"`
	State                        string `json:"state"`
	AvgTimeToFirstByte           string `json:"avgsvrttfb"`
	TotalRequests                string `json:"totalrequests"`
	TotalResponses               string `json:"totalresponses"`
	TotalRequestBytes            string `json:"totalrequestbytes"`
	TotalResponseBytes           string `json:"totalresponsebytes"`
	CurrentClientConnections     string `json:"curclntconnections"`
	SurgeCount                   string `json:"surgecount"`
	CurrentServerConnections     string `json:"cursrvrconnections"`
	ServerEstablishedConnections string `json:"svrestablishedconn"`
	CurrentReusePool             string `json:"curreusepool"`
	MaxClients                   string `json:"maxclients"`
	PrimaryIPAddress             string `json:"primaryipaddress"`
	ServiceGroupName             string `json:"servicegroupname"`
}

ServiceGroupMemberStats represents the data returned from the /stat/servicegroupmember Nitro API endpoint

type ServiceGroups

type ServiceGroups struct {
	Name                string                    `json:"servicegroupname"`
	ServiceGroupMembers []ServiceGroupMemberStats `json:"servicegroupmember"`
}

ServiceGroups represents the data returned from the /config/servicegroup Nitro API endpoint

type ServiceStats

type ServiceStats struct {
	Name                         string `json:"name"`
	Throughput                   string `json:"throughput"`
	AvgTimeToFirstByte           string `json:"avgsvrttfb"`
	State                        string `json:"state"`
	TotalRequests                string `json:"totalrequests"`
	TotalResponses               string `json:"totalresponses"`
	TotalRequestBytes            string `json:"totalrequestbytes"`
	TotalResponseBytes           string `json:"totalresponsebytes"`
	CurrentClientConnections     string `json:"curclntconnections"`
	SurgeCount                   string `json:"surgecount"`
	CurrentServerConnections     string `json:"cursrvrconnections"`
	ServerEstablishedConnections string `json:"svrestablishedconn"`
	CurrentReusePool             string `json:"curreusepool"`
	MaxClients                   string `json:"maxclients"`
	CurrentLoad                  string `json:"curload"`
	ServiceHits                  string `json:"vsvrservicehits"`
	ActiveTransactions           string `json:"activetransactions"`
}

ServiceStats represents the data returned from the /stat/service Nitro API endpoint

type VPNVirtualServerStats

type VPNVirtualServerStats struct {
	Name               string `json:"name"`
	TotalRequests      string `json:"totalrequests"`
	TotalResponses     string `json:"totalresponses"`
	TotalRequestBytes  string `json:"totalrequestbytes"`
	TotalResponseBytes string `json:"totalresponsebytes"`
	State              string `json:"state"`
}

VPNVirtualServerStats represents the data returned from the /stat/vpnvserver Nitro API endpoint

type VirtualServerStats

type VirtualServerStats struct {
	Name                     string `json:"name"`
	State                    string `json:"state"`
	WaitingRequests          string `json:"vsvrsurgecount"`
	Health                   string `json:"vslbhealth"`
	InactiveServices         string `json:"inactsvcs"`
	ActiveServices           string `json:"actsvcs"`
	TotalHits                string `json:"tothits"`
	TotalRequests            string `json:"totalrequests"`
	TotalResponses           string `json:"totalresponses"`
	TotalRequestBytes        string `json:"totalrequestbytes"`
	TotalResponseBytes       string `json:"totalresponsebytes"`
	CurrentClientConnections string `json:"curclntconnections"`
	CurrentServerConnections string `json:"cursrvrconnections"`
}

VirtualServerStats represents the data returned from the /stat/lbvserver Nitro API endpoint

Jump to

Keyboard shortcuts

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