C.1 Installing the ZENworks Orchestrator Agent on an Apache Virtual Machine

This job is designed to help you to install the Orchestrator Agent on all VMs running Apache. You can cut and paste this job into your Orchestrator Console or you can use this job as a template from which to make new jobs.

"""

Search for a VM Grid objects using Constraints and
run a VM operation on them.

"""

class test(Job):

     def job_started_event(self):

        # collect all VM Instances whose resource ID
        # starts with the string "apache"

        a = AndConstraint()

        e1 = EqConstraint()
        e1.setFact("resource.type")
        e1.setValue("VM")
        a.add(e1)

        e2 = EqConstraint()
        e2.setValue("apache*")
        e2.setMatchMode(EqConstraint.MATCH_MODE_REGEXP)
        e2.setFact("resource.id")
        a.add(e2)

        vms = getMatrix().getGridObjects(TYPE_RESOURCE,a,None)
        for vm in vms:
            vm.installAgent()