Documentation ¶
Index ¶
- Constants
- Variables
- func CallbackHttp(json string) (e error)
- func Dump(data interface{})
- func HttpAuthorityAllowHandler(params martini.Params) (int, string)
- func HttpAuthorityListHandler(params martini.Params) (int, string)
- func HttpAuthorityRevokeHandler(params martini.Params) (int, string)
- func HttpGroupsHandler(params martini.Params) (int, string)
- func HttpLogsHandler(params martini.Params, r *http.Request) (int, string)
- func HttpLogsIndexesHandler(params martini.Params) (int, string)
- func HttpRemotesHandler(params martini.Params) (int, string)
- func HttpRemotesProbesHandler(params martini.Params) (int, string)
- func HttpRemotesProbesStatusHandler(params martini.Params) (int, string)
- func HttpRemotesStatusHandler(params martini.Params) (int, string)
- func InitChannels()
- func InitWigo() (err error)
- func IsStringInArray(str string, l []string) bool
- func ListProbesDirectories() ([]string, error)
- func ListProbesInDirectory(directory string) (probesList *list.List, error error)
- func NewConcurrentMapProbes() *concurrentMapProbes
- func NewConcurrentMapWigos() *concurrentMapWigos
- func SendMail(summary string, message string)
- func SendNotification(notification INotification)
- func StatusToString(status int) string
- func ToJson(data interface{}) string
- type AdvancedRemoteWigoConfig
- type Authority
- func (this *Authority) AddClientToWaitingList(uuid string, hostname string) (err error)
- func (this *Authority) AllowClient(uuid string) (err error)
- func (this *Authority) GetServerCertificate() []byte
- func (this *Authority) GetToken(clientUuid string) (token string, err error)
- func (this *Authority) GetUuidSignature(uuid string, hostname string) (uuidSignature []byte, err error)
- func (this *Authority) IsAllowed(uuid string) bool
- func (this *Authority) IsWaiting(uuid string) bool
- func (this *Authority) LoadAllowedList() (err error)
- func (this *Authority) RevokeClient(uuid string) (err error)
- func (this *Authority) RevokeToken(uuid string, token string) (err error)
- func (this *Authority) SaveAllowedList() (err error)
- func (this *Authority) VerifyToken(uuid string, token string) (err error)
- func (this *Authority) VerifyUuidSignature(uuid string, uuidSignature []byte) (err error)
- type Chans
- type Config
- type Event
- type GeneralConfig
- type HelloRequest
- type Host
- func (this *Host) AddOrUpdateProbe(probe *ProbeResult)
- func (this *Host) DeleteProbeByName(probeName string)
- func (this *Host) GetErrorsProbesList() (list []string)
- func (this *Host) GetParentWigo() *Wigo
- func (this *Host) GetSummary() (hs *HostSummary)
- func (this *Host) RecomputeStatus()
- func (this *Host) SetParentWigo(w *Wigo)
- type HostSummary
- type HttpConfig
- type INotification
- type Log
- type Notification
- type NotificationConfig
- type NotificationProbe
- type NotificationWigo
- type OpenTSDBConfig
- type ProbeResult
- type PushClient
- func (this *PushClient) CallWithTimeout(serviceMethod string, args interface{}, reply interface{}, ...) error
- func (this *PushClient) Close() (err error)
- func (this *PushClient) GetServerCertificate() (err error)
- func (this *PushClient) Goodbye() (err error)
- func (this *PushClient) Hello() (err error)
- func (this *PushClient) SignUuid() (err error)
- func (this *PushClient) Update() (err error)
- type PushClientConfig
- type PushServer
- func (this *PushServer) GetServerCertificate(req HelloRequest, cert *[]byte) (err error)
- func (this *PushServer) GetUuidSignature(req HelloRequest, sig *[]byte) (err error)
- func (this *PushServer) Goodbye(req Request, reply *bool) (err error)
- func (this *PushServer) Hello(req HelloRequest, token *string) (err error)
- func (this *PushServer) Register(req HelloRequest, reply *bool) (err error)
- func (this *PushServer) Update(req UpdateRequest, reply *bool) (err error)
- type PushServerConfig
- type Put
- type RemoteWigoConfig
- type Request
- type UpdateRequest
- type Wigo
- func (this *Wigo) AddLog(ressource interface{}, level uint8, message string) (err error)
- func (this *Wigo) AddOrUpdateRemoteWigo(remoteWigo *Wigo)
- func (this *Wigo) CompareTwoWigosAndRaiseNotifications(oldWigo *Wigo, newWigo *Wigo)
- func (this *Wigo) Deduplicate(remoteWigo *Wigo) (err error)
- func (this *Wigo) DisableProbe(probeName string)
- func (this *Wigo) Down()
- func (this *Wigo) EraseRemoteWigos(depth int) *Wigo
- func (this *Wigo) FindRemoteWigoByHostname(hostname string) *Wigo
- func (this *Wigo) FindRemoteWigoByUuid(uuid string) (*Wigo, bool)
- func (this *Wigo) GenerateRemoteWigosSummary(level int, showOnlyErrors bool, version string) (summary string)
- func (this *Wigo) GenerateSummary(showOnlyErrors bool) (summary string)
- func (this *Wigo) GetConfig() *Config
- func (this *Wigo) GetDisabledProbes() *list.List
- func (this *Wigo) GetHostname() string
- func (this *Wigo) GetLocalHost() *Host
- func (this *Wigo) GetOpenTsdb() *gopentsdb.OpenTsdb
- func (this *Wigo) GroupSummary(groupName string) (hs []*HostSummary, status int)
- func (this *Wigo) InitOrReloadLogger() (err error)
- func (this *Wigo) IsProbeDisabled(probeName string) bool
- func (this *Wigo) ListGroupsNames() []string
- func (this *Wigo) ListProbes() []string
- func (this *Wigo) ListRemoteWigosNames() []string
- func (this *Wigo) Lock()
- func (this *Wigo) RecomputeGlobalStatus()
- func (this *Wigo) SearchLogs(probe string, hostname string, group string, limit uint64, offset uint64) []*Log
- func (this *Wigo) SetParentHostsInProbes()
- func (this *Wigo) ToJsonString() (string, error)
- func (this *Wigo) Unlock()
- func (this *Wigo) Up()
Constants ¶
const ( ADDDIRECTORY = 1 REMOVEDIRECTORY = 2 NEWPROBERESULT = 3 DELETEPROBERESULT = 4 NEWREMOTERESULT = 5 NEWCONNECTION = 6 SENDRESULTS = 7 SENDNOTIFICATION = 8 )
const ( DEBUG = 1 NOTICE = 2 INFO = 3 ERROR = 4 WARNING = 5 CRITICAL = 6 EMERGENCY = 7 )
Log levels
Variables ¶
var Version = "##VERSION##"
Functions ¶
func CallbackHttp ¶
func InitChannels ¶
func InitChannels()
func IsStringInArray ¶
func ListProbesInDirectory ¶
List probes in directory
func NewConcurrentMapProbes ¶ added in v0.73.21
func NewConcurrentMapProbes() *concurrentMapProbes
func NewConcurrentMapWigos ¶ added in v0.73.21
func NewConcurrentMapWigos() *concurrentMapWigos
func SendNotification ¶
func SendNotification(notification INotification)
func StatusToString ¶
Types ¶
type Authority ¶
type Authority struct { Waiting map[string]string Allowed map[string]string Tokens map[string]string // contains filtered or unexported fields }
The Authority is responsible to handle the security of the push system. The server certificate is used to allow the clients to verify the server identity and the private key is used to sign the clients uuid to allow the server to verify the clients identities.
Allowed client are stored in an allowed list persisted on the file system, so one can easily revoke clients.
func NewAuthority ¶
func NewAuthority(config *PushServerConfig) (this *Authority)
func (*Authority) AddClientToWaitingList ¶
Add a client to the waiting list
func (*Authority) AllowClient ¶
Add a client to the allowed list. The client have to be in the waiting list. // TODO remove this limitation
func (*Authority) GetServerCertificate ¶
Return the server certificate
func (*Authority) GetToken ¶
Generate a token to use as a proof of identity for all subsequent requests
func (*Authority) GetUuidSignature ¶
func (this *Authority) GetUuidSignature(uuid string, hostname string) (uuidSignature []byte, err error)
Sign a client's uuid with the server's private key
func (*Authority) LoadAllowedList ¶
Load the allowed clients list from the file system The file format is one "uuid hostname" per line, every non matching line will be ignored
func (*Authority) RevokeClient ¶
Remove a client from the allowed list, revoke tokens if any and remove client data. TODO The dedup data in gopentsdb are leaked.
func (*Authority) RevokeToken ¶
Revoke a token
func (*Authority) SaveAllowedList ¶
Persist the allowed clients list on the file system The file format is one "uuid hostname" per line, every non matching line will be ignored
func (*Authority) VerifyToken ¶
Verify the validity of a token
type Chans ¶
type Chans struct { ChanWatch chan Event ChanChecks chan Event ChanCallbacks chan INotification ChanSignals chan os.Signal }
var Channels *Chans
type Config ¶
type Config struct { // General params Global *GeneralConfig // Http params Http *HttpConfig // PushServer params PushServer *PushServerConfig // PushClient params PushClient *PushClientConfig // Remmote wigos params RemoteWigos *RemoteWigoConfig AdvancedList []AdvancedRemoteWigoConfig // Noticications Notifications *NotificationConfig // OpenTSDB params OpenTSDB *OpenTSDBConfig }
type GeneralConfig ¶
type HelloRequest ¶
Hello request for the first request
func NewHelloRequest ¶
func NewHelloRequest(uuidSignature []byte) (this *HelloRequest)
type Host ¶
type Host struct { Name string Group string Status int Probes *concurrentMapProbes // contains filtered or unexported fields }
func (*Host) AddOrUpdateProbe ¶
func (this *Host) AddOrUpdateProbe(probe *ProbeResult)
func (*Host) DeleteProbeByName ¶
func (*Host) GetErrorsProbesList ¶
func (*Host) GetParentWigo ¶
func (*Host) GetSummary ¶
func (this *Host) GetSummary() (hs *HostSummary)
func (*Host) RecomputeStatus ¶
func (this *Host) RecomputeStatus()
func (*Host) SetParentWigo ¶
type HostSummary ¶
type HttpConfig ¶
type INotification ¶
type Log ¶
type Notification ¶
func NewNotificationFromMessage ¶
func NewNotificationFromMessage(message string) (this *Notification)
func (*Notification) GetMessage ¶
func (this *Notification) GetMessage() string
func (*Notification) GetSummary ¶
func (this *Notification) GetSummary() (s string)
type NotificationConfig ¶
type NotificationProbe ¶
type NotificationProbe struct { *Notification OldProbe *ProbeResult NewProbe *ProbeResult HostProbesInError []string }
func NewNotificationProbe ¶
func NewNotificationProbe(oldProbe *ProbeResult, newProbe *ProbeResult) (this *NotificationProbe)
func (*NotificationProbe) GetSummary ¶
func (this *NotificationProbe) GetSummary() (s string)
func (*NotificationProbe) ToJson ¶
func (this *NotificationProbe) ToJson() (ba []byte, e error)
type NotificationWigo ¶
type NotificationWigo struct { *Notification OldWigo *Wigo NewWigo *Wigo }
func (*NotificationWigo) GetSummary ¶
func (this *NotificationWigo) GetSummary() (s string)
func (*NotificationWigo) ToJson ¶
func (this *NotificationWigo) ToJson() (ba []byte, e error)
type OpenTSDBConfig ¶
type ProbeResult ¶
type ProbeResult struct { Name string Version string Value interface{} Message string ProbeDate string Timestamp int64 Metrics interface{} Detail interface{} Status int ExitCode int // contains filtered or unexported fields }
func NewProbeResult ¶
func NewProbeResultFromJson ¶
func NewProbeResultFromJson(name string, ba []byte) (this *ProbeResult)
func (*ProbeResult) GraphMetrics ¶
func (this *ProbeResult) GraphMetrics()
func (*ProbeResult) Summary ¶
func (this *ProbeResult) Summary() string
type PushClient ¶
type PushClient struct {
// contains filtered or unexported fields
}
Push client connect to the push server to update client's data over RPCs. Data is transferred using binary gob serialisation over tcp connection. Secure TLS connection is available and highly recommended.
If an error occurs during the push process the connection should
func NewPushClient ¶
func NewPushClient(config *PushClientConfig) (this *PushClient, err error)
func (*PushClient) CallWithTimeout ¶
func (this *PushClient) CallWithTimeout(serviceMethod string, args interface{}, reply interface{}, timeout time.Duration) error
func (*PushClient) GetServerCertificate ¶
func (this *PushClient) GetServerCertificate() (err error)
Download the server certificate from the server thus the client can ensure the server's identity. To avoid the small window of MITM vulnerability you might copy the certificate by yourself.
func (*PushClient) Goodbye ¶
func (this *PushClient) Goodbye() (err error)
Disconnect the client gracefully
func (*PushClient) Hello ¶
func (this *PushClient) Hello() (err error)
Hello is the first request of every connection. It sends the client's uuid and signature to the server as an identity proof. It returns a token that will be used to authenticate every subsequent requests at a lower cost.
func (*PushClient) SignUuid ¶
func (this *PushClient) SignUuid() (err error)
Ask the server to sign the client's uuid, this way the server is able to verify the client identity. The uuid signature is persisted on the file system.
func (*PushClient) Update ¶
func (this *PushClient) Update() (err error)
Send the local data to the server
type PushClientConfig ¶
type PushServer ¶
type PushServer struct {
// contains filtered or unexported fields
}
Push server expose method to update client's data over RPCs. Data is transferred using binary gob serialisation over tcp connection. Secure TLS connection is available and highly recommended.
func NewPushServer ¶
func NewPushServer(config *PushServerConfig) (this *PushServer)
func (*PushServer) GetServerCertificate ¶
func (this *PushServer) GetServerCertificate(req HelloRequest, cert *[]byte) (err error)
Send the server CA certificate to the client so it can verify the identity of the server. To avoid the small window of MITM vulnerability you might copy the certificate by yourself.
func (*PushServer) GetUuidSignature ¶
func (this *PushServer) GetUuidSignature(req HelloRequest, sig *[]byte) (err error)
Sign the client uuid with the server's private key. The client will have to provide this as a proof of his identity at every new connection.
func (*PushServer) Goodbye ¶
func (this *PushServer) Goodbye(req Request, reply *bool) (err error)
Disconnect the client gracefully
func (*PushServer) Hello ¶
func (this *PushServer) Hello(req HelloRequest, token *string) (err error)
Verify the validity of the client's uuid signature. This is done once for every connection then a token then a token is used.
func (*PushServer) Register ¶
func (this *PushServer) Register(req HelloRequest, reply *bool) (err error)
Register a new client. It will first be added to a waiting list, then an admin action will be required to grant the client to the allowed list. You may accept new clients automatically with the AutoAcceptClient setting.
func (*PushServer) Update ¶
func (this *PushServer) Update(req UpdateRequest, reply *bool) (err error)
Update a client's data
type PushServerConfig ¶
type RemoteWigoConfig ¶
type UpdateRequest ¶
Request the server to update the client's data
func NewUpdateRequest ¶
func NewUpdateRequest(wigo *Wigo, token string) (this *UpdateRequest)
type Wigo ¶
type Wigo struct { Uuid string Version string IsAlive bool GlobalStatus int GlobalMessage string LocalHost *Host RemoteWigos *concurrentMapWigos Hostname string LastUpdate int64 // contains filtered or unexported fields }
var LocalWigo *Wigo
Static global object
func GetLocalWigo ¶
func GetLocalWigo() *Wigo
func (*Wigo) AddOrUpdateRemoteWigo ¶
func (*Wigo) CompareTwoWigosAndRaiseNotifications ¶
func (*Wigo) Deduplicate ¶
func (*Wigo) DisableProbe ¶
func (*Wigo) EraseRemoteWigos ¶
func (*Wigo) FindRemoteWigoByHostname ¶
func (*Wigo) FindRemoteWigoByUuid ¶
func (*Wigo) GenerateRemoteWigosSummary ¶
func (*Wigo) GenerateSummary ¶
func (*Wigo) GetHostname ¶
func (*Wigo) GetOpenTsdb ¶
func (*Wigo) GroupSummary ¶
func (this *Wigo) GroupSummary(groupName string) (hs []*HostSummary, status int)
func (*Wigo) InitOrReloadLogger ¶
func (*Wigo) IsProbeDisabled ¶
func (*Wigo) ListGroupsNames ¶
func (*Wigo) ListProbes ¶
func (*Wigo) ListRemoteWigosNames ¶
func (*Wigo) SearchLogs ¶
func (*Wigo) SetParentHostsInProbes ¶
func (this *Wigo) SetParentHostsInProbes()