-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from rokett/dev
More efficient retrieval of service group member stats
- Loading branch information
Showing
23 changed files
with
122 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package netscaler | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/pkg/errors" | ||
) | ||
|
||
// ServiceGroupMemberStats represents the data returned from the /stat/servicegroupmember Nitro API endpoint | ||
type ServiceGroupMemberStats struct { | ||
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"` | ||
} | ||
|
||
// GetServiceGroupMemberStats queries the Nitro API for servicegroup member stats | ||
func GetServiceGroupMemberStats(c *NitroClient, querystring string) (NSAPIResponse, error) { | ||
q := fmt.Sprintf("servicegroup/%s", querystring) | ||
stats, err := c.GetStats(q, "statbindings=yes") | ||
if err != nil { | ||
return NSAPIResponse{}, err | ||
} | ||
|
||
var response = new(NSAPIResponse) | ||
|
||
err = json.Unmarshal(stats, &response) | ||
if err != nil { | ||
return NSAPIResponse{}, errors.Wrap(err, "error unmarshalling response body") | ||
} | ||
|
||
return *response, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.