Search in sources :

Example 6 with RequisitionMonitoredService

use of org.opennms.netmgt.provision.persist.requisition.RequisitionMonitoredService in project opennms by OpenNMS.

the class RequisitionBuilder method withContainer.

public RequisitionBuilder withContainer(final ContainerAlias alias, final String... services) {
    // We're assuming that the Minion container is on the same
    // host as the service containers
    final ContainerInfo containerInfo = minionSystem.getContainerInfo(alias);
    final String containerIpAddr = containerInfo.networkSettings().ipAddress();
    RequisitionNode node = new RequisitionNode();
    node.setNodeLabel(alias.toString());
    node.setForeignId(alias.toString());
    RequisitionInterface iface = new RequisitionInterface();
    iface.setSnmpPrimary(PrimaryType.PRIMARY);
    iface.setIpAddr(containerIpAddr);
    for (String svcName : services) {
        RequisitionMonitoredService svc = new RequisitionMonitoredService();
        svc.setServiceName(svcName);
        iface.putMonitoredService(svc);
    }
    node.putInterface(iface);
    requisition.putNode(node);
    return this;
}
Also used : RequisitionNode(org.opennms.netmgt.provision.persist.requisition.RequisitionNode) RequisitionInterface(org.opennms.netmgt.provision.persist.requisition.RequisitionInterface) ContainerInfo(com.spotify.docker.client.messages.ContainerInfo) RequisitionMonitoredService(org.opennms.netmgt.provision.persist.requisition.RequisitionMonitoredService)

Aggregations

RequisitionInterface (org.opennms.netmgt.provision.persist.requisition.RequisitionInterface)6 RequisitionMonitoredService (org.opennms.netmgt.provision.persist.requisition.RequisitionMonitoredService)6 RequisitionNode (org.opennms.netmgt.provision.persist.requisition.RequisitionNode)6 Requisition (org.opennms.netmgt.provision.persist.requisition.Requisition)3 RequisitionCategory (org.opennms.netmgt.provision.persist.requisition.RequisitionCategory)3 InetAddress (java.net.InetAddress)2 RequisitionAsset (org.opennms.netmgt.provision.persist.requisition.RequisitionAsset)2 ContainerInfo (com.spotify.docker.client.messages.ContainerInfo)1 HostRuntimeInfo (com.vmware.vim25.HostRuntimeInfo)1 HostSystemPowerState (com.vmware.vim25.HostSystemPowerState)1 VirtualMachinePowerState (com.vmware.vim25.VirtualMachinePowerState)1 VirtualMachineRuntimeInfo (com.vmware.vim25.VirtualMachineRuntimeInfo)1 Datastore (com.vmware.vim25.mo.Datastore)1 DistributedVirtualPortgroup (com.vmware.vim25.mo.DistributedVirtualPortgroup)1 HostSystem (com.vmware.vim25.mo.HostSystem)1 ManagedEntity (com.vmware.vim25.mo.ManagedEntity)1 Network (com.vmware.vim25.mo.Network)1 VirtualMachine (com.vmware.vim25.mo.VirtualMachine)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 UnknownHostException (java.net.UnknownHostException)1