Documentation
¶
Index ¶
- func QueryToJSON(query interface{}) (result string, err error)
- type Client
- func NewClient(host string, port int, verbose bool) *Client
- func NewClientSSL(host string, port int, key string, cert string, ca string, verbose bool) *Client
- func NewClientSSLInsecure(host string, port int, verbose bool) *Client
- func NewClientTimeout(host string, port int, verbose bool, timeout int) *Client
- func NewClientTimeoutSSL(host string, port int, key string, cert string, ca string, verbose bool, ...) *Client
- func NewClientURL(url *url.URL, verbose bool) *Client
- func (c *Client) EventCounts(query string, summarizeBy string, extraParams map[string]string) ([]EventCountJSON, error)
- func (c *Client) Events(query string, extraParams map[string]string) ([]EventJSON, error)
- func (c *Client) FactNames() ([]string, error)
- func (c *Client) FactPerNode(fact string) ([]FactJSON, error)
- func (c *Client) Get(v interface{}, path string, params map[string]string) error
- func (c *Client) GetFacts(path string) ([]FactJSON, error)
- func (c *Client) Metric(v interface{}, metric string) error
- func (c *Client) MetricNumNodes() (result float64, err error)
- func (c *Client) MetricNumResources() (result float64, err error)
- func (c *Client) MetricResourcesPerNode() (result float64, err error)
- func (c *Client) NodeFacts(node string) ([]FactJSON, error)
- func (c *Client) Nodes() ([]NodeJSON, error)
- func (c *Client) PQLRawQuery(query string) (io.ReadCloser, error)
- func (c *Client) PuppetdbVersion() (Version, error)
- func (c *Client) ReportByHash(hash string) ([]ReportJSON, error)
- func (c *Client) Reports(query string, extraParams map[string]string) ([]ReportJSON, error)
- func (c *Client) Resources(query string, extraParams map[string]string) ([]Resource, error)
- type ClientMaster
- func (c *ClientMaster) Delete(path string) (error, int)
- func (c *ClientMaster) Get(v interface{}, path string) error
- func (c *ClientMaster) Jruby() (JrubyMetrics, error)
- func (c *ClientMaster) Master() (MasterMetrics, error)
- func (c *ClientMaster) Profiler() (Profiler, error)
- func (c *ClientMaster) PuppetCertificate(certname string) (PuppetCertificate, error)
- func (c *ClientMaster) PuppetCertificateDelete(certname string) (error, int)
- func (c *ClientMaster) PuppetCertificateUpdateState(certname string, state string) (PuppetCertificateState, error, int)
- func (c *ClientMaster) PuppetCertificates() ([]PuppetCertificate, error)
- func (c *ClientMaster) Put(v interface{}, path string, values interface{}) (error, int)
- func (c *ClientMaster) Service() (ServiceMetrics, error)
- type EventCountJSON
- type EventJSON
- type FactJSON
- type JrubyBorrowedInstance
- type JrubyBorrowedInstanceReason
- type JrubyBorrowedInstanceReasonRequest
- type JrubyExperimental
- type JrubyExperimentalMetrics
- type JrubyMetrics
- type JrubyPoolLockStatus
- type JrubyStatus
- type MasterExperimental
- type MasterHttpClientMetric
- type MasterHttpMetric
- type MasterMetrics
- type MasterStatus
- type NodeJSON
- type Profiler
- type ProfilerCatalogMetric
- type ProfilerExperimental
- type ProfilerFunctionMetric
- type ProfilerResourceMetric
- type ProfilerStatus
- type PuppetCertificate
- type PuppetCertificateFingerPrint
- type PuppetCertificateState
- type PuppetReportLog
- type PuppetReportMetrics
- type PuppetReportMetricsDataEntry
- type PuppetReportMetricsLogEntry
- type PuppetReportResource
- type ReportJSON
- type Resource
- type ServiceExperimental
- type ServiceJVMMetric
- type ServiceJVMMetricFile
- type ServiceJVMMetricGCStats
- type ServiceJVMMetricHeapMemory
- type ServiceJVMMetricLastInfo
- type ServiceJVMMetricPS
- type ServiceJVMMetricThreading
- type ServiceMetrics
- type ServiceStatus
- type ValueMetricJSON
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func QueryToJSON ¶
QueryToJSON Converts a query to json.
Types ¶
type Client ¶
type Client struct {
BaseURL string
Cert string
Key string
// contains filtered or unexported fields
}
Client This represents a connection to your puppetdb instance
func NewClientSSL ¶
NewClientSSL returns a https connection for your puppetdb instance.
func NewClientSSLInsecure ¶
NewClientSSLInsecure returns a https connection for your puppetdb instance but trusts self signed certificates.
func NewClientTimeout ¶
NewClientTimeout returns a http connection for your puppetdb instance with a timeout.
func NewClientTimeoutSSL ¶
func NewClientTimeoutSSL(host string, port int, key string, cert string, ca string, verbose bool, timeout int) *Client
NewClientTimeoutSSL returns a http connection for your puppetdb instance with a timeout and ssl configured.
func NewClientURL ¶
NewClientURL returns a http connection for your puppetdb instance.
func (*Client) EventCounts ¶
func (c *Client) EventCounts(query string, summarizeBy string, extraParams map[string]string) ([]EventCountJSON, error)
EventCounts Returns the even counts
func (*Client) FactPerNode ¶
FactPerNode Gets all nodes values for a specified fact.
func (*Client) GetFacts ¶
GetFacts returns an array of Json facts and returns them. It now uses gabs array because json value is not consistent.
func (*Client) MetricNumNodes ¶
MetricNumResources Gets the number of nodes
func (*Client) MetricNumResources ¶
MetricNumResources Gets the number of resources
func (*Client) MetricResourcesPerNode ¶
MetricResourcesPerNode Gets the average resources per node
func (*Client) Nodes ¶
Nodes Polls the nodes api of your puppetdb and returns the results in form of the NodeJSON type.
func (*Client) PQLRawQuery ¶
func (c *Client) PQLRawQuery(query string) (io.ReadCloser, error)
PQLRawQuery performs a PQL query in the most basic form It cowardly returns the full body as an io.ReadCloser for the caller to handle the data
func (*Client) PuppetdbVersion ¶
PuppetdbVersion gets the specified puppetdb version.
func (*Client) ReportByHash ¶
func (c *Client) ReportByHash(hash string) ([]ReportJSON, error)
ReportByHash Gets the report for this specific hash
type ClientMaster ¶
type ClientMaster struct {
BaseURL string
Cert string
Key string
// contains filtered or unexported fields
}
func NewClientSSLInsecureMaster ¶
func NewClientSSLInsecureMaster(host string, port int, verbose bool) *ClientMaster
NewClientSSLInsecure returns a https connection for your puppetdb instance but trusts self signed certificates.
func NewClientSSLMaster ¶
func NewClientSSLMaster(host string, port int, key string, cert string, ca string, verbose bool) *ClientMaster
NewClientSSL gets a new client with ssl certs enabled
func (*ClientMaster) Delete ¶
func (c *ClientMaster) Delete(path string) (error, int)
Delete request to the given url and returns the result code
func (*ClientMaster) Get ¶
func (c *ClientMaster) Get(v interface{}, path string) error
Get gets the given url and retruns the result. In form of the given interface.
func (*ClientMaster) Jruby ¶
func (c *ClientMaster) Jruby() (JrubyMetrics, error)
Jruby returns a jruby metrics object
func (*ClientMaster) Master ¶
func (c *ClientMaster) Master() (MasterMetrics, error)
Master returns a master metrics object
func (*ClientMaster) Profiler ¶
func (c *ClientMaster) Profiler() (Profiler, error)
profiler returns a profiler metrics object
func (*ClientMaster) PuppetCertificate ¶
func (c *ClientMaster) PuppetCertificate(certname string) (PuppetCertificate, error)
PuppetCertificate returns a single entry of a puppet certificate
func (*ClientMaster) PuppetCertificateDelete ¶
func (c *ClientMaster) PuppetCertificateDelete(certname string) (error, int)
PuppetCertificateDelete deletes a certificate entry
func (*ClientMaster) PuppetCertificateUpdateState ¶
func (c *ClientMaster) PuppetCertificateUpdateState(certname string, state string) (PuppetCertificateState, error, int)
PuppetCertificateUpdateStatereturns a single entry of a puppet certificate
func (*ClientMaster) PuppetCertificates ¶
func (c *ClientMaster) PuppetCertificates() ([]PuppetCertificate, error)
PuppetCertificatesreturns an array of puppet certificates
func (*ClientMaster) Put ¶
func (c *ClientMaster) Put(v interface{}, path string, values interface{}) (error, int)
Put request to the given url and returns the status code
func (*ClientMaster) Service ¶
func (c *ClientMaster) Service() (ServiceMetrics, error)
Master returns a master metrics object
type EventCountJSON ¶
type EventCountJSON struct {
SubjectType string `json:"subject-type"`
Subject map[string]string `json:"subject"`
Failure int64 `json:"failures"`
Successes int64 `json:"successes"`
Noops int64 `json:"noops"`
Skips int64 `json:"skips"`
}
EventCountJSON A json object holding the results of a query to the eventcount api
type EventJSON ¶
type EventJSON struct {
CertName string `json:"certname"`
OldValue string `json:"old-value"`
Property string `json:"property"`
Timestamp string `json:"timestamp"`
ResourceType string `json:"resource-typ"`
ResourceTitle string `json:"resource-title"`
NewValue string `json:"new-value"`
Message string `json:"message"`
Report string `json:"report"`
Status string `json:"status"`
File string `json:"file"`
ContainmentPath string `json:"containment-path"`
ContainmentClass string `json:"containing-class"`
RunStartTime string `json:"run-start-time"`
RunEndTime string `json:"run-end-time"`
ReportReceiveTime string `json:"report-receive-time"`
}
EventJSON A json object holding the results of a query to the event api.
type FactJSON ¶
type FactJSON struct {
CertName string `json:"certname"`
Environment string `json:"environment"`
Name string `json:"name"`
Value *gabs.Container `json:"value"`
}
FactJSON A json object holding the results of a query to the facts api.
type JrubyBorrowedInstance ¶
type JrubyBorrowedInstance struct {
Time int `json:"time"`
DurationMilis int `json:"duration-millis"`
Reason *JrubyBorrowedInstanceReason `json:"reason"`
}
JrubyBorrowedInstance holds metrics for jruby
type JrubyBorrowedInstanceReason ¶
type JrubyBorrowedInstanceReason struct {
Request *JrubyBorrowedInstanceReasonRequest `json:"request"`
}
JrubyBorrowedInstanceReason holds metrics for jruby
type JrubyBorrowedInstanceReasonRequest ¶
type JrubyBorrowedInstanceReasonRequest struct {
Uri string `json:"uri"`
Method string `json:"request-method"`
RouteId string `json:"route-id"`
}
JrubyBorrowedInstanceReasonRequest holds metrics for jruby
type JrubyExperimental ¶
type JrubyExperimental struct {
JrubyPoolLockStatus *JrubyPoolLockStatus `json:"jruby-pool-lock-status"`
Metrics *JrubyExperimentalMetrics `json:"metrics"`
}
JrubyExperimental is a struct that holds the array of metrics
type JrubyExperimentalMetrics ¶
type JrubyExperimentalMetrics struct {
AverageLockWaitTime int `json:"average-lock-wait-time"`
NumFreeJrubies int `json:"num-free-jrubies"`
BorrowCount int `json:"borrow-count"`
AverageRequestedJrubies float64 `json:"average-requested-jrubies"`
BorrowTimeoutCount int `json:"borrow-timeout-count"`
ReturnCount int `json:"return-count"`
BorrowRetryCount int `json:"borrow-retry-count"`
BorrowedInstances *[]JrubyBorrowedInstance `json:"borrowed-instances"`
AverageBorrowTime int `json:"average-borrow-time"`
NumJrubies int `json:"num-jrubies"`
RequestedCount int `json:"requested-count"`
QueueLimitHitRate float64 `json:"queue-limit-hit-rate"`
AverageLockHeldTime int `json:"average-lock-held-time"`
QueueLimitHitCount int `json:"queue-limit-hit-count"`
AverageFreeJrubies float64 `json:"average-free-jrubies"`
NumPoolLocks int `json:"num-pool-locks"`
AverageWaitTime int `json:"average-wait-time"`
}
JrubyExperimentalMetrics holds metrics for jruby
type JrubyMetrics ¶
type JrubyMetrics struct {
Version string `json:"service_version"`
StateVersion int `json:"service_status_version"`
DetailLevel string `json:"detail_level"`
State string `json:"state"`
Status *JrubyStatus `json:"status"`
}
JrubyMetrics is a struct that holds the data for the jruby metrics
type JrubyPoolLockStatus ¶
type JrubyPoolLockStatus struct {
State string `json:"current-state"`
ChangeTime string `json:"last-change-time"`
}
JrubyPoolLockStatus holds metrics for jruby
type JrubyStatus ¶
type JrubyStatus struct {
Experimental *JrubyExperimental `json:"experimental"`
}
JrubyStatus is a struct that the experimental json which holds the correct arrays
type MasterExperimental ¶
type MasterExperimental struct {
HttpMetrics *[]MasterHttpMetric `json:"http-metrics"`
HttpClientMetrics *[]MasterHttpClientMetric `json:"http-client-metrics"`
}
MasterExperimental is a struct that holds the array of metrics
type MasterHttpClientMetric ¶
type MasterHttpClientMetric struct {
MetricName string `json:"metric-name"`
MetricId *[]string `json:"metric-id"`
Count int `json:"count"`
Mean int `json:"mean"`
Aggregate int `json:"aggregate"`
}
MasterHttpClientMetric is a struct that holds master data
type MasterHttpMetric ¶
type MasterHttpMetric struct {
RouteId string `json:"route-id"`
Count int `json:"count"`
Mean int `json:"mean"`
Aggregate int `json:"aggregate"`
}
MasterHttpMetric is a struct that holds master data
type MasterMetrics ¶
type MasterMetrics struct {
Version string `json:"service_version"`
StateVersion int `json:"service_status_version"`
DetailLevel string `json:"detail_level"`
State string `json:"state"`
Status *MasterStatus `json:"status"`
}
MasterMetrics holds metrics for jruby
type MasterStatus ¶
type MasterStatus struct {
Experimental *MasterExperimental `json:"experimental"`
}
MasterStatus is a struct that the experimental json which holds the correct arrays
type NodeJSON ¶
type NodeJSON struct {
Certname string `json:"certname"`
Deactivated string `json:"deactivated"`
CatalogTimestamp string `json:"catalog_timestamp"`
FactsTimestamp string `json:"facts_timestamp"`
CatalogEnvironment string `json:"catalog_environment"`
FactsEnvironment string `json:"facts_environment"`
LatestReportHash string `json:"latest_report_hash"`
CachedCatalogStatus string `json:"cached_catalog_status"`
ReportEnvironment string `json:"report_environment"`
ReportTimestamp string `json:"report_timestamp"`
LatestReportCorrectiveChange string `json:"latest_report_corrective_change"`
LatestReportNoop bool `json:"latest_report_noop"`
LatestReportNoopPending bool `json:"latest_report_noop_pending"`
Expired string `json:"expired"`
LatestReportJobID string `json:"latest_report_job_id"`
LatestReportStatus string `json:"latest_report_status"`
}
NodeJSON A json object holding the results of query to the node api.
type Profiler ¶
type Profiler struct {
Version string `json:"service_version"`
StateVersion int `json:"service_status_version"`
DetailLevel string `json:"detail_level"`
State string `json:"state"`
Status *ProfilerStatus `json:"status"`
}
Profiler is a struct that holds the profiler metrics for the puppet master
type ProfilerCatalogMetric ¶
type ProfilerCatalogMetric struct {
Metric string `json:"metric"`
Count int `json:"count"`
Mean int `json:"mean"`
Aggregate int `json:"aggregate"`
}
ProfilerCatalogMetric is a struct that holds the data for a single profiler catalog metric
type ProfilerExperimental ¶
type ProfilerExperimental struct {
FunctionMetrics *[]ProfilerFunctionMetric `json:"function-metrics"`
ResourceMetrics *[]ProfilerResourceMetric `json:"resource-metrics"`
CatalogMetrics *[]ProfilerCatalogMetric `json:"catalog-metrics"`
PuppetdbMetrics *[]ProfilerCatalogMetric `json:"puppetdb-metrics"`
}
ProfilerExperimental is a struct that holds the array of metrics
type ProfilerFunctionMetric ¶
type ProfilerFunctionMetric struct {
Function string `json:"function"`
Count int `json:"count"`
Mean int `json:"mean"`
Aggregate int `json:"aggregate"`
}
ProfilerFunctionMetric is a struct that holds the data for a single profiler function metric
type ProfilerResourceMetric ¶
type ProfilerResourceMetric struct {
Resource string `json:"resource"`
Count int `json:"count"`
Mean int `json:"mean"`
Aggregate int `json:"aggregate"`
}
ProfilerFunctionMetric is a struct that holds the data for a single profiler catalog metric
type ProfilerStatus ¶
type ProfilerStatus struct {
Experimental *ProfilerExperimental `json:"experimental"`
}
ProfilerStatus is a struct that the experimental json which holds the correct arrays
type PuppetCertificate ¶
type PuppetCertificate struct {
Name string `json:"name"`
State string `json:"state"`
DNSAltNames []string `json:"dns_alt_names"`
SubjectAltNames []string `json:"subject_alt_names"`
Fingerprint string `json:"fingerprint"`
Fingerprints PuppetCertificateFingerPrint `json:"fingerprints"`
}
PuppetCertificate is a struct that holds data for a puppet certificate entry
type PuppetCertificateFingerPrint ¶
type PuppetCertificateFingerPrint struct {
SHA1 string `json:"SHA1"`
SHA256 string `json:"SHA256"`
SHA512 string `json:"SHA512"`
Default string `json:"default"`
}
PuppetCertificateFingerprint is a struct that holds data for a puppet certificate entry's fingerprint
type PuppetCertificateState ¶
type PuppetCertificateState struct {
DesiredState string `json:"desired_state"`
}
PuppetCertificateState is a struct that holds data for a puppet certificate state
type PuppetReportLog ¶
type PuppetReportLog struct {
Href string `json:"href"`
Data []PuppetReportMetricsLogEntry `json:"data"`
}
type PuppetReportMetrics ¶
type PuppetReportMetrics struct {
Href string `json:"href"`
Data []PuppetReportMetricsDataEntry `json:"data"`
}
type PuppetReportMetricsLogEntry ¶
type PuppetReportMetricsLogEntry struct {
NewValue string `json:"new_value"`
Property string `json:"property"`
File string `json:"file"`
Line string `json:"line"`
Tags []string `json:"tags"`
Time string `json:"time"`
Level string `json:"level"`
Source string `json:"source"`
Message string `json:"message"`
}
type PuppetReportResource ¶
type PuppetReportResource struct {
Href string `json:"href"`
}
type ReportJSON ¶
type ReportJSON struct {
CertName string `json:"certname"`
PuppetVersion string `json:"puppet_version"`
Value string `json:"value"`
Hash string `json:"hash"`
ReportFormat int64 `json:"report_format"`
ConfigurationVersion string `json:"configuration_version"`
CatalogUUID string `json:"catalog_uuid"`
TransactionUUID string `json:"transaction_uuid"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
ReceiveTime string `json:"receive_time"`
Noop bool `json:"noop"`
Producer string `json:"producer"`
CorrectiveChange string `json:"corrective_change"`
Logs PuppetReportLog `json:"logs"`
ProducerTimestamp string `json:"producer_timestamp"`
CachedCatalogStatus string `json:"cached_catalog_status"`
ResourceEvents PuppetReportResource `json:"resource_events"`
Status string `json:"Status"`
Environment string `json:"Environment"`
CodeID string `json:"code_id"`
NoopPending bool `json:"noop_pending"`
Metrics PuppetReportMetrics `json:"metrics"`
}
ReportJSON A json abject holding the data for a query from the report api.
type Resource ¶
type Resource struct {
Paramaters map[string]interface{} `json:"parameters"`
Line int `json:"line,omitempty"`
Exported bool `json:"exported,omitempty"`
Tags []string `json:"tags,omitempty"`
Title string `json:"title,omitempty"`
Type string `json:"type,omitempty"`
Resource string `json:"resource,omitempty"`
Certname string `json:"certname,omitempty"`
}
Resource contains information about a puppet resource.
type ServiceExperimental ¶
type ServiceExperimental struct {
JVMMetrics *ServiceJVMMetric `json:"jvm-metrics"`
}
ServiceExperimental is a struct that holds the array of metrics
type ServiceJVMMetric ¶
type ServiceJVMMetric struct {
CpuUsage float64 `json:"cpu-usage"`
UptimeMs int `json:"up-time-ms"`
GCCpuUsage float64 `json:"gc-cpu-usage"`
StartTimeMs int `json:"start-time-ms"`
Threading *ServiceJVMMetricThreading `json:"threading"`
HeapMemory *ServiceJVMMetricHeapMemory `json:"heap-memory"`
GCStats *ServiceJVMMetricGCStats `json:"gc-stats"`
FileDescriptors *ServiceJVMMetricFile `json:"file-descriptors"`
NonHeapMemory *ServiceJVMMetricHeapMemory `json:"non-heap-memory"`
}
ServiceJVMMetric is a struct that holds metrics
type ServiceJVMMetricFile ¶
ServiceJVMMetricFile is a struct that holds metrics
type ServiceJVMMetricGCStats ¶
type ServiceJVMMetricGCStats struct {
PSScavenge *ServiceJVMMetricPS `json:"PS Scavenge"`
PSSweep *ServiceJVMMetricPS `json:"PS MarkSweep"`
}
ServiceJVMMetricGCStats is a struct that holds metrics
type ServiceJVMMetricHeapMemory ¶
type ServiceJVMMetricHeapMemory struct {
Committed int `json:"committed"`
Init int `json:"init"`
Max int `json:"max"`
Used int `json:"used"`
}
ServiceJVMMetricHeapMemory is a struct that holds metrics
type ServiceJVMMetricLastInfo ¶
type ServiceJVMMetricLastInfo struct {
DurationMs int `json:"duration-ms"`
}
ServiceJVMMetricLastInfo is a struct that holds metrics
type ServiceJVMMetricPS ¶
type ServiceJVMMetricPS struct {
Count int `json:"count"`
TotalTimeMs int `json:"total-time-ms"`
LastGCInfo *ServiceJVMMetricLastInfo `json:"last-gc-info"`
}
ServiceJVMMetricPS is a struct that holds metrics
type ServiceJVMMetricThreading ¶
type ServiceJVMMetricThreading struct {
ThreadCount int `json:"thread-count"`
PeakThreadCount int `json:"peak-thread-count"`
}
ServiceJVMMetricThreading is a struct that holds metrics
type ServiceMetrics ¶
type ServiceMetrics struct {
Version string `json:"service_version"`
StateVersion int `json:"service_status_version"`
DetailLevel string `json:"detail_level"`
State string `json:"state"`
Status *ServiceStatus `json:"status"`
}
ServiceMetrics holds metrics for jruby
type ServiceStatus ¶
type ServiceStatus struct {
Experimental *ServiceExperimental `json:"experimental"`
}
ServiceStatus is a struct that the experimental json which holds the correct arrays
type ValueMetricJSON ¶
type ValueMetricJSON struct {
Value float64
}
ValueMetricJSON A simple structholding a float value.