- for node in nodes:
- hn = node['hostname']
- if len(node['interface_ids']) == 0:
- continue
-
- ip = netid2ip[str(node['interface_ids'][0])]['ip']
-
- if lon_x is not -1 and lat_y is not -1:
- coords="%s,%s" % (lon_x, lat_y)
- else:
- coords="0,0"
-
- h = Host(use="planetlab-host",
- host_name=hn,
- alias=hn,
- address=ip,
- d2_coords=coords,
- statusmap_image="icon-system.png",
- hostgroups=lb)
-
- print h.toString()
-
- s1 = Service(use="generic-service",
- host_name=hn,
- service_description="aSSH",
- display_name="aSSH",
- servicegroups="NET,SSH",
- check_command="check_ssh!-t 120")
- s2 = Service(use="generic-service",
- host_name=hn,
- service_description="bSSH806",
- display_name="bSSH806",
- servicegroups="NET,SSH806",
- check_command="check_ssh!-p 806 -t 120")
- s3 = Service(use="generic-service",
- host_name=hn,
- service_description="cHTTP",
- display_name="cHTTP",
- servicegroups="NET,HTTP",
- check_command="check_http!-t 120")
- s4 = Service(use="generic-service",
- host_name=hn,
- service_description="dCOTOP",
- display_name="dCOTOP",
- servicegroups="NET,COTOP",
- check_command="check_http!-p 3120 -t 120")
-
- se1 = ServiceEscalation( host_name=hn,
- service_description='aSSH',
- first_notification=0,
- last_notification=2,
- notification_interval=24*60*3.5,
- escalation_options="r,c",
- contact_groups="%s-techs" % lb)
-
- se2 = ServiceEscalation( host_name=hn,
- service_description='aSSH',
- first_notification=2,
- last_notification=4,
- notification_interval=24*60*3.5,
- escalation_options="r,c",
- contact_groups="%s-techs,%s-pis" % (lb,lb))
-
- se3 = ServiceEscalation( host_name=hn,
- service_description='aSSH',
- first_notification=4,
- last_notification=0,
- notification_interval=24*60*3.5,
- escalation_options="r,c",
- contact_groups="%s-techs,%s-pis,%s-sliceusers" % (lb,lb,lb))
-
- sd1 = ServiceDependency(host_name=hn,
- service_description="aSSH",
- dependent_host_name=hn,
- dependent_service_description="bSSH806",
- execution_failure_criteria="w,u,c,p",)
-
- sd2 = ServiceDependency(host_name=hn,
- service_description="aSSH",
- dependent_host_name=hn,
- dependent_service_description="cHTTP",
- execution_failure_criteria="w,u,c,p",)
-
- sd3 = ServiceDependency(host_name=hn,
- service_description="aSSH",
- dependent_host_name=hn,
- dependent_service_description="dCOTOP",
- execution_failure_criteria="w,u,c,p",)
-
- for service in [s1,s2,s3,s4,se1,se2,se3,sd1,sd2,sd3]:
- print service.toString()
-