Welcome to the HyperFORGE

The HyperFORGE was created to facilitate collaboration on plugins and documentation for they Hyperic Community.

Become a HyperFORGE member →

Recent Activity

Skip to end of metadata
Go to start of metadata

Description

This script allows you to create a new HTTP service check for every platform within a group called "All Platforms". Each new check will be an HTTP service, setup to ping the HTTP socket on that platform.

Works With

HQ 3.2.2 or higher

Running

Simply paste this script into the Groovy Console, change the port, path, and any other configuration you like (such as the group's name), and press execute.

Configuration

The best way to see what the valid configuration options are, is to create an HTTP service yourself and look at its properties.

  • Navigate to any Platform
  • Tools -> New Platform Service -> HTTP -> Configuration Properties

Snippet

import org.hyperic.hq.hqu.rendit.util.HQUtil
import org.hyperic.hq.hqu.rendit.helpers.ResourceHelper

def resourceTypeName = 'HTTP'
def groupName = 'All Platforms'

def overlord     = HQUtil.getOverlord()
def rhelp        = new ResourceHelper(overlord)
def resourceType = rhelp.findResourcePrototype(resourceTypeName)
def group        = rhelp.findViewableGroups().find { it.name == groupName }

if (resourceType == null) {
    return "Resource type ${resourceTypeName} not found"
} else if(group == null) {
    return "Group ${groupName} not found"
}


def created = []
group.getResources().each { platform ->
    def newName = "${platform.name} HTTP 7080"
    // Don't create resources if they already exist
    if (platform.getChildrenByPrototype(resourceType).find { it.name == newName})
        return

    def newService = resourceType.createInstance(platform,  newName, overlord, 
                                                 [hostname  : platform.config.fqdn.value,
                                                  port      : '7080',
                                                  sotimeout : '5',    /* socket timeout (sec) */
                                                  path      : '/'])
    created << newService
}

"Created ${created.name}"

Related Files

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.