# Monitor Groups ## List Monitor Groups `client.LoadBalancers.MonitorGroups.List(ctx, query) (*SinglePage[MonitorGroup], error)` **get** `/accounts/{account_id}/load_balancers/monitor_groups` List configured monitor groups. ### Parameters - `query MonitorGroupListParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type MonitorGroup struct{…}` - `ID string` The ID of the Monitor Group to use for checking the health of origins within this pool. - `Description string` A short description of the monitor group - `Members []MonitorGroupMember` List of monitors in this group - `Enabled bool` Whether this monitor is enabled in the group - `MonitorID string` The ID of the Monitor to use for checking the health of origins within this pool. - `MonitoringOnly bool` Whether this monitor is used for monitoring only (does not affect pool health) - `MustBeHealthy bool` Whether this monitor must be healthy for the pool to be considered healthy - `CreatedAt Time` The timestamp of when the monitor was added to the group - `UpdatedAt Time` The timestamp of when the monitor group member was last updated - `CreatedAt Time` The timestamp of when the monitor group was created - `UpdatedAt Time` The timestamp of when the monitor group was last updated ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/load_balancers" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) page, err := client.LoadBalancers.MonitorGroups.List(context.TODO(), load_balancers.MonitorGroupListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": [ { "id": "id", "description": "Primary datacenter monitors", "members": [ { "enabled": true, "monitor_id": "monitor_id", "monitoring_only": false, "must_be_healthy": true, "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "success": true, "result_info": { "count": 20, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 100 } } ``` ## Monitor Group Details `client.LoadBalancers.MonitorGroups.Get(ctx, monitorGroupID, query) (*MonitorGroup, error)` **get** `/accounts/{account_id}/load_balancers/monitor_groups/{monitor_group_id}` Fetch a single configured monitor group. ### Parameters - `monitorGroupID string` - `query MonitorGroupGetParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type MonitorGroup struct{…}` - `ID string` The ID of the Monitor Group to use for checking the health of origins within this pool. - `Description string` A short description of the monitor group - `Members []MonitorGroupMember` List of monitors in this group - `Enabled bool` Whether this monitor is enabled in the group - `MonitorID string` The ID of the Monitor to use for checking the health of origins within this pool. - `MonitoringOnly bool` Whether this monitor is used for monitoring only (does not affect pool health) - `MustBeHealthy bool` Whether this monitor must be healthy for the pool to be considered healthy - `CreatedAt Time` The timestamp of when the monitor was added to the group - `UpdatedAt Time` The timestamp of when the monitor group member was last updated - `CreatedAt Time` The timestamp of when the monitor group was created - `UpdatedAt Time` The timestamp of when the monitor group was last updated ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/load_balancers" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) monitorGroup, err := client.LoadBalancers.MonitorGroups.Get( context.TODO(), "17b5962d775c646f3f9725cbc7a53df4", load_balancers.MonitorGroupGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", monitorGroup.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "id", "description": "Primary datacenter monitors", "members": [ { "enabled": true, "monitor_id": "monitor_id", "monitoring_only": false, "must_be_healthy": true, "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" }, "success": true } ``` ## Create Monitor Group `client.LoadBalancers.MonitorGroups.New(ctx, params) (*MonitorGroup, error)` **post** `/accounts/{account_id}/load_balancers/monitor_groups` Create a new monitor group. ### Parameters - `params MonitorGroupNewParams` - `AccountID param.Field[string]` Path param: Identifier. - `MonitorGroup param.Field[MonitorGroup]` Body param ### Returns - `type MonitorGroup struct{…}` - `ID string` The ID of the Monitor Group to use for checking the health of origins within this pool. - `Description string` A short description of the monitor group - `Members []MonitorGroupMember` List of monitors in this group - `Enabled bool` Whether this monitor is enabled in the group - `MonitorID string` The ID of the Monitor to use for checking the health of origins within this pool. - `MonitoringOnly bool` Whether this monitor is used for monitoring only (does not affect pool health) - `MustBeHealthy bool` Whether this monitor must be healthy for the pool to be considered healthy - `CreatedAt Time` The timestamp of when the monitor was added to the group - `UpdatedAt Time` The timestamp of when the monitor group member was last updated - `CreatedAt Time` The timestamp of when the monitor group was created - `UpdatedAt Time` The timestamp of when the monitor group was last updated ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/load_balancers" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) monitorGroup, err := client.LoadBalancers.MonitorGroups.New(context.TODO(), load_balancers.MonitorGroupNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), MonitorGroup: load_balancers.MonitorGroupParam{ ID: cloudflare.F("id"), Description: cloudflare.F("Primary datacenter monitors"), Members: cloudflare.F([]load_balancers.MonitorGroupMemberParam{load_balancers.MonitorGroupMemberParam{ Enabled: cloudflare.F(true), MonitorID: cloudflare.F("monitor_id"), MonitoringOnly: cloudflare.F(false), MustBeHealthy: cloudflare.F(true), }}), }, }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", monitorGroup.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "id", "description": "Primary datacenter monitors", "members": [ { "enabled": true, "monitor_id": "monitor_id", "monitoring_only": false, "must_be_healthy": true, "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" }, "success": true } ``` ## Update Monitor Group `client.LoadBalancers.MonitorGroups.Update(ctx, monitorGroupID, params) (*MonitorGroup, error)` **put** `/accounts/{account_id}/load_balancers/monitor_groups/{monitor_group_id}` Modify a configured monitor group. ### Parameters - `monitorGroupID string` - `params MonitorGroupUpdateParams` - `AccountID param.Field[string]` Path param: Identifier. - `MonitorGroup param.Field[MonitorGroup]` Body param ### Returns - `type MonitorGroup struct{…}` - `ID string` The ID of the Monitor Group to use for checking the health of origins within this pool. - `Description string` A short description of the monitor group - `Members []MonitorGroupMember` List of monitors in this group - `Enabled bool` Whether this monitor is enabled in the group - `MonitorID string` The ID of the Monitor to use for checking the health of origins within this pool. - `MonitoringOnly bool` Whether this monitor is used for monitoring only (does not affect pool health) - `MustBeHealthy bool` Whether this monitor must be healthy for the pool to be considered healthy - `CreatedAt Time` The timestamp of when the monitor was added to the group - `UpdatedAt Time` The timestamp of when the monitor group member was last updated - `CreatedAt Time` The timestamp of when the monitor group was created - `UpdatedAt Time` The timestamp of when the monitor group was last updated ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/load_balancers" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) monitorGroup, err := client.LoadBalancers.MonitorGroups.Update( context.TODO(), "17b5962d775c646f3f9725cbc7a53df4", load_balancers.MonitorGroupUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), MonitorGroup: load_balancers.MonitorGroupParam{ ID: cloudflare.F("id"), Description: cloudflare.F("Primary datacenter monitors"), Members: cloudflare.F([]load_balancers.MonitorGroupMemberParam{load_balancers.MonitorGroupMemberParam{ Enabled: cloudflare.F(true), MonitorID: cloudflare.F("monitor_id"), MonitoringOnly: cloudflare.F(false), MustBeHealthy: cloudflare.F(true), }}), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", monitorGroup.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "id", "description": "Primary datacenter monitors", "members": [ { "enabled": true, "monitor_id": "monitor_id", "monitoring_only": false, "must_be_healthy": true, "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" }, "success": true } ``` ## Patch Monitor Group `client.LoadBalancers.MonitorGroups.Edit(ctx, monitorGroupID, params) (*MonitorGroup, error)` **patch** `/accounts/{account_id}/load_balancers/monitor_groups/{monitor_group_id}` Apply changes to an existing monitor group, overwriting the supplied properties. ### Parameters - `monitorGroupID string` - `params MonitorGroupEditParams` - `AccountID param.Field[string]` Path param: Identifier. - `MonitorGroup param.Field[MonitorGroup]` Body param ### Returns - `type MonitorGroup struct{…}` - `ID string` The ID of the Monitor Group to use for checking the health of origins within this pool. - `Description string` A short description of the monitor group - `Members []MonitorGroupMember` List of monitors in this group - `Enabled bool` Whether this monitor is enabled in the group - `MonitorID string` The ID of the Monitor to use for checking the health of origins within this pool. - `MonitoringOnly bool` Whether this monitor is used for monitoring only (does not affect pool health) - `MustBeHealthy bool` Whether this monitor must be healthy for the pool to be considered healthy - `CreatedAt Time` The timestamp of when the monitor was added to the group - `UpdatedAt Time` The timestamp of when the monitor group member was last updated - `CreatedAt Time` The timestamp of when the monitor group was created - `UpdatedAt Time` The timestamp of when the monitor group was last updated ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/load_balancers" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) monitorGroup, err := client.LoadBalancers.MonitorGroups.Edit( context.TODO(), "17b5962d775c646f3f9725cbc7a53df4", load_balancers.MonitorGroupEditParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), MonitorGroup: load_balancers.MonitorGroupParam{ ID: cloudflare.F("id"), Description: cloudflare.F("Primary datacenter monitors"), Members: cloudflare.F([]load_balancers.MonitorGroupMemberParam{load_balancers.MonitorGroupMemberParam{ Enabled: cloudflare.F(true), MonitorID: cloudflare.F("monitor_id"), MonitoringOnly: cloudflare.F(false), MustBeHealthy: cloudflare.F(true), }}), }, }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", monitorGroup.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "id", "description": "Primary datacenter monitors", "members": [ { "enabled": true, "monitor_id": "monitor_id", "monitoring_only": false, "must_be_healthy": true, "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" }, "success": true } ``` ## Delete Monitor Group `client.LoadBalancers.MonitorGroups.Delete(ctx, monitorGroupID, body) (*MonitorGroup, error)` **delete** `/accounts/{account_id}/load_balancers/monitor_groups/{monitor_group_id}` Delete a configured monitor group. ### Parameters - `monitorGroupID string` - `body MonitorGroupDeleteParams` - `AccountID param.Field[string]` Identifier. ### Returns - `type MonitorGroup struct{…}` - `ID string` The ID of the Monitor Group to use for checking the health of origins within this pool. - `Description string` A short description of the monitor group - `Members []MonitorGroupMember` List of monitors in this group - `Enabled bool` Whether this monitor is enabled in the group - `MonitorID string` The ID of the Monitor to use for checking the health of origins within this pool. - `MonitoringOnly bool` Whether this monitor is used for monitoring only (does not affect pool health) - `MustBeHealthy bool` Whether this monitor must be healthy for the pool to be considered healthy - `CreatedAt Time` The timestamp of when the monitor was added to the group - `UpdatedAt Time` The timestamp of when the monitor group member was last updated - `CreatedAt Time` The timestamp of when the monitor group was created - `UpdatedAt Time` The timestamp of when the monitor group was last updated ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/load_balancers" "github.com/cloudflare/cloudflare-go/option" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) monitorGroup, err := client.LoadBalancers.MonitorGroups.Delete( context.TODO(), "17b5962d775c646f3f9725cbc7a53df4", load_balancers.MonitorGroupDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", monitorGroup.ID) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "result": { "id": "id", "description": "Primary datacenter monitors", "members": [ { "enabled": true, "monitor_id": "monitor_id", "monitoring_only": false, "must_be_healthy": true, "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" } ], "created_at": "2014-01-01T05:20:00.12345Z", "updated_at": "2014-01-01T05:20:00.12345Z" }, "success": true } ``` ## Domain Types ### Monitor Group - `type MonitorGroup struct{…}` - `ID string` The ID of the Monitor Group to use for checking the health of origins within this pool. - `Description string` A short description of the monitor group - `Members []MonitorGroupMember` List of monitors in this group - `Enabled bool` Whether this monitor is enabled in the group - `MonitorID string` The ID of the Monitor to use for checking the health of origins within this pool. - `MonitoringOnly bool` Whether this monitor is used for monitoring only (does not affect pool health) - `MustBeHealthy bool` Whether this monitor must be healthy for the pool to be considered healthy - `CreatedAt Time` The timestamp of when the monitor was added to the group - `UpdatedAt Time` The timestamp of when the monitor group member was last updated - `CreatedAt Time` The timestamp of when the monitor group was created - `UpdatedAt Time` The timestamp of when the monitor group was last updated