November 23, 2017


Delete network monitoring

The script makes a single call to SoftLayer_Network_Monitor_Version1_Query_Host::deleteObject
method to delete the network monitoring for more information see below

Important manual pages:

Author: SoftLayer Technologies, Inc. <>
package main

import (

func main() {
	// SoftLayer API username and key
	username := "set me"
	apikey   := "set me"

	// The id of virtual server you want to delete a monitor
	guestId  := 32834621

	// Create a session
	sess := session.New(username, apikey)

	// Get SoftLayer_Virtual_Guest and SoftLayer_Network_Monitor_Version1_Query_Host services
	virtualService := services.GetVirtualGuestService(sess)
	monitorService := services.GetNetworkMonitorVersion1QueryHostService(sess)

	// Declare filter that will be used to retrieve specific monitoring objects
	filter := filter.Path("").Eq("SLOW PING").Build()

	// Get all Network Monitors according to filter
	monitoringItems, err := virtualService.Id(guestId).Filter(filter).GetNetworkMonitors()
	if err != nil {
		fmt.Printf("\n Unable to get network monitors:\n - %s\n", err)

	// Delete all monitors with type "SLOW PING"
	for _, monitor := range monitoringItems{
		monitorService, err := monitorService.Id(*monitor.Id).DeleteObject()
		if err != nil {
			fmt.Printf("\n Unable to delete network monitor:\n - %s\n", err)


If this article contains any error, or leaves any of your questions unanswered, please help us out by opening up a github issue.
Open an issue