WAS THIS PAGE HELPFUL? Leave Feedback
1.0 APPENDIX A Curl Examples
These examples require that you have populated a Collage database with the attached script for Postgres and that Postgres is already installed.
SQL database to be restored: Tar-ball of database backup
Restore script: restore.sh
The curl examples assume that you are running JBoss with Apache on port 80, and the Collage Restful Services are deployed to a web application with the context name of 'foundation-webapp'
Appendix A: Contents
- 1.1 Host Examples with Curl
- 1.2 Host Group Examples with Curl
- 1.3 Services Examples with Curl
- 1.4 Events Examples with Curl
- 1.5 Devices Examples with Curl
- 1.6 Statistics Examples with Curl
- 1.7 Category Examples with Curl
- 1.8 Metadata Examples with Curl
- 1.9 Property Type Examples with Curl
- 1.10 Application Type Examples with Curl
- 1.11 Entity Type Examples with Curl
- 1.12 Consolidation Examples with Curl
- 1.13 Notification Examples with Curl
- 1.14 Perf Data Examples with Curl
- 1.15 Audit Log Examples with Curl
- 1.16 Host Identity Examples with Curl
- 1.17 Host Blacklist Examples with Curl
- 1.18 Biz Downtime Examples with Curl
- 1.19 Device Template Profile Examples with Curl
- 1.20 Custom Group Examples with Curl
- 1.21 Service Group Examples with Curl
- 1.22 Biz Service Authorization Examples with Curl
- 1.23 Suggestions Examples with Curl
- 1.24 License Check Examples with Curl
- 1.25 Biz Feeder Examples with Curl
1.1 Host Examples with Curl
1.1.1 Retrieve a Single Host
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/hosts/localhost
1.1.2 Retrieve Hosts by Query with Depth Simple (encoded)
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/api/hosts?query=property.ExecutionTime+between+5+and+3500&depth=simple"
1.1.3 Store Two Hosts
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postHost.xml -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/hosts
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postHost.json -H "Accept: application/json" --header "Content-Type: application/json" http://localhost/api/hosts
1.1.4 Delete Hosts
- delete a single host
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/hosts/localhost - delete 2 hosts
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/hosts/localhost,malbec
1.1.5 Host Autocomplete Using JSON
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/hosts/autocomplete/localhost
JSON Results:
{ "names" : [ "localhost", "localhost2" ] }
1.2 Host Group Examples with Curl
1.2.1 Retrieve a Single Host Group
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/hostgroups/Support
1.2.2 Retrieve Host Groups Depth Deep (encoded)
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/api/hostgroups?depth=deep&query=hosts.hostName+%3D+%27localhost%27"
1.2.3 Store Host Group
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postHostGroup.xml -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/hostgroups
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postHost.json -H "Accept: application/json" --header "Content-Type: application/json" http://localhost/api/hostgroups
1.2.4 Delete Host Groups
- delete a single host group
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/hostgroups/Support - delete 2 host group
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/hostgroups/Support,HG1
1.2.5 Host Group Autocomplete Using XML
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" http://localhost/api/hostgroups/autocomplete/hg
XML Results:
<names> <name>HG1</name> <name>HG2</name> </names>
1.3 Services Examples with Curl
1.3.1 Retrieve A Single Service
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/services/service-109?hostName=localhost
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/services/service-109?hostName=localhost
1.3.2 Retrieve Services by Query (encoded)
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/api/services?query=%28property.ExecutionTime+%3E+1000+and+monitorStatus%21%3D+%27UP%27%29"
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/api/services?query=%28property.ExecutionTime+%3E+1000+and+monitorStatus%21%3D+%27UP%27%29"
1.3.3 Store Services
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postService.json -H "Accept: application/json" --header "Content-Type: application/json" http://localhost/api/services
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postService.xml -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/services
1.3.4 Delete Service
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/services/service-109,service-110?hostName=localhost
1.3.5 Service Autocomplete Using JSON
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/services/autocomplete/local_cpu
JSON Results:
{ "names" : [ "local_cpu_httpd", "local_cpu_java" ] }
1.4 Events Examples with Curl
1.4.1 Retrieve Events by Event Id List
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/events/4,5
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" http://localhost/api/events/4,5
1.4.2 Retrieve Events by Query (encoded)
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/api/events?query=category+%3D+%27SG1%27"
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/api/events?query=device+%3D+%27172.28.113.156%27+and+severity+%3D+%27CRITICAL%27"
1.4.3 Store Events
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postEvent.xml -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/events
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postEvent.json -H "Accept: application/json" --header "Content-Type: application/json" http://localhost/api/events
1.4.4 Update Event
curl -X PUT -d@./putEvents.xml -H "GWOS-API-TOKEN:9E72B5E688429F6A867602E6D047E09D" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/events
1.4.5 Update Event Op Status
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X PUT -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/events/50,51,52?opStatus=NOTIFIED
1.4.6 Delete Events
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/events/50,51
1.5 Devices Examples with Curl
1.5.1 Retrieve A Single Device
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/devices/127.0.0.1
- with depth = deep
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" http://localhost/api/devices/127.0.0.1?depth=deep
1.5.2 Retrieve Devices by Query (encoded)
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" http://localhost/api/devices?query=identification+like+%27172.28.113%25%27
1.5.3 Store Devices
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postDevice.xml -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/devices
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postDevice.json -H "Accept: application/json" --header "Content-Type: application/json" http://localhost/api/devices
1.5.4 Delete Devices
- delete a single device
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/devices/127.0.0.1 - delete 2 devices
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/devices/127.0.0.1,172.28.128.100
1.6 Statistics Examples with Curl
1.6.1 Retrieve Total Statistics
- query for total statistics by hosts
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/totals/hosts - query for total statistics by services
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/services
1.6.2 Retrieve Host Statistics
- query for statistics for the two given host names
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/hosts/demo,malbec
1.6.3 Retrieve Host Group Statistics
- query all host group statistics group by host group
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/hostgroups - query host group statistics filtered by one or more host groups names comma separated,
group by host group
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/hostgroups/Linux+Servers,Engineering
1.6.4 Retrieve Service Statistics
- query all service statistics group by host group
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/services - query service statistics filtered by one or more host names comma separated, group by hosts
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/services/hosts/localhost,support-xp-1 - query service statistics filtered by one or more host group names comma separated,
group by host groups
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/services/hostgroups/Linux+Servers,Engineering - query all service statistics group by service group
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/services/servicegroups - query service statistics filtered by one or more service group names comma separated,
group by service groups
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/services/servicegroups/SG1,web-svr - query host availability by a single host group name
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/availability/hosts?hostGroup=HG1 - query service availability by a single host group name
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/availability/services?hostGroup=HG1 - query service availability by a single service group name
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H “Accept: application/xml” http://localhost/api/statistics/availability/services?serviceGroup=SG1
1.7 Category Examples with Curl
1.7.1 Retrieve A Single Category
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories/TEST-2/SERVICE_GROUP"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories/TEST-2/SERVICE_GROUP?depth=full"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories/TEST-2/SERVICE_GROUP"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories/TEST-2/SERVICE_GROUP?depth=full"
Results:
{ "id" : 63, "name" : "TEST-2", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true }
{ "id" : 63, "name" : "TEST-2", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true, "applicationType" : { "properties" : { } }, "entityType" : { "id" : 23, "name" : "SERVICE_GROUP", "description" : "com.groundwork.collage.model.impl.ServiceGroup", "applicationTypeSupported" : false, "logicalEntity" : true }, "children" : [ { "id" : 65, "name" : "TEST-B", "entityTypeName" : "SERVICE_GROUP", "parentNames" : [ "TEST-2", "TEST-A" ], "root" : false, "applicationType" : { "properties" : { } }, "entityType" : { "id" : 23, "name" : "SERVICE_GROUP", "description" : "com.groundwork.collage.model.impl.ServiceGroup", "applicationTypeSupported" : false, "logicalEntity" : true }, "parents" : [ { "id" : 63, "name" : "TEST-2", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true }, { "id" : 64, "name" : "TEST-A", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true } ], "entities" : [ { "id" : 31, "objectID" : 1024, "entityTypeId" : 2, "entityTypeName" : "SERVICE_STATUS" } ] } ] }
<category id="67" name="TEST-2" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category>
<category id="67" name="TEST-2" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> <applicationType/> <entityType id="23" name="SERVICE_GROUP" description="com.groundwork.collage.model.impl.ServiceGroup" isLogicalEntity="true" applicationTypeSupported="false"/> <children> <category id="69" name="TEST-B" entityTypeName="SERVICE_GROUP" root="false"> <parentNames> <parentName>TEST-A</parentName> <parentName>TEST-2</parentName> </parentNames> <applicationType/> <entityType id="23" name="SERVICE_GROUP" description="com.groundwork.collage.model.impl.ServiceGroup" isLogicalEntity="true" applicationTypeSupported="false"/> <parents> <category id="68" name="TEST-A" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category> <category id="67" name="TEST-2" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category> </parents> <entities> <entity id="32" objectID="1024" entityTypeId="2" entityTypeName="SERVICE_STATUS"/> </entities> </category> </children> </category>
1.7.2 Retrieve All Categories
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories?entityTypeName=SERVICE_GROUP"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories?entityTypeName=SERVICE_GROUP"
Results:
{ "categories" : [ { "id" : 62, "name" : "TEST-1", "entityTypeName" : "SERVICE_GROUP", "root" : true }, { "id" : 63, "name" : "TEST-2", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true }, { "id" : 64, "name" : "TEST-A", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true }, { "id" : 65, "name" : "TEST-B", "entityTypeName" : "SERVICE_GROUP", "parentNames" : [ "TEST-A", "TEST-2" ], "root" : false } ] }
<categories> <category id="66" name="TEST-1" entityTypeName="SERVICE_GROUP" root="true"/> <category id="67" name="TEST-2" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category> <category id="68" name="TEST-A" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category> <category id="69" name="TEST-B" entityTypeName="SERVICE_GROUP" root="false"> <parentNames> <parentName>TEST-2</parentName> <parentName>TEST-A</parentName> </parentNames> </category> </categories>
1.7.3 Retrieve Root Categories
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories?entityTypeName=SERVICE_GROUP&roots=true"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories?entityTypeName=SERVICE_GROUP&roots=true"
Results:
{ "categories" : [ { "id" : 62, "name" : "TEST-1", "entityTypeName" : "SERVICE_GROUP", "root" : true }, { "id" : 63, "name" : "TEST-2", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true }, { "id" : 64, "name" : "TEST-A", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true } ] }
<categories> <category id="66" name="TEST-1" entityTypeName="SERVICE_GROUP" root="true"/> <category id="67" name="TEST-2" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category> <category id="68" name="TEST-A" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category> </categories>
1.7.4 Retrieve Hierarchy Categories
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories?name=TEST-A&entityTypeName=SERVICE_GROUP"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories?name=TEST-A&entityTypeName=SERVICE_GROUP"
Results:
{ "categories" : [ { "id" : 64, "name" : "TEST-A", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true }, { "id" : 65, "name" : "TEST-B", "entityTypeName" : "SERVICE_GROUP", "parentNames" : [ "TEST-A", "TEST-2" ], "root" : false } ] }
<categories> <category id="68" name="TEST-A" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category> <category id="69" name="TEST-B" entityTypeName="SERVICE_GROUP" root="false"> <parentNames> <parentName>TEST-A</parentName> <parentName>TEST-2</parentName> </parentNames> </category> </categories>
1.7.5 Retrieve Entity Root Categories
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories?entityTypeName=SERVICE_GROUP&entityObjectId=1024&entityEntityTypeName=SERVICE_STATUS&entityRoots=true"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories?entityTypeName=SERVICE_GROUP&entityObjectId=1024&entityEntityTypeName=SERVICE_STATUS&entityRoots=true"
Results:
{ "categories" : [ { "id" : 63, "name" : "TEST-2", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true }, { "id" : 64, "name" : "TEST-A", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true } ] }
<categories> <category id="67" name="TEST-2" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category> <category id="68" name="TEST-A" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category> </categories>
1.7.6 Retrieve Categories by Query (encoded)
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories?query=entityType.name%20%3D%20'SERVICE_GROUP'%20and%20name%20like%20'TEST-%25'%20ORDER%20BY%20name%20ASC&first=0&count=2"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories?query=entityType.name%20%3D%20'SERVICE_GROUP'%20and%20name%20like%20'TEST-%25'%20ORDER%20BY%20name%20ASC&first=0&count=2"
Results:
{ "categories" : [ { "id" : 62, "name" : "TEST-1", "entityTypeName" : "SERVICE_GROUP", "root" : true }, { "id" : 63, "name" : "TEST-2", "entityTypeName" : "SERVICE_GROUP", "childNames" : [ "TEST-B" ], "root" : true } ] }
<categories> <category id="66" name="TEST-1" entityTypeName="SERVICE_GROUP" root="true"/> <category id="67" name="TEST-2" entityTypeName="SERVICE_GROUP" root="true"> <childNames> <childName>TEST-B</childName> </childNames> </category> </categories>
1.7.7 Store Categories
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"categories": [{"name" : "TEST-1", "entityTypeName" : "SERVICE_GROUP"}, {"name" : "TEST-2", "entityTypeName" : "SERVICE_GROUP"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"categories": [{"name" : "TEST-B", "entityTypeName" : "SERVICE_GROUP", "entities" : [{"objectID" : 1024, "entityTypeName" : "SERVICE_STATUS"}]}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<categories><category name="TEST-1" entityTypeName="SERVICE_GROUP"></category><category name="TEST-2" entityTypeName="SERVICE_GROUP"></category></categories>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<categories><category name="TEST-B" entityTypeName="SERVICE_GROUP"><entities><entity objectID="1024" entityTypeName="SERVICE_STATUS"/></entities></category></categories>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories"
Results:
{ "successful" : 2, "failed" : 0, "entityType" : "Category", "operation" : "Update", "warning" : 0, "count" : 2, "results" : [ { "entity" : "TEST-1:SERVICE_GROUP", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/categories/TEST-1/SERVICE_GROUP" }, { "entity" : "TEST-2:SERVICE_GROUP", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/categories/TEST-2/SERVICE_GROUP" } ] }
{ "successful" : 1, "failed" : 0, "entityType" : "Category", "operation" : "Update", "warning" : 0, "count" : 1, "results" : [ { "entity" : "TEST-B:SERVICE_GROUP", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/categories/TEST-B/SERVICE_GROUP" } ] }
<results successful="2" failed="0" entityType="Category" operation="Update" warning="0" count="2"> <result> <entity>TEST-1:SERVICE_GROUP</entity> <location>http://localhost:8080/foundation-webapp/api/categories/TEST-1/SERVICE_GROUP</location> <status>success</status> </result> <result> <entity>TEST-2:SERVICE_GROUP</entity> <location>http://localhost:8080/foundation-webapp/api/categories/TEST-2/SERVICE_GROUP</location> <status>success</status> </result> </results>
<results successful="1" failed="0" entityType="Category" operation="Update" warning="0" count="1"> <result> <entity>TEST-B:SERVICE_GROUP</entity> <location>http://localhost:8080/foundation-webapp/api/categories/TEST-B/SERVICE_GROUP</location> <status>success</status> </result> </results>
1.7.8 Modify Hierarchical Categories
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '{"categoryUpdates": [{"entityTypeName" : "SERVICE_GROUP", "categoryName" : "TEST-A", "create" : "AS_ROOT"}, {"entityTypeName" : "SERVICE_GROUP", "categoryName" : "TEST-B", "create" : "AS_CHILD", "parentName" : "TEST-A"}, {"entityTypeName" : "SERVICE_GROUP", "categoryName" : "TEST-B", "modify" : "ADD_CHILD", "otherCategoryNames" : [ "TEST-2" ]}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '{"categoryUpdates": [{"entityTypeName" : "SERVICE_GROUP", "categoryName" : "TEST-A", "delete" : "CASCADE"}, {"entityTypeName" : "SERVICE_GROUP", "categoryName" : "TEST-2", "delete" : "CASCADE_ALL"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '<categoryUpdates><categoryUpdate entityTypeName="SERVICE_GROUP" categoryName="TEST-A" create="AS_ROOT"/><categoryUpdate entityTypeName="SERVICE_GROUP" categoryName="TEST-B" create="AS_CHILD" parentName="TEST-A"/><categoryUpdate entityTypeName="SERVICE_GROUP" categoryName="TEST-B" modify="ADD_CHILD"><otherCategoryNames><categoryName>TEST-2</categoryName></otherCategoryNames></categoryUpdate></categoryUpdates>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '<categoryUpdates><categoryUpdate entityTypeName="SERVICE_GROUP" categoryName="TEST-A" delete="CASCADE"/><categoryUpdate entityTypeName="SERVICE_GROUP" categoryName="TEST-2" delete="CASCADE_ALL"/></categoryUpdates>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories"
Results:
{ "successful" : 3, "failed" : 0, "entityType" : "Category", "operation" : "Update", "warning" : 0, "count" : 3, "results" : [ { "entity" : "TEST-A:SERVICE_GROUP", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/categories/TEST-A/SERVICE_GROUP" }, { "entity" : "TEST-B:SERVICE_GROUP", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/categories/TEST-B/SERVICE_GROUP" }, { "entity" : "TEST-B:SERVICE_GROUP", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/categories/TEST-B/SERVICE_GROUP" } ] }
{ "successful" : 2, "failed" : 0, "entityType" : "Category", "operation" : "Update", "warning" : 0, "count" : 2, "results" : [ { "entity" : "TEST-A:SERVICE_GROUP", "status" : "success", "message" : "Category deleted, (CASCADE)." }, { "entity" : "TEST-2:SERVICE_GROUP", "status" : "success", "message" : "Category deleted, (CASCADE_ALL)." } ] }
<results successful="3" failed="0" entityType="Category" operation="Update" warning="0" count="3"> <result> <entity>TEST-A:SERVICE_GROUP</entity> <location>http://localhost:8080/foundation-webapp/api/categories/TEST-A/SERVICE_GROUP</location> <status>success</status> </result> <result> <entity>TEST-B:SERVICE_GROUP</entity> <location>http://localhost:8080/foundation-webapp/api/categories/TEST-B/SERVICE_GROUP</location> <status>success</status> </result> <result> <entity>TEST-B:SERVICE_GROUP</entity> <location>http://localhost:8080/foundation-webapp/api/categories/TEST-B/SERVICE_GROUP</location> <status>success</status> </result> </results>
<results successful="2" failed="0" entityType="Category" operation="Update" warning="0" count="2"> <result> <entity>TEST-A:SERVICE_GROUP</entity> <message>Category deleted, (CASCADE).</message> <status>success</status> </result> <result> <entity>TEST-2:SERVICE_GROUP</entity> <message>Category deleted, (CASCADE_ALL).</message> <status>success</status> </result> </results>
1.7.9 Add/Delete Category Members
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '{"name" : "TEST-B", "entityTypeName" : "SERVICE_GROUP", "entities" : [{"objectID" : 2048, "entityTypeName" : "SERVICE_STATUS"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories/addmembers"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '<category name="TEST-B" entityTypeName="SERVICE_GROUP"><entities><entity objectID="2048" entityTypeName="SERVICE_STATUS"/></entities></category>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories/deletemembers"
Results:
{ "successful" : 1, "failed" : 0, "entityType" : "Category", "operation" : "Update", "warning" : 0, "results" : [ { "entity" : "TEST-B:SERVICE_GROUP", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/categories/TEST-B/SERVICE_GROUP" } ], "count" : 1 }
<results successful="1" failed="0" entityType="Category" operation="Update" warning="0" count="1"> <result> <entity>TEST-B:SERVICE_GROUP</entity> <location>http://localhost:8080/foundation-webapp/api/categories/TEST-B/SERVICE_GROUP</location> <status>success</status> </result> </results>
1.7.10 Delete Categories
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X DELETE -d '{"categories": [{"name" : "TEST-1", "entityTypeName" : "SERVICE_GROUP"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/categories"
curl -s -H "GWOS-API-TOKEN:2d4c9e96-981e-4dcf-ac98-1a6871e17a80" -H "GWOS-APP-NAME:cloudhub" -X DELETE -d '<categories><category name="TEST-1" entityTypeName="SERVICE_GROUP"></category></categories>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/categories"
Results:
{ "successful" : 1, "failed" : 0, "entityType" : "Category", "operation" : "Delete", "warning" : 0, "count" : 1, "results" : [ { "entity" : "TEST-1:SERVICE_GROUP", "status" : "success", "message" : "Category deleted." } ] }
<results successful="1" failed="0" entityType="Category" operation="Delete" warning="0" count="1"> <result> <entity>TEST-1:SERVICE_GROUP</entity> <message>Category deleted.</message> <status>success</status> </result> </results>
1.8 Metadata Examples with Curl
1.8.1 Retrieve WADL file
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" http://localhost/api/meta/wadl
Results: XML (WADL)
1.8.2 Retrieve XSD file
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" http://localhost/api/meta/xsd
Results: XSD
1.9 Property Type Examples with Curl
1.9.1 Retrieve A Single Property Type
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/propertytypes/ExecutionTime
1.9.2 Retrieve Property Type by Query (encoded)
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/api/propertytypes?query=name+like+%27SYS%25%27"
1.9.3 Store Property Types
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postPropertyType.json -H "Accept: application/json" --header "Content-Type: application/json" http://localhost/api/propertytypes
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postPropertyType.xml -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/propertytypes
1.9.4 Delete Property Type
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/propertytypes/name
1.10 Application Type Examples with Curl
1.10.1 Retrieve A Single Application Type
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/applicationtypes/NAGIOS
1.10.2 Retrieve Application Type by Query (encoded)
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/api/applicationtypes?query=name+like+%27RRD%25%27"
1.10.3 Add Application Types
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postAppType.json -H "Accept: application/json" --header "Content-Type: application/json" http://localhost/api/applicationtypes
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./postAppType.xml -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/applicationtypes
1.10.4 Delete Application Type
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/applicationtypes/name
1.11 Entity Type Examples with Curl
1.11.1 Retrieve A Single Entity Type
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/entitytypes/HOST
1.11.2 Retrieve Application Type by Query (encoded)
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/api/entitytypes?query=name+like+%27C%25%27"
1.12 Consolidation Examples with Curl
1.12.1 Retrieve A Single Consolidation Criteria
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" http://localhost/api/consolidations/SYSLOG
1.12.2 Retrieve Consolidations by Query (encoded)
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/api/consolidations?query=name+like+%27SY%25%27"
1.12.3 Store Consolidation Criteria
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./consolidations.json -H "Accept: application/json" --header "Content-Type: application/json" http://localhost/api/applicationtypes
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d @./consolidations.xml -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/consolidations
1.12.4 Delete Consolidation Criteria
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/consolidations/name
1.13 Notification Examples with Curl
1.13.1 Post a Host Notification
curl -X POST -d@./postHostNotification.xml -H "GWOS-API-TOKEN:9E72B5E688429F6A867602E6D047E09D" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/notifications/hosts
More Post Data Examples: XML - JSON
1.13.2 Post a Service Notification
curl -X POST -d@./postServiceNotification.xml -H "GWOS-API-TOKEN:9E72B5E688429F6A867602E6D047E09D" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" --header "Content-Type: application/xml" http://localhost/api/notifications/services
More Post Data Examples: XML - JSON
1.14 Perf Data Examples with Curl
1.14.1 Post to Perf Data
curl -X POST -d@./postPerfData.json -H "GWOS-API-TOKEN:9E72B5E688429F6A867602E6D047E09D" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" --header "Content-Type: application/json" http://localhost/api/perfdata
More Post Data Examples: XML - JSON
1.14.2 Get Performance Time Series Data Using XML
curl -s -H "GWOS-API-TOKEN:9E72B5E688429F6A867602E6D047E09D" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/perfdata?appType=VEMA&serverName=loadtest-vm-0&serviceName=loadtest-vm-metric-0&startTime=1443208066000&endTime=1443208366000&interval=30000"
XML Response:
<perfDataTimeSeries appType="VEMA" serverName="loadtest-vm-0" serviceName="loadtest-vm-metric-0" startTime="1443208066000" endTime="1443208366000" interval="30000"> <perfDataTimeSeriesValue valueType="value" timestamp="1443208110000" value="36.0"/> <perfDataTimeSeriesValue valueType="value" timestamp="1443208170000" value="27.0"/> <perfDataTimeSeriesValue valueType="value" timestamp="1443208230000" value="20.0"/> <perfDataTimeSeriesValue valueType="value" timestamp="1443208290000" value="13.0"/> <perfDataTimeSeriesValue valueType="thold-c" timestamp="1443208110000" value="100.0"/> <perfDataTimeSeriesValue valueType="thold-c" timestamp="1443208170000" value="100.0"/> <perfDataTimeSeriesValue valueType="thold-c" timestamp="1443208230000" value="100.0"/> <perfDataTimeSeriesValue valueType="thold-c" timestamp="1443208290000" value="100.0"/> <perfDataTimeSeriesValue valueType="thold-w" timestamp="1443208110000" value="90.0"/> <perfDataTimeSeriesValue valueType="thold-w" timestamp="1443208170000" value="90.0"/> <perfDataTimeSeriesValue valueType="thold-w" timestamp="1443208230000" value="90.0"/> <perfDataTimeSeriesValue valueType="thold-w" timestamp="1443208290000" value="90.0"/> </perfDataTimeSeries>
1.14.3 Get Performance Time Series Data Using JSON
curl -s -H "GWOS-API-TOKEN:9E72B5E688429F6A867602E6D047E09D" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/perfdata?appType=VEMA&serverName=loadtest-vm-0&serviceName=loadtest-vm-metric-0&startTime=1443208066000&endTime=1443208366000&interval=30000"
JSON Response:
{ "appType" : "VEMA", "serverName" : "loadtest-vm-0", "serviceName" : "loadtest-vm-metric-0", "startTime" : 1443208066000, "endTime" : 1443208366000, "interval" : 30000, "perfDataTimeSeriesValues" : [ { "valueType" : "value", "timestamp" : 1443208110000, "value" : 36.0 }, { "valueType" : "value", "timestamp" : 1443208170000, "value" : 27.0 }, { "valueType" : "value", "timestamp" : 1443208230000, "value" : 20.0 }, { "valueType" : "value", "timestamp" : 1443208290000, "value" : 13.0 }, { "valueType" : "thold-c", "timestamp" : 1443208110000, "value" : 100.0 }, { "valueType" : "thold-c", "timestamp" : 1443208170000, "value" : 100.0 }, { "valueType" : "thold-c", "timestamp" : 1443208230000, "value" : 100.0 }, { "valueType" : "thold-c", "timestamp" : 1443208290000, "value" : 100.0 }, { "valueType" : "thold-w", "timestamp" : 1443208110000, "value" : 90.0 }, { "valueType" : "thold-w", "timestamp" : 1443208170000, "value" : 90.0 }, { "valueType" : "thold-w", "timestamp" : 1443208230000, "value" : 90.0 }, { "valueType" : "thold-w", "timestamp" : 1443208290000, "value" : 90.0 } ] }
1.15 Audit Log Examples with Curl
1.15.1 Retrieve Audit Logs for a Host Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/auditlogs/server_2?first=0&count=2"
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <auditLogs> <auditLog auditLogId="30" subsystem="SV" hostName="server_2" action="DELETE" description="Test deletion server 2." username="admin" timestamp="2014-09-26T14:03:24.515-0600" serviceDescription="network_users"/> <auditLog auditLogId="29" subsystem="SV" hostName="server_2" action="ADD" description="Test addition server 2." username="admin" timestamp="2014-09-26T14:03:24.515-0600" serviceDescription="local_processes"/> </auditLogs>
1.15.2 Retrieve Audit Logs for a Host and Service Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/foundation-webapp/api/auditlogs/server_2/local_processes?first=0&count=1"
JSON Response:
{ "auditLogs": [ { "auditLogId" : 32, "subsystem" : "SV", "hostName" : "server_2", "action" : "ADD", "description" : "Test addition server 2.", "username" : "admin", "timestamp" : "2014-09-26T14:03:25.600-0600", "serviceDescription" : "local_processes" } ] }
1.15.3 Retrieve Audit Logs by Query Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/foundation-webapp/api/auditlogs?query=hostName%20%3D%20'server_2'%20ORDER%20BY%20timestamp%20DESC,%20auditLogId%20DESC&first=0&count=2"
JSON Response:
{ "auditLogs": [ { "auditLogId" : 33, "subsystem" : "SV", "hostName" : "server_2", "action" : "DELETE", "description" : "Test deletion server 2.", "username" : "admin", "timestamp" : "2014-09-26T14:03:25.600-0600", "serviceDescription" : "network_users" }, { "auditLogId" : 32, "subsystem" : "SV", "hostName" : "server_2", "action" : "ADD", "description" : "Test addition server 2.", "username" : "admin", "timestamp" : "2014-09-26T14:03:25.600-0600", "serviceDescription" : "local_processes" } ] }
1.15.4 Create Audit Log Asynchronously Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<auditLogs><auditLog subsystem="Console" hostName="server_1" action="MODIFY" description="Test modification server 1." username="admin"/></auditLogs>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/auditlogs
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <results successful="1" failed="0" entityType="AuditLog Async" operation="Insert" warning="0" count="1"> <result><entity>1411761803932</entity><message>Job 1411761803932 submitted</message><status>success</status></result> </results>
1.15.5 Create Audit Logs Synchronously Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"auditLogs": [{"subsystem": "SV", "hostName": "server_2", "action": "ADD", "description": "Test addition server 2.", "username": "admin", "serviceDescription": "local_processes"}, {"subsystem": "SV", "hostName": "server_2", "action": "DELETE", "description": "Test deletion server 2.", "username": "admin", "serviceDescription": "network_users"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost/foundation-webapp/api/auditlogs?async=false"
JSON Response:
{ "successful" : 2, "failed" : 0, "entityType" : "AuditLog", "operation" : "Insert", "warning" : 0, "results" : [ { "entity" : "com.groundwork.collage.model.impl.AuditLog@7aec81d5[auditLogId=94,subsystem=SV,hostName=server_2,action=ADD,description=Test addition server 2.,username=admin,timestamp=Fri Oct 24 11:40:43 MDT 2014,serviceDescription=local_processes]", "status" : "success", "message" : "AuditLog saved" }, { "entity" : "com.groundwork.collage.model.impl.AuditLog@3d4005ff[auditLogId=95,subsystem=SV,hostName=server_2,action=DELETE,description=Test deletion server 2.,username=admin,timestamp=Fri Oct 24 11:40:43 MDT 2014,serviceDescription=network_users]", "status" : "success", "message" : "AuditLog saved" } ], "count" : 2 }
1.16 Host Identity Examples with Curl
1.16.1 Retrieve Host Identity by Host Name Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/hostidentities/TEST-HOST-NAME-0"
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <hostIdentity hostIdentityId="11c2d250-6437-11e4-9584-002219ed08d3" hostName="test-host-name-0" host="false"><hostNames><hostName>test-host-name-0</hostName></hostNames></hostIdentity>
1.16.2 Retrieve All Host Identities Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/foundation-webapp/api/hostidentities?first=0&count=2"
JSON Response:
{ "hostIdentities" : [ { "hostIdentityId" : "1267adf2-6437-11e4-82be-002219ed08d3", "hostName" : "test-host-name-0", "hostNames" : [ "test-host-name-0" ], "host" : false }, { "hostIdentityId" : "12c545e8-6437-11e4-82bf-002219ed08d3", "hostName" : "test-host-name-1", "hostNames" : [ "test-host-name-1", "test-host-name-1.0", "test-host-name-1.1" ], "host" : false } ] }
1.16.3 Retrieve Host Identities by Query Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/foundation-webapp/api/hostidentities?query=hostName%20like%20%27test-host-name-%25%27%20ORDER%20BY%20hostName"
JSON Response:
{ "hostIdentities" : [ { "hostIdentityId" : "1267adf2-6437-11e4-82be-002219ed08d3", "hostName" : "test-host-name-0", "hostNames" : [ "test-host-name-0" ], "host" : false }, { "hostIdentityId" : "12c545e8-6437-11e4-82bf-002219ed08d3", "hostName" : "test-host-name-1", "hostNames" : [ "test-host-name-1", "test-host-name-1.0", "test-host-name-1.1" ], "host" : false }, { "hostIdentityId" : "8fb9a880-f093-4892-a0f3-b1a403b49e5e", "hostName" : "test-host-name-2", "hostNames" : [ "9e1b25a0-e036-4ce1-bf01-56c9cc8934ce", "test-host-name-2" ], "host" : false } ] }
1.16.4 Create Host Identity Asynchronously Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<hostIdentities><hostIdentity hostName="test-host-name-0"><hostNames><hostName>test-host-name-0</hostName></hostNames></hostIdentity></hostIdentities>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/hostidentities?async=true
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <results successful="1" failed="0" entityType="HostIdentity Async" operation="Insert" warning="0" count="1"> <result><entity>1415114840770</entity><message>Job 1415114840770 submitted</message><status>success</status></result> </results>
1.16.5 Create Host Identities Synchronously Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"hostIdentities":[{"hostName":"test-host-name-1","hostNames":["test-host-name-1.0","test-host-name-1.1","test-host-name-1"]},{"hostIdentityId":"8fb9a880-f093-4892-a0f3-b1a403b49e5e","hostName":"test-host-name-2","hostNames":["9e1b25a0-e036-4ce1-bf01-56c9cc8934ce","test-host-name-2"]}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost/foundation-webapp/api/hostidentities
JSON Response:
{ "successful" : 2, "failed" : 0, "entityType" : "HostIdentity", "operation" : "Insert", "warning" : 0, "results" : [ { "entity" : "test-host-name-1", "status" : "success", "message" : "http://localhost:8080/foundation-webapp/api/hostidentities/test-host-name-1" }, { "entity" : "test-host-name-2", "status" : "success", "message" : "http://localhost:8080/foundation-webapp/api/hostidentities/test-host-name-2" } ], "count" : 2 }
1.16.6 Update Host Identity Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<hostIdentities><hostIdentity hostIdentityId="12042cdc-6437-11e4-9585-002219ed08d3" hostName="test-host-name-1-changed"><hostNames><hostName>test-host-name-1-changed-alias</hostName></hostNames></hostIdentity></hostIdentities>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/hostidentities
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <results successful="1" failed="0" entityType="HostIdentity" operation="Update" warning="0" count="1"> <result><entity>12042cdc-6437-11e4-9585-002219ed08d3</entity><message>http://localhost:8080/foundation-webapp/api/hostidentities/test-host-name-1-changed</message><status>success</status></result> </results>
1.16.7 Clear Host Identity Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/json" "http://localhost/foundation-webapp/api/hostidentities/test-host-name-1?clear=true"
JSON Response:
{ "successful" : 1, "failed" : 0, "entityType" : "HostIdentity", "operation" : "Clear", "warning" : 0, "results" : [ { "entity" : "test-host-name-1", "status" : "success", "message" : "HostIdentity cleared" } ], "count" : 1 }
1.16.8 Delete Host Identities Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -d '<hostIdentities><hostIdentity hostIdentityId="12042cdc-6437-11e4-9585-002219ed08d3" hostName="test-host-name-1-changed"><hostNames><hostName>test-host-name-1</hostName><hostName>test-host-name-1-changed</hostName><hostName>test-host-name-1-changed-alias</hostName></hostNames></hostIdentity><hostIdentity hostIdentityId="5d33537c-293e-4564-b0cf-d0998389b31f" hostName="test-host-name-2"><hostNames><hostName>test-host-name-2</hostName><hostName>46eb4a5b-a08e-470b-9be7-8108aa5a2cc7</hostName></hostNames></hostIdentity></hostIdentities>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/hostidentities"
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <results successful="2" failed="0" entityType="HostIdentity" operation="Delete" warning="0" count="2"> <result><entity>12042cdc-6437-11e4-9585-002219ed08d3</entity><message>HostIdentity deleted</message><status>success</status></result> <result><entity>5d33537c-293e-4564-b0cf-d0998389b31f</entity><message>HostIdentity deleted</message><status>success</status></result> </results>
1.16.9 Host Identity Autocomplete Using XML
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/hostidentities/autocomplete/local"
XML Response:
<names> <name>localhost</name> <name>localhost2</name> </names>
1.17 Host Blacklist Examples with Curl
1.17.1 Retrieve Host Blacklist by Host Name Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/hostblacklists/test-host-name-0"
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <hostBlacklist hostBlacklistId="10" hostName="test-host-name-0"/>
1.17.2 Retrieve All Host Blacklists Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/foundation-webapp/api/hostblacklists?first=0&count=2"
JSON Response:
{ "hostBlacklists" : [ { "hostBlacklistId" : 12, "hostName" : "test-host-name-0" }, { "hostBlacklistId" : 13, "hostName" : "test-host-name-1" } ] }
1.17.3 Retrieve Host Blacklists by Query Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/foundation-webapp/api/hostblacklists?query=hostName%20like%20%27test-host-name-%25%27%20ORDER%20BY%20hostName"
JSON Response:
{ "hostBlacklists" : [ { "hostBlacklistId" : 12, "hostName" : "test-host-name-0" }, { "hostBlacklistId" : 13, "hostName" : "test-host-name-1" }, { "hostBlacklistId" : 14, "hostName" : "test-host-name-2" } ] }
1.17.4 Create Host Blacklist Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<hostBlacklists><hostBlacklist hostName="test-host-name-0"/></hostBlacklists>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/hostblacklists
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <results successful="1" failed="0" entityType="HostBlacklist" operation="Insert" warning="0" count="3"> <result><entity>test-host-name-0</entity><location>http://localhost:8080/foundation-webapp/api/hostblacklists/test-host-name-0</location><status>success</status></result> </results>
1.17.5 Create Host Blacklists Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"hostBlacklists":[{"hostName":"test-host-name-1"},{"hostBlacklistId":"8fb9a880-f093-4892-a0f3-b1a403b49e5e","hostName":"test-host-name-2"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost/foundation-webapp/api/hostblacklists
JSON Response:
{ "successful" : 2, "failed" : 0, "entityType" : "HostBlacklist", "operation" : "Insert", "warning" : 0, "results" : [ { "entity" : "test-host-name-1", "status" : "success", "message" : "http://localhost:8080/foundation-webapp/api/hostblacklists/test-host-name-1" }, { "entity" : "test-host-name-2", "status" : "success", "message" : "http://localhost:8080/foundation-webapp/api/hostblacklists/test-host-name-2" } ], "count" : 2 }
1.17.6 Update Host Blacklist Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<hostBlacklists><hostBlacklist hostBlacklistId="11" hostName="test-host-name-1-changed"/></hostBlacklists>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/hostblacklists
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <results successful="1" failed="0" entityType="HostBlacklist" operation="Update" warning="0" count="1"> <result><entity>11</entity><message>http://localhost:8080/foundation-webapp/api/hostblacklists/test-host-name-1-changed</message><status>success</status></result> </results>
1.17.7 Delete Host Blacklists Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -d '<hostBlacklists><hostBlacklist hostBlacklistId="11" hostName="test-host-name-1-changed"/><hostBlacklist hostBlacklistId="12" hostName="test-host-name-2"/></hostBlacklists>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/hostblacklists
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <results successful="2" failed="0" entityType="HostBlacklist" operation="Delete" warning="0" count="2"> <result><entity>11</entity><message>HostBlacklist deleted</message><status>success</status></result> <result><entity>12</entity><message>HostBlacklist deleted</message><status>success</status></result> </results>
1.18 Biz Downtime Examples with Curl
1.18.1 Set Service In Downtime Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<bizHostsAndServices><hostNames><hostName>localhost</hostName></hostNames><serviceDescriptions><serviceDescription>local_memory</serviceDescription></serviceDescriptions></bizHostsAndServices>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/biz/setindowntime"
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <bizHostServiceInDowntimes> <bizHostServiceInDowntime hostName="localhost" serviceDescription="local_memory" scheduledDowntimeDepth="1" entityType="SERVICE_STATUS" entityName="local_memory"/> </bizHostServiceInDowntimes>
1.18.2 Set Host Group In Downtime Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"hostNames":["*"],"hostGroupNames":["Linux Servers"]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/biz/setindowntime"
JSON Response:
{ "bizHostServiceInDowntimes" : [ { "hostName" : "localhost", "scheduledDowntimeDepth" : 1, "entityType" : "HOSTGROUP", "entityName" : "Linux Servers" } ] }
1.18.3 Clear In Downtime Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<bizHostServiceInDowntimes><bizHostServiceInDowntime hostName="localhost" serviceDescription="local_memory" scheduledDowntimeDepth="1" entityType="SERVICE_STATUS" entityName="local_memory"/></bizHostServiceInDowntimes>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/biz/clearindowntime"
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <bizHostServiceInDowntimes> <bizHostServiceInDowntime hostName="localhost" serviceDescription="local_memory" scheduledDowntimeDepth="0" entityType="SERVICE_STATUS" entityName="local_memory"/> </bizHostServiceInDowntimes>
1.18.4 Clear In Downtime Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"bizHostServiceInDowntimes":[{"hostName":"localhost","scheduledDowntimeDepth":1,"entityType":"HOSTGROUP","entityName":"Linux Servers"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/biz/clearindowntime"
JSON Response:
{ "bizHostServiceInDowntimes" : [ { "hostName" : "localhost", "scheduledDowntimeDepth" : 1, "entityType" : "HOSTGROUP", "entityName" : "Linux Servers" } ] }
1.18.5 Get In Downtime Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<bizHostServiceInDowntimes><bizHostServiceInDowntime hostName="localhost" serviceDescription="local_memory"/></bizHostServiceInDowntimes>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/biz/getindowntime"
XML Response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <bizHostServiceInDowntimes> <bizHostServiceInDowntime hostName="localhost" serviceDescription="local_memory" scheduledDowntimeDepth="1"/> </bizHostServiceInDowntimes>
1.18.6 Get In Downtime Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"bizHostServiceInDowntimes":[{"hostName":"localhost"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/biz/getindowntime"
JSON Response:
{ "bizHostServiceInDowntimes" : [ { "hostName" : "localhost", "scheduledDowntimeDepth" : 1 } ] }
1.19 Device Template Profile Examples with Curl
1.19.1 Retrieve Device Template Profile by Device Identification Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/devicetemplateprofiles/test-device-identification-0"
XML Response:
<deviceTemplateProfile deviceTemplateProfileId="37" deviceIdentification="test-device-identification-0" deviceDescription="test device identification 0" timestamp="2014-11-26T11:01:29.516-0700"/>
1.19.2 Retrieve All Device Template Profiles Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/foundation-webapp/api/devicetemplateprofiles?first=0&count=2"
JSON Response:
{ "deviceTemplateProfiles" : [ { "deviceTemplateProfileId" : 34, "deviceIdentification" : "test-device-identification-0", "deviceDescription" : "test device identification 0", "timestamp" : "2014-11-26T11:01:29.056-0700" }, { "deviceTemplateProfileId" : 35, "deviceIdentification" : "test-device-identification-1", "deviceDescription" : "test device identification 1", "cactiHostTemplate" : "cacti-host-template", "timestamp" : "2014-11-26T11:01:29.056-0700" } ] }
1.19.3 Retrieve Device Template Profiles by Query Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/foundation-webapp/api/devicetemplateprofiles?query=deviceIdentification%20like%20%27test-device-identification-%25%27%20ORDER%20BY%20deviceIdentification"
JSON Response:
{ "deviceTemplateProfiles" : [ { "deviceTemplateProfileId" : 34, "deviceIdentification" : "test-device-identification-0", "deviceDescription" : "test device identification 0", "timestamp" : "2014-11-26T11:01:29.056-0700" }, { "deviceTemplateProfileId" : 35, "deviceIdentification" : "test-device-identification-1", "deviceDescription" : "test device identification 1", "cactiHostTemplate" : "cacti-host-template", "timestamp" : "2014-11-26T11:01:29.056-0700" }, { "deviceTemplateProfileId" : 36, "deviceIdentification" : "test-device-identification-2", "deviceDescription" : "test device identification 2", "monarchHostProfile" : "monarch-host-profile", "timestamp" : "2014-11-26T11:01:29.056-0700" } ] }
1.19.4 Create Device Template Profile Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<deviceTemplateProfiles><deviceTemplateProfile deviceIdentification="test-device-identification-0" deviceDescription="test device identification 0"/></deviceTemplateProfiles>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/devicetemplateprofiles"
XML Response:
<results successful="1" failed="0" entityType="DeviceTemplateProfile" operation="Insert" warning="0" count="1"> <result><entity>test-device-identification-0</entity><location>http://localhost:8080/foundation-webapp/api/devicetemplateprofiles/test-device-identification-0</location><status>success</status></result> </results>
1.19.5 Create Device Template Profiles Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"deviceTemplateProfiles":[{"deviceIdentification":"test-device-identification-0","deviceDescription":"test device identification 0"},{"deviceIdentification":"test-device-identification-1","deviceDescription":"test device identification 1","cactiHostTemplate":"cacti-host-template"},{"deviceIdentification":"test-device-identification-2","deviceDescription":"test device identification 2","monarchHostProfile":"monarch-host-profile"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost/foundation-webapp/api/devicetemplateprofiles"
JSON Response:
{ "successful" : 3, "failed" : 0, "entityType" : "DeviceTemplateProfile", "operation" : "Insert", "warning" : 0, "results" : [ { "entity" : "test-device-identification-0", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/devicetemplateprofiles/test-device-identification-0" }, { "entity" : "test-device-identification-1", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/devicetemplateprofiles/test-device-identification-1" }, { "entity" : "test-device-identification-2", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/devicetemplateprofiles/test-device-identification-2" } ], "count" : 3 }
1.19.6 Update Device Template Profile Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<deviceTemplateProfiles><deviceTemplateProfile deviceIdentification="test-device-identification-1-changed" deviceDescription="test device identification 1 changed" monarchHostProfile="monarch-host-profile"/></deviceTemplateProfiles>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/devicetemplateprofiles"
XML Response:
<results successful="1" failed="0" entityType="DeviceTemplateProfile" operation="Update" warning="0" count="1"> <result><entity>test-device-identification-1-changed</entity><location>http://localhost:8080/foundation-webapp/api/devicetemplateprofiles/test-device-identification-1-changed</location><status>success</status></result> </results>
1.19.7 Clear Device Template Profile Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -H "Accept: application/xml" "http://localhost/foundation-webapp/api/devicetemplateprofiles/test-device-identification-2?clear=true"
JSON Response:
{ "successful" : 1, "failed" : 0, "entityType" : "DeviceTemplateProfile", "operation" : "Clear", "warning" : 0, "results" : [ { "entity" : "test-device-identification-2", "status" : "success", "message" : "DeviceTemplateProfile cleared" } ], "count" : 1 }
1.19.8 Delete Device Template Profiles Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X DELETE -d '<deviceTemplateProfiles><deviceTemplateProfile deviceTemplateProfileId="38" deviceIdentification="test-device-identification-1-changed" deviceDescription="test device identification 1 changed" monarchHostProfile="monarch-host-profile" timestamp="2014-11-25T20:45:33.674-0700"/><deviceTemplateProfile deviceTemplateProfileId="39" deviceIdentification="test-device-identification-2" deviceDescription="test device identification 2" monarchHostProfile="monarch-host-profile" timestamp="2014-11-25T20:45:33.264-0700"/></deviceTemplateProfiles>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/devicetemplateprofiles"
XML Response:
<results successful="2" failed="0" entityType="DeviceTemplateProfile" operation="Delete" warning="0" count="2"> <result><entity>38</entity><message>DeviceTemplateProfile deleted</message><status>success</status></result> <result><entity>39</entity><message>DeviceTemplateProfile deleted</message><status>success</status></result> </results>
1.20 Custom Group Examples with Curl
1.20.1 Retrieve A Single Custom Group
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-0"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-0"
Results:
{ "id" : 11, "name" : "TEST-CUSTOM-GROUP-0", "description" : "TEST-CUSTOM-GROUP-0", "appType" : "NAGIOS", "agentId" : "TEST-AGENT", "root" : true, "hostGroups" : [ { "id" : 4, "name" : "TEST-HOST-GROUP-0", "alias" : "TEST-HOST-GROUP-0", "appType" : "NAGIOS" } ] }
<customGroup id="15" name="TEST-CUSTOM-GROUP-0" description="TEST-CUSTOM-GROUP-0" appType="NAGIOS" agentId="TEST-AGENT" root="true"> <hostGroups> <hostGroup id="4" name="TEST-HOST-GROUP-0" alias="TEST-HOST-GROUP-0" appType="NAGIOS"/> </hostGroups> </customGroup>
1.20.2 Retrieve All Custom Groups
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/customgroups/"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/customgroups/"
Results:
{ "customGroups" : [ { "id" : 11, "name" : "TEST-CUSTOM-GROUP-0", "description" : "TEST-CUSTOM-GROUP-0", "appType" : "NAGIOS", "agentId" : "TEST-AGENT", "root" : true, "hostGroups" : [ { "id" : 4, "name" : "TEST-HOST-GROUP-0", "alias" : "TEST-HOST-GROUP-0", "appType" : "NAGIOS" } ] }, { "id" : 12, "name" : "TEST-CUSTOM-GROUP-1", "agentId" : "TEST-AGENT", "root" : true, "serviceGroups" : [ { "id" : 10, "name" : "TEST-SERVICE-GROUP-0" } ] }, { "id" : 13, "name" : "TEST-CUSTOM-GROUP-2", "appType" : "NAGIOS", "root" : true }, { "id" : 14, "name" : "TEST-CUSTOM-GROUP-3", "root" : true } ] }
<customGroups> <customGroup id="15" name="TEST-CUSTOM-GROUP-0" description="TEST-CUSTOM-GROUP-0" appType="NAGIOS" agentId="TEST-AGENT" root="true"> <hostGroups> <hostGroup id="4" name="TEST-HOST-GROUP-0" alias="TEST-HOST-GROUP-0" appType="NAGIOS"/> </hostGroups> </customGroup> <customGroup id="16" name="TEST-CUSTOM-GROUP-1" agentId="TEST-AGENT" root="true"> <serviceGroups> <serviceGroup id="10" name="TEST-SERVICE-GROUP-0"/> </serviceGroups> </customGroup> <customGroup id="17" name="TEST-CUSTOM-GROUP-2" appType="NAGIOS" root="true"/> <customGroup id="18" name="TEST-CUSTOM-GROUP-3" root="true"/> </customGroups>
1.20.3 Retrieve Custom Groups by Query (encoded)
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/customgroups?query=name%20like%20%27TEST-CUSTOM-GROUP-%25%27%20order%20by%20name%20asc&first=0&count=2"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/customgroups?query=name%20like%20%27TEST-CUSTOM-GROUP-%25%27%20order%20by%20name%20asc&first=0&count=2"
Results:
{ "customGroups" : [ { "id" : 11, "name" : "TEST-CUSTOM-GROUP-0", "description" : "TEST-CUSTOM-GROUP-0", "appType" : "NAGIOS", "agentId" : "TEST-AGENT", "root" : true, "hostGroups" : [ { "id" : 4, "name" : "TEST-HOST-GROUP-0", "alias" : "TEST-HOST-GROUP-0", "appType" : "NAGIOS" } ] }, { "id" : 12, "name" : "TEST-CUSTOM-GROUP-1", "agentId" : "TEST-AGENT", "root" : true, "serviceGroups" : [ { "id" : 10, "name" : "TEST-SERVICE-GROUP-0" } ] } ] }
<customGroups> <customGroup id="15" name="TEST-CUSTOM-GROUP-0" description="TEST-CUSTOM-GROUP-0" appType="NAGIOS" agentId="TEST-AGENT" root="true"> <hostGroups> <hostGroup id="4" name="TEST-HOST-GROUP-0" alias="TEST-HOST-GROUP-0" appType="NAGIOS"/> </hostGroups> </customGroup> <customGroup id="16" name="TEST-CUSTOM-GROUP-1" agentId="TEST-AGENT" root="true"> <serviceGroups> <serviceGroup id="10" name="TEST-SERVICE-GROUP-0"/> </serviceGroups> </customGroup> </customGroups>
1.20.4 Store Custom Groups
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"customGroups" : [{"name" : "TEST-CUSTOM-GROUP-0", "description" : "TEST-CUSTOM-GROUP-0", "appType" : "NAGIOS", "agentId" : "TEST-AGENT", "hostGroupNames" : ["TEST-HOST-GROUP-0"]}, {"name" : "TEST-CUSTOM-GROUP-1", "agentId" : "TEST-AGENT", "serviceGroupNames" : ["TEST-SERVICE-GROUP-0"]}, {"name" : "TEST-CUSTOM-GROUP-2", "appType" : "NAGIOS"}, {"name" : "TEST-CUSTOM-GROUP-3"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/customgroups"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<customGroups><customGroup name="TEST-CUSTOM-GROUP-0" description="TEST-CUSTOM-GROUP-0" appType="NAGIOS" agentId="TEST-AGENT"><hostGroupNames><hostGroupName>TEST-HOST-GROUP-0</hostGroupName></hostGroupNames></customGroup><customGroup name="TEST-CUSTOM-GROUP-1" agentId="TEST-AGENT"><serviceGroupNames><serviceGroupName>TEST-SERVICE-GROUP-0</serviceGroupName></serviceGroupNames></customGroup><customGroup name="TEST-CUSTOM-GROUP-2" appType="NAGIOS"/><customGroup name="TEST-CUSTOM-GROUP-3"/></customGroups>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/customgroups"
Results:
{ "successful" : 4, "failed" : 0, "entityType" : "CustomGroup", "operation" : "Update", "warning" : 0, "results" : [ { "entity" : "TEST-CUSTOM-GROUP-0", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-0" }, { "entity" : "TEST-CUSTOM-GROUP-1", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-1" }, { "entity" : "TEST-CUSTOM-GROUP-2", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-2" }, { "entity" : "TEST-CUSTOM-GROUP-3", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-3" } ], "count" : 4 }
<results successful="4" failed="0" entityType="CustomGroup" operation="Update" warning="0" count="4"> <result> <entity>TEST-CUSTOM-GROUP-0</entity> <location>http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-0</location> <status>success</status> </result> <result> <entity>TEST-CUSTOM-GROUP-1</entity> <location>http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-1</location> <status>success</status> </result> <result> <entity>TEST-CUSTOM-GROUP-2</entity> <location>http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-2</location> <status>success</status> </result> <result> <entity>TEST-CUSTOM-GROUP-3</entity> <location>http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-3</location> <status>success</status> </result> </results>
1.20.5 Add/Delete Custom Group Members
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '{"name" : "TEST-CUSTOM-GROUP-0", "hostGroupNames" : ["TEST-HOST-GROUP-1"]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/customgroups/addmembers"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '{"name" : "TEST-CUSTOM-GROUP-1", "serviceGroupNames" : ["TEST-SERVICE-GROUP-0"]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/customgroups/deletemembers"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '<customGroup name="TEST-CUSTOM-GROUP-0"><hostGroupNames><hostGroupName>TEST-HOST-GROUP-1</hostGroupName></hostGroupNames></customGroup>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/customgroups/addmembers"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '<customGroup name="TEST-CUSTOM-GROUP-1"><serviceGroupNames><serviceGroupName>TEST-SERVICE-GROUP-0</serviceGroupName></serviceGroupNames></customGroup>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/customgroups/deletemembers"
Results:
{ "successful" : 1, "failed" : 0, "entityType" : "CustomGroup", "operation" : "Update", "warning" : 0, "results" : [ { "entity" : "TEST-CUSTOM-GROUP-0", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-0" } ], "count" : 1 }
<results successful="1" failed="0" entityType="CustomGroup" operation="Update" warning="0" count="1"> <result> <entity>TEST-CUSTOM-GROUP-1</entity> <location>http://localhost:8080/foundation-webapp/api/customgroups/TEST-CUSTOM-GROUP-1</location> <status>success</status> </result> </results>
1.20.6 Delete Custom Groups
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X DELETE -d '{"customGroups" : [{"name" : "TEST-CUSTOM-GROUP-0"}, {"name" : "TEST-CUSTOM-GROUP-1"}, {"name" : "TEST-CUSTOM-GROUP-2"}, {"name" : "TEST-CUSTOM-GROUP-3"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/customgroups"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X DELETE -d '<customGroups><customGroup name="TEST-CUSTOM-GROUP-0"/><customGroup name="TEST-CUSTOM-GROUP-1"/><customGroup name="TEST-CUSTOM-GROUP-2"/><customGroup name="TEST-CUSTOM-GROUP-3"/></customGroups>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/customgroups"
Results:
{ "successful" : 4, "failed" : 0, "entityType" : "CustomGroup", "operation" : "Delete", "warning" : 0, "results" : [ { "entity" : "TEST-CUSTOM-GROUP-0", "status" : "success", "message" : "Custom Group TEST-CUSTOM-GROUP-0 deleted." }, { "entity" : "TEST-CUSTOM-GROUP-1", "status" : "success", "message" : "Custom Group TEST-CUSTOM-GROUP-1 deleted." }, { "entity" : "TEST-CUSTOM-GROUP-2", "status" : "success", "message" : "Custom Group TEST-CUSTOM-GROUP-2 deleted." }, { "entity" : "TEST-CUSTOM-GROUP-3", "status" : "success", "message" : "Custom Group TEST-CUSTOM-GROUP-3 deleted." } ], "count" : 4 }
<results successful="4" failed="0" entityType="CustomGroup" operation="Delete" warning="0" count="4"> <result> <entity>TEST-CUSTOM-GROUP-0</entity> <message>Custom Group TEST-CUSTOM-GROUP-0 deleted.</message> <status>success</status> </result> <result> <entity>TEST-CUSTOM-GROUP-1</entity> <message>Custom Group TEST-CUSTOM-GROUP-1 deleted.</message> <status>success</status> </result> <result> <entity>TEST-CUSTOM-GROUP-2</entity> <message>Custom Group TEST-CUSTOM-GROUP-2 deleted.</message> <status>success</status> </result> <result> <entity>TEST-CUSTOM-GROUP-3</entity> <message>Custom Group TEST-CUSTOM-GROUP-3 deleted.</message> <status>success</status> </result> </results>
1.20.7 Custom Group Autocomplete Using XML
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/customgroups/autocomplete/cg"
XML Response:
<names> <name>CG1</name> <name>CG2</name> </names>
1.21 Service Group Examples with Curl
1.21.1 Retrieve A Single Service Group
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/servicegroups/SG-200"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/servicegroups/SG-200"
Results, (service properties elided here for the sake of brevity):
{ "id" : 29, "name" : "SG-200", "description" : "Service Group 200", "appType" : "VEMA", "appTypeDisplayName" : "VEMA", "agentId" : "Agent-007", "services" : [ { "properties" : { }, "id" : 2, "appType" : "NAGIOS", "description" : "local_cpu_java", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:37:15.000-0600", "nextCheckTime" : "2013-05-22T10:47:15.000-0600", "lastStateChange" : "2013-05-17T08:57:15.000-0600", "hostName" : "localhost", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "127.0.0.1", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 08:57:15 AM^^^OK - total %CPU for process java : 2.8^^^%CPU=2.8;40;50" }, { "properties" : { }, "id" : 4, "appType" : "NAGIOS", "description" : "local_cpu_perl", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:36:13.000-0600", "nextCheckTime" : "2013-05-22T10:46:13.000-0600", "lastStateChange" : "2013-05-17T08:46:12.000-0600", "hostName" : "localhost", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "127.0.0.1", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 08:46:12 AM^^^OK - total %CPU for process perl : 0.7^^^%CPU=0.7;40;50" } ] }
<serviceGroup id="30" name="SG-200" description="Service Group 200" appType="VEMA" appTypeDisplayName="VEMA" agentId="Agent-007"> <services> <service id="2" appType="NAGIOS" description="local_cpu_java" monitorStatus="OK" lastCheckTime="2013-05-22T10:37:15.000-0600" nextCheckTime="2013-05-22T10:47:15.000-0600" lastStateChange="2013-05-17T08:57:15.000-0600" hostName="localhost" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="127.0.0.1" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 08:57:15 AM^^^OK - total %CPU for process java : 2.8^^^%CPU=2.8;40;50"> <properties/> </service> <service id="4" appType="NAGIOS" description="local_cpu_perl" monitorStatus="OK" lastCheckTime="2013-05-22T10:36:13.000-0600" nextCheckTime="2013-05-22T10:46:13.000-0600" lastStateChange="2013-05-17T08:46:12.000-0600" hostName="localhost" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="127.0.0.1" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 08:46:12 AM^^^OK - total %CPU for process perl : 0.7^^^%CPU=0.7;40;50"> <properties/> </service> </services> </serviceGroup>
1.21.2 Retrieve All Service Groups
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/servicegroups/"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/servicegroups/
Results, (service properties elided here for the sake of brevity):
{ "serviceGroups" : [ { "id" : 1, "name" : "SG1", "services" : [ { "properties" : { }, "id" : 44, "appType" : "NAGIOS", "description" : "icmp_ping_alive", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:37:46.000-0600", "nextCheckTime" : "2013-05-22T10:47:46.000-0600", "lastStateChange" : "2013-05-17T10:27:46.000-0600", "hostName" : "qa-sles-11-64-2", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "172.28.113.150", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 10:27:46 AM^^^OK - 172.28.113.150: rta 0.038ms, lost 0%^^^rta=0.036ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=0.036ms;;;; rtmin=0.036ms;;;;" }, { "properties" : { }, "id" : 3, "appType" : "NAGIOS", "description" : "local_cpu_nagios", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:45:43.000-0600", "nextCheckTime" : "2013-05-22T10:55:43.000-0600", "lastStateChange" : "2013-05-17T08:45:43.000-0600", "hostName" : "localhost", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "127.0.0.1", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 08:45:43 AM^^^OK - total %CPU for process nagios : 0.0^^^%CPU=0.0;40;50" } ] }, { "id" : 29, "name" : "SG-200", "description" : "Service Group 200", "appType" : "VEMA", "appTypeDisplayName" : "VEMA", "agentId" : "Agent-007", "services" : [ { "properties" : { }, "id" : 2, "appType" : "NAGIOS", "description" : "local_cpu_java", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:37:15.000-0600", "nextCheckTime" : "2013-05-22T10:47:15.000-0600", "lastStateChange" : "2013-05-17T08:57:15.000-0600", "hostName" : "localhost", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "127.0.0.1", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 08:57:15 AM^^^OK - total %CPU for process java : 2.8^^^%CPU=2.8;40;50" }, { "properties" : { }, "id" : 4, "appType" : "NAGIOS", "description" : "local_cpu_perl", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:36:13.000-0600", "nextCheckTime" : "2013-05-22T10:46:13.000-0600", "lastStateChange" : "2013-05-17T08:46:12.000-0600", "hostName" : "localhost", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "127.0.0.1", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 08:46:12 AM^^^OK - total %CPU for process perl : 0.7^^^%CPU=0.7;40;50" } ] }, { "id" : 2, "name" : "web-svr", "services" : [ { "properties" : { }, "id" : 26, "appType" : "NAGIOS", "description" : "http_alive", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:40:41.000-0600", "nextCheckTime" : "2013-05-22T10:50:41.000-0600", "lastStateChange" : "2013-05-17T10:30:40.000-0600", "hostName" : "sql-2008", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "172.28.113.156", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 10:30:40 AM^^^HTTP OK: HTTP/1.1 200 OK - 955 bytes in 0.002 second response time^^^time=0.002418s;4.000000;7.000000;0.000000 size=955B;;;0" }, { "properties" : { }, "id" : 31, "appType" : "NAGIOS", "description" : "http_alive", "monitorStatus" : "UNSCHEDULED CRITICAL", "lastCheckTime" : "2013-05-22T10:39:21.000-0600", "nextCheckTime" : "2013-05-22T10:49:21.000-0600", "lastStateChange" : "2013-05-17T10:27:19.000-0600", "hostName" : "172.28.113.151", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "172.28.113.151", "lastPlugInOutput" : "3^^^3^^^0^^^05/17/2013 10:27:19 AM^^^CRITICAL - Socket timeout after 10 seconds^^^NA^^^" }, { "properties" : { }, "id" : 22, "appType" : "NAGIOS", "description" : "http_alive", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:40:36.000-0600", "nextCheckTime" : "2013-05-22T10:50:36.000-0600", "lastStateChange" : "2013-05-17T10:30:35.000-0600", "hostName" : "qa-rh6-64-2", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "172.28.113.167", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 10:30:35 AM^^^HTTP OK: HTTP/1.1 200 OK - 1269 bytes in 0.009 second response time^^^time=0.008503s;4.000000;7.000000;0.000000 size=1269B;;;0" }, { "properties" : { }, "id" : 36, "appType" : "NAGIOS", "description" : "icmp_ping_alive", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:42:48.000-0600", "nextCheckTime" : "2013-05-22T10:52:48.000-0600", "lastStateChange" : "2013-05-17T10:32:48.000-0600", "hostName" : "vm-it-xp-2", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "172.28.113.164", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 10:32:48 AM^^^OK - 172.28.113.164: rta 0.422ms, lost 0%^^^rta=0.422ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=0.422ms;;;; rtmin=0.422ms;;;;" }, { "properties" : { }, "id" : 51, "appType" : "NAGIOS", "description" : "icmp_ping_alive", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:42:02.000-0600", "nextCheckTime" : "2013-05-22T10:52:02.000-0600", "lastStateChange" : "2013-05-17T10:32:02.000-0600", "hostName" : "qa-rh6-64-2", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "172.28.113.167", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 10:32:02 AM^^^OK - 172.28.113.167: rta 1.064ms, lost 0%^^^rta=1.064ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=1.064ms;;;; rtmin=1.064ms;;;;" }, { "properties" : { }, "id" : 44, "appType" : "NAGIOS", "description" : "icmp_ping_alive", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:37:46.000-0600", "nextCheckTime" : "2013-05-22T10:47:46.000-0600", "lastStateChange" : "2013-05-17T10:27:46.000-0600", "hostName" : "qa-sles-11-64-2", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "172.28.113.150", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 10:27:46 AM^^^OK - 172.28.113.150: rta 0.038ms, lost 0%^^^rta=0.036ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=0.036ms;;;; rtmin=0.036ms;;;;" }, { "properties" : { }, "id" : 47, "appType" : "NAGIOS", "description" : "icmp_ping_alive", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:39:59.000-0600", "nextCheckTime" : "2013-05-22T10:49:59.000-0600", "lastStateChange" : "2013-05-17T23:59:59.000-0600", "hostName" : "do-win7-1", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "172.28.113.152", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 11:59:59 PM^^^OK - 172.28.113.152: rta 0.702ms, lost 0%^^^rta=0.702ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=0.702ms;;;; rtmin=0.702ms;;;;" }, { "properties" : { }, "id" : 67, "appType" : "NAGIOS", "description" : "snmp_if_19", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:37:56.000-0600", "nextCheckTime" : "2013-05-22T10:47:56.000-0600", "lastStateChange" : "2013-05-17T10:27:55.000-0600", "hostName" : "sql-2008", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "172.28.113.156", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 10:27:55 AM^^^SNMP OK - 0 0 0 0 0 0^^^IF-MIB::ifInOctets.19=0c IF-MIB::ifOutOctets.19=0c IF-MIB::ifInDiscards.19=0c IF-MIB::ifOutDiscards.19=0c IF-MIB::ifInErrors.19=0c IF-MIB::ifOutErrors.19=0c" } ] } ] }
<serviceGroups> <serviceGroup id="1" name="SG1"> <services> <service id="44" appType="NAGIOS" description="icmp_ping_alive" monitorStatus="OK" lastCheckTime="2013-05-22T10:37:46.000-0600" nextCheckTime="2013-05-22T10:47:46.000-0600" lastStateChange="2013-05-17T10:27:46.000-0600" hostName="qa-sles-11-64-2" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="172.28.113.150" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 10:27:46 AM^^^OK - 172.28.113.150: rta 0.038ms, lost 0%^^^rta=0.036ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=0.036ms;;;; rtmin=0.036ms;;;;"> <properties/> </service> <service id="3" appType="NAGIOS" description="local_cpu_nagios" monitorStatus="OK" lastCheckTime="2013-05-22T10:45:43.000-0600" nextCheckTime="2013-05-22T10:55:43.000-0600" lastStateChange="2013-05-17T08:45:43.000-0600" hostName="localhost" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="127.0.0.1" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 08:45:43 AM^^^OK - total %CPU for process nagios : 0.0^^^%CPU=0.0;40;50"><properties/> </service> </services> </serviceGroup> <serviceGroup id="30" name="SG-200" description="Service Group 200" appType="VEMA" appTypeDisplayName="VEMA" agentId="Agent-007"> <services> <service id="2" appType="NAGIOS" description="local_cpu_java" monitorStatus="OK" lastCheckTime="2013-05-22T10:37:15.000-0600" nextCheckTime="2013-05-22T10:47:15.000-0600" lastStateChange="2013-05-17T08:57:15.000-0600" hostName="localhost" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="127.0.0.1" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 08:57:15 AM^^^OK - total %CPU for process java : 2.8^^^%CPU=2.8;40;50"> <properties/> </service> <service id="4" appType="NAGIOS" description="local_cpu_perl" monitorStatus="OK" lastCheckTime="2013-05-22T10:36:13.000-0600" nextCheckTime="2013-05-22T10:46:13.000-0600" lastStateChange="2013-05-17T08:46:12.000-0600" hostName="localhost" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="127.0.0.1" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 08:46:12 AM^^^OK - total %CPU for process perl : 0.7^^^%CPU=0.7;40;50"> <properties/> </service> </services> </serviceGroup> <serviceGroup id="2" name="web-svr"> <services> <service id="26" appType="NAGIOS" description="http_alive" monitorStatus="OK" lastCheckTime="2013-05-22T10:40:41.000-0600" nextCheckTime="2013-05-22T10:50:41.000-0600" lastStateChange="2013-05-17T10:30:40.000-0600" hostName="sql-2008" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="172.28.113.156" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 10:30:40 AM^^^HTTP OK: HTTP/1.1 200 OK - 955 bytes in 0.002 second response time^^^time=0.002418s;4.000000;7.000000;0.000000 size=955B;;;0"> <properties/> </service> <service id="31" appType="NAGIOS" description="http_alive" monitorStatus="UNSCHEDULED CRITICAL" lastCheckTime="2013-05-22T10:39:21.000-0600" nextCheckTime="2013-05-22T10:49:21.000-0600" lastStateChange="2013-05-17T10:27:19.000-0600" hostName="172.28.113.151" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="172.28.113.151" lastPlugInOutput="3^^^3^^^0^^^05/17/2013 10:27:19 AM^^^CRITICAL - Socket timeout after 10 seconds^^^NA^^^"> <properties/> </service> <service id="22" appType="NAGIOS" description="http_alive" monitorStatus="OK" lastCheckTime="2013-05-22T10:40:36.000-0600" nextCheckTime="2013-05-22T10:50:36.000-0600" lastStateChange="2013-05-17T10:30:35.000-0600" hostName="qa-rh6-64-2" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="172.28.113.167" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 10:30:35 AM^^^HTTP OK: HTTP/1.1 200 OK - 1269 bytes in 0.009 second response time^^^time=0.008503s;4.000000;7.000000;0.000000 size=1269B;;;0"> <properties/> </service> <service id="36" appType="NAGIOS" description="icmp_ping_alive" monitorStatus="OK" lastCheckTime="2013-05-22T10:42:48.000-0600" nextCheckTime="2013-05-22T10:52:48.000-0600" lastStateChange="2013-05-17T10:32:48.000-0600" hostName="vm-it-xp-2" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="172.28.113.164" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 10:32:48 AM^^^OK - 172.28.113.164: rta 0.422ms, lost 0%^^^rta=0.422ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=0.422ms;;;; rtmin=0.422ms;;;;"> <properties/> </service> <service id="51" appType="NAGIOS" description="icmp_ping_alive" monitorStatus="OK" lastCheckTime="2013-05-22T10:42:02.000-0600" nextCheckTime="2013-05-22T10:52:02.000-0600" lastStateChange="2013-05-17T10:32:02.000-0600" hostName="qa-rh6-64-2" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="172.28.113.167" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 10:32:02 AM^^^OK - 172.28.113.167: rta 1.064ms, lost 0%^^^rta=1.064ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=1.064ms;;;; rtmin=1.064ms;;;;"> <properties/> </service> <service id="44" appType="NAGIOS" description="icmp_ping_alive" monitorStatus="OK" lastCheckTime="2013-05-22T10:37:46.000-0600" nextCheckTime="2013-05-22T10:47:46.000-0600" lastStateChange="2013-05-17T10:27:46.000-0600" hostName="qa-sles-11-64-2" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="172.28.113.150" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 10:27:46 AM^^^OK - 172.28.113.150: rta 0.038ms, lost 0%^^^rta=0.036ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=0.036ms;;;; rtmin=0.036ms;;;;"> <properties/> </service> <service id="47" appType="NAGIOS" description="icmp_ping_alive" monitorStatus="OK" lastCheckTime="2013-05-22T10:39:59.000-0600" nextCheckTime="2013-05-22T10:49:59.000-0600" lastStateChange="2013-05-17T23:59:59.000-0600" hostName="do-win7-1" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="172.28.113.152" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 11:59:59 PM^^^OK - 172.28.113.152: rta 0.702ms, lost 0%^^^rta=0.702ms;3000.000;5000.000;0; pl=0%;80;100;; rtmax=0.702ms;;;; rtmin=0.702ms;;;;"> <properties/> </service> <service id="67" appType="NAGIOS" description="snmp_if_19" monitorStatus="OK" lastCheckTime="2013-05-22T10:37:56.000-0600" nextCheckTime="2013-05-22T10:47:56.000-0600" lastStateChange="2013-05-17T10:27:55.000-0600" hostName="sql-2008" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="172.28.113.156" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 10:27:55 AM^^^SNMP OK - 0 0 0 0 0 0^^^IF-MIB::ifInOctets.19=0c IF-MIB::ifOutOctets.19=0c IF-MIB::ifInDiscards.19=0c IF-MIB::ifOutDiscards.19=0c IF-MIB::ifInErrors.19=0c IF-MIB::ifOutErrors.19=0c"> <properties/> </service> </services> </serviceGroup> </serviceGroups>
1.21.3 Retrieve Service Groups by Query (encoded)
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/servicegroups?query=name%20like%20%27SG-%25%27%20order%20by%20name%20asc&first=0&count=1"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/servicegroups?query=name%20like%20%27SG-%25%27%20order%20by%20name%20asc&first=0&count=1"
Results, (service properties elided here for the sake of brevity):
{ "serviceGroups" : [ { "id" : 29, "name" : "SG-200", "description" : "Service Group 200", "appType" : "VEMA", "appTypeDisplayName" : "VEMA", "agentId" : "Agent-007", "services" : [ { "properties" : { }, "id" : 2, "appType" : "NAGIOS", "description" : "local_cpu_java", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:37:15.000-0600", "nextCheckTime" : "2013-05-22T10:47:15.000-0600", "lastStateChange" : "2013-05-17T08:57:15.000-0600", "hostName" : "localhost", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "127.0.0.1", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 08:57:15 AM^^^OK - total %CPU for process java : 2.8^^^%CPU=2.8;40;50" }, { "properties" : { }, "id" : 4, "appType" : "NAGIOS", "description" : "local_cpu_perl", "monitorStatus" : "OK", "lastCheckTime" : "2013-05-22T10:36:13.000-0600", "nextCheckTime" : "2013-05-22T10:46:13.000-0600", "lastStateChange" : "2013-05-17T08:46:12.000-0600", "hostName" : "localhost", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "monitorServer" : "localhost", "deviceIdentification" : "127.0.0.1", "lastPlugInOutput" : "1^^^3^^^0^^^05/17/2013 08:46:12 AM^^^OK - total %CPU for process perl : 0.7^^^%CPU=0.7;40;50" } ] } ] }
<serviceGroups> <serviceGroup id="30" name="SG-200" description="Service Group 200" appType="VEMA" appTypeDisplayName="VEMA" agentId="Agent-007"> <services> <service id="2" appType="NAGIOS" description="local_cpu_java" monitorStatus="OK" lastCheckTime="2013-05-22T10:37:15.000-0600" nextCheckTime="2013-05-22T10:47:15.000-0600" lastStateChange="2013-05-17T08:57:15.000-0600" hostName="localhost" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="127.0.0.1" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 08:57:15 AM^^^OK - total %CPU for process java : 2.8^^^%CPU=2.8;40;50"> <properties/> </service> <service id="4" appType="NAGIOS" description="local_cpu_perl" monitorStatus="OK" lastCheckTime="2013-05-22T10:36:13.000-0600" nextCheckTime="2013-05-22T10:46:13.000-0600" lastStateChange="2013-05-17T08:46:12.000-0600" hostName="localhost" stateType="HARD" checkType="ACTIVE" lastHardState="PENDING" monitorServer="localhost" deviceIdentification="127.0.0.1" lastPlugInOutput="1^^^3^^^0^^^05/17/2013 08:46:12 AM^^^OK - total %CPU for process perl : 0.7^^^%CPU=0.7;40;50"> <properties/> </service> </services> </serviceGroup> </serviceGroups>
1.21.4 Store Service Groups
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"serviceGroups" : [{"name" : "SG-200", "description" : "Service Group 200", "appType" : "VEMA", "agentId" : "Agent-007", "services" : [{"service" : "local_cpu_java", "host" : "localhost"}, {"service" : "local_cpu_perl", "host" : "localhost"}]}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/servicegroups"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<serviceGroups><serviceGroup name="SG-200" description="Service Group 200" appType="VEMA" agentId="Agent-007"><services><service service="local_cpu_java" host="localhost"/><service service="local_cpu_perl" host="localhost"/></services></serviceGroup></serviceGroups>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/servicegroups"
Results:
{ "successful" : 1, "failed" : 0, "entityType" : "ServiceGroup", "operation" : "Update", "warning" : 0, "results" : [ { "entity" : "SG-200", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/servicegroups/SG-200" } ], "count" : 1 }
<results successful="1" failed="0" entityType="ServiceGroup" operation="Update" warning="0" count="1"> <result> <entity>SG-200</entity> <location>http://localhost:8080/foundation-webapp/api/servicegroups/SG-200</location> <status>success</status> </result> </results>
1.21.5 Add/Delete Service Group Members
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '{"name" : "SG-200", "services" : [{"service" : "local_load", "host" : "localhost"}, {"service" : "local_users", "host" : "localhost"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/servicegroups/addmembers"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '{"name" : "SG-200", "services" : [{"service" : "local_load", "host" : "localhost"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/servicegroups/deletemembers"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '<serviceGroup name="SG-200"><services><service service="local_load" host="localhost"/><service service="local_users" host="localhost"/></services></serviceGroup>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/servicegroups/addmembers"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X PUT -d '<serviceGroup name="SG-200"><services><service service="local_load" host="localhost"/></services></serviceGroup>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/servicegroups/deletemembers"
Results:
{ "successful" : 1, "failed" : 0, "entityType" : "ServiceGroup", "operation" : "Update", "warning" : 0, "results" : [ { "entity" : "SG-200", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/servicegroups/SG-200" } ], "count" : 1 }
<results successful="1" failed="0" entityType="ServiceGroup" operation="Update" warning="0" count="1"> <result> <entity>SG-200</entity> <location>http://localhost:8080/foundation-webapp/api/servicegroups/SG-200</location> <status>success</status> </result> </results>
1.21.6 Delete Service Groups
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X DELETE -d '{"serviceGroups" : [{"name" : "SG-200"}]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/servicegroups"
curl -s -H "GWOS-API-TOKEN:b94aa48e-fbc5-4423-b4a8-68162599347f" -H "GWOS-APP-NAME:cloudhub" -X DELETE -d '<serviceGroups><serviceGroup name="SG-200"/></serviceGroups>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/servicegroups"
Results:
{ "successful" : 1, "failed" : 0, "entityType" : "ServiceGroup", "operation" : "Delete", "warning" : 0, "results" : [ { "entity" : "SG-200", "status" : "success", "message" : "Service Group SG-200 deleted." } ], "count" : 1 }
<results successful="1" failed="0" entityType="ServiceGroup" operation="Delete" warning="0" count="1"> <result> <entity>SG-200</entity> <message>Service Group SG-200 deleted.</message> <status>success</status> </result> </results>
1.21.7 Service Group Autocomplete Using JSON
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/foundation-webapp/api/servicegroups/autocomplete/SG"
JSON Response:
{ "names" : [ "SG1", "SG2" ] }
1.22 Biz Service Authorization Examples with Curl
1.22.1 Get Authorized Services Using XML
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '<bizAuthorization><hostGroupNames><hostGroupName>Linux Servers</hostGroupName></hostGroupNames></bizAuthorization>' -H "Content-Type: application/xml" -H "Accept: application/xml" "http://localhost:8080/foundation-webapp/api/biz/getauthorizedservices"
XML Response:
<bizAuthorizedServices> <hostNames> <hostName>localhost</hostName> </hostNames> <serviceHostNames> <serviceHostMap> <serviceHostMapEntry serviceName="local_cpu_httpd"> <hostNames> <hostName>localhost</hostName> </hostNames> </serviceHostMapEntry> <serviceHostMapEntry serviceName="local_cpu_java"> <hostNames> <hostName>localhost</hostName> </hostNames> </serviceHostMapEntry> <serviceHostMapEntry serviceName="local_cpu_syslog-ng"> <hostNames> <hostName>localhost</hostName> </hostNames> </serviceHostMapEntry> <serviceHostMapEntry serviceName="local_swap"> <hostNames> <hostName>localhost</hostName> </hostNames> </serviceHostMapEntry> <serviceHostMapEntry serviceName="local_process_nagios"> <hostNames> <hostName>localhost</hostName> </hostNames> </serviceHostMapEntry> <serviceHostMapEntry serviceName="tcp_http"> <hostNames> <hostName>localhost</hostName> </hostNames> </serviceHostMapEntry> </serviceHostMap> </serviceHostNames> </bizAuthorizedServices>
1.22.2 Get Authorized Services Using JSON
curl -s -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -X POST -d '{"hostGroupNames":["Linux Servers"], "serviceGroupNames":["local"]}' -H "Content-Type: application/json" -H "Accept: application/json" "http://localhost:8080/foundation-webapp/api/biz/getauthorizedservices"
JSON Response:
{ "hostNames" : [ "localhost" ], "serviceHostNames" : { "local_cpu_httpd" : [ "localhost" ], "local_cpu_java" : [ "localhost" ], "local_cpu_syslog-ng" : [ "localhost" ], "local_swap" : [ "localhost" ], "local_process_nagios" : [ "localhost" ], "tcp_http" : [ "localhost" ] } }
1.23 Suggestions Examples with Curl
1.23.1 Get Suggestions Query Using XML
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/suggestions/query/SERVICE/local*?limit=3"
XML Results:
<suggestions count="18"> <suggestions> <suggestion name="local_cpu_httpd" entityType="SERVICE"/> <suggestion name="local_cpu_java" entityType="SERVICE"/> <suggestion name="local_cpu_nagios" entityType="SERVICE"/> </suggestions> </suggestions>
1.23.2 Get Suggestions Services Using JSON
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/json" "http://localhost/foundation-webapp/api/suggestions/services/localhost"
JSON Results:
{ "names" : [ "local_cpu_httpd", "local_cpu_java", "local_cpu_nagios", "local_cpu_perl" ] }
1.23.3 Get Suggestions Hosts Using XML
curl -H "GWOS-API-TOKEN:782602F4FA6BE7B4D48CE31691BFDA60" -H "GWOS-APP-NAME:cloudhub" -H "Accept: application/xml" "http://localhost/foundation-webapp/api/suggestions/hosts/local_cpu_httpd"
XML Results:
<names> <name>localhost</name> </names>
1.24 License Check Examples with Curl
1.24.1 License Check Using XML
curl -H GWOS-API-TOKEN:5f71df72-9e0f-4f70-9143-d7c562d9ccec -H GWOS-APP-NAME:cloudhub -H 'Accept: application/xml' 'http://localhost:8080/foundation-webapp/api/license/check?allocate=5'
XML Results:
<licenseCheck success="true" message="OK to allocate 5 devices" devicesRequested="5" devices="1"/>
1.24.2 License Check Using JSON
curl -H GWOS-API-TOKEN:5f71df72-9e0f-4f70-9143-d7c562d9ccec -H GWOS-APP-NAME:cloudhub -H 'Accept: application/json' http://localhost:8080/foundation-webapp/api/license/check
JSON Results:
{ "success" : true, "message" : "OK to allocate 0 devices", "devicesRequested" : 0, "devices" : 1 }
1.25 Biz Feeder Examples with Curl
1.25.1 Create or Update Host Returning XML
curl -H GWOS-API-TOKEN:5f71df72-9e0f-4f70-9143-d7c562d9ccec -H GWOS-APP-NAME:cloudhub -H 'Accept: application/xml' -X POST -d 'message=PENDING+-+new&host=host5&status=PENDING&device=10.0.0.5&agentId=a4ca80e0-e855-43ee-86d8-f4e499f0a824&hostGroup=hosts&appType=NAGIOS' 'http://localhost:8080/foundation-webapp/api/biz/host'
XML Results:
<host id="7" hostName="host5" description="host5" monitorStatus="PENDING" appType="NAGIOS" deviceIdentification="10.0.0.5" deviceDisplayName="10.0.0.5" lastCheckTime="2016-01-04T23:42:29.588-0700" nextCheckTime="2016-01-04T23:47:29.588-0700" bubbleUpStatus="PENDING" serviceAvailability="0" acknowledged="false" agentId="a4ca80e0-e855-43ee-86d8-f4e499f0a824" serviceCount="0" stateType="HARD" checkType="ACTIVE" lastPlugInOutput="-1^^^-1^^^-1^^^01/01/1970 12:00:00 AM^^^PENDING - new^^^01/04/2016 11:47:29 PM"> <properties> <property name="LastPluginOutput" value="PENDING - new"/> </properties> <device id="6" displayName="10.0.0.5" identification="10.0.0.5"/> <hostStatus hostStatusId="7" lastCheckTime="2016-01-04T23:42:29.588-0700" nextCheckTime="2016-01-04T23:47:29.588-0700"> <monitorStatus monitorStatusId="5" name="PENDING" description="PENDING"/> <checkType checkTypeId="1" name="ACTIVE" description="Active Check"/> <stateType> <stateTypeId>2</stateTypeId> <name>HARD</name> <description>State Hard</description> </stateType> </hostStatus> <hostGroups> <hostGroup id="6" name="hosts" appType="NAGIOS"/> </hostGroups> <applicationType id="100" name="NAGIOS" description="System monitored by Nagios" stateTransitionCriteria="Device;Host;ServiceDescription"/> </host>
1.25.2 Create or Update Service Returning JSON
curl -H GWOS-API-TOKEN:5f71df72-9e0f-4f70-9143-d7c562d9ccec -H GWOS-APP-NAME:cloudhub -H 'Accept: application/json' -X POST -d 'message=PENDING+-+new&host=host5&status=PENDING&serviceGroup=cpu&device=10.0.0.5&service=local_cpu_httpd&agentId=a4ca80e0-e855-43ee-86d8-f4e499f0a824&hostGroup=hosts&appType=NAGIOS' 'http://localhost:8080/foundation-webapp/api/biz/service'
JSON Results:
{ "properties" : { "LastPluginOutput" : "PENDING - new" }, "id" : 89, "appType" : "NAGIOS", "description" : "local_cpu_httpd", "monitorStatus" : "PENDING", "lastCheckTime" : "2016-01-04T23:42:31.000-0700", "nextCheckTime" : "2016-01-04T23:47:31.000-0700", "hostName" : "host5", "stateType" : "HARD", "checkType" : "ACTIVE", "lastHardState" : "PENDING", "agentId" : "a4ca80e0-e855-43ee-86d8-f4e499f0a824", "monitorServer" : "localhost", "deviceIdentification" : "10.0.0.5", "lastPlugInOutput" : "-1^^^-1^^^-1^^^01/01/1970 12:00:00 AM^^^PENDING - new^^^NA" }
1.25.3 Create or Update Hosts Using XML
curl -H GWOS-API-TOKEN:5f71df72-9e0f-4f70-9143-d7c562d9ccec -H GWOS-APP-NAME:cloudhub -H 'Accept: application/xml' -X POST -H 'Content-Type: application/xml' -d '<hosts><host host="host6" status="UP" message="UP" hostGroup="hosts" device="10.0.0.6" appType="NAGIOS" agentId="a4ca80e0-e855-43ee-86d8-f4e499f0a824" checkIntervalMinutes="5" allowInserts="true" mergeHosts="true" setStatusOnCreate="true"><services><service host="host6" service="local_cpu_httpd" status="OK" message="OK - 10" serviceGroup="cpu" hostGroup="hosts" device="10.0.0.6" appType="NAGIOS" agentId="a4ca80e0-e855-43ee-86d8-f4e499f0a824" serviceValue="10" metricType="vm" warningLevel="50" criticalLevel="90" checkIntervalMinutes="5" allowInserts="true" mergeHosts="true" setStatusOnCreate="true"/><service host="host6" service="local_cpu_java" status="OK" message="OK - 20" serviceGroup="cpu" hostGroup="hosts" device="10.0.0.6" appType="NAGIOS" agentId="a4ca80e0-e855-43ee-86d8-f4e499f0a824" serviceValue="20" metricType="vm" warningLevel="75" criticalLevel="90" checkIntervalMinutes="5" allowInserts="true" mergeHosts="true" setStatusOnCreate="true"/></services></host></hosts>' 'http://localhost:8080/foundation-webapp/api/biz/hosts'
XML Results:
<results successful="3" failed="0" entityType="Host" operation="Update" warning="0" count="3"> <result> <entity>host6</entity> <location>http://localhost:8080/foundation-webapp/api/hosts/host6</location> <status>success</status> <message>Update</message> </result> <result> <entity>host6:local_cpu_httpd</entity> <location>http://localhost:8080/foundation-webapp/api/services/local_cpu_httpd%3FhostName=host6</location> <status>success</status> <message>Update</message> </result> <result> <entity>host6:local_cpu_java</entity> <location>http://localhost:8080/foundation-webapp/api/services/local_cpu_java%3FhostName=host6</location> <status>success</status> <message>Update</message> </result> </results>
1.25.4 Create or Update Hosts Using JSON
curl -H GWOS-API-TOKEN:5f71df72-9e0f-4f70-9143-d7c562d9ccec -H GWOS-APP-NAME:cloudhub -H 'Accept: application/json' -X POST -H 'Content-Type: application/json' -d '{ "hosts" : [ { "properties" : {}, "host" : "host6", "status" : "UP", "message" : "UP", "hostGroup" : "hosts", "device" : "10.0.0.6", "appType" : "NAGIOS", "agentId" : "a4ca80e0-e855-43ee-86d8-f4e499f0a824", "checkIntervalMinutes" : 5, "allowInserts" : true, "mergeHosts" : true, "setStatusOnCreate" : true, "services" : [ { "properties" : {}, "host" : "host6", "service" : "local_cpu_httpd", "status" : "OK", "message" : "OK - 10", "serviceGroup" : "cpu", "hostGroup" : "hosts", "device" : "10.0.0.6", "appType" : "NAGIOS", "agentId" : "a4ca80e0-e855-43ee-86d8-f4e499f0a824", "serviceValue" : "10", "metricType" : "vm", "warningLevel" : 50, "criticalLevel" : 90, "checkIntervalMinutes" : 5, "allowInserts" : true, "mergeHosts" : true, "setStatusOnCreate" : true }, { "properties" : {}, "host" : "host6", "service" : "local_cpu_java", "status" : "OK", "message" : "OK - 20", "serviceGroup" : "cpu", "hostGroup" : "hosts", "device" : "10.0.0.6", "appType" : "NAGIOS", "agentId" : "a4ca80e0-e855-43ee-86d8-f4e499f0a824", "serviceValue" : "20", "metricType" : "vm", "warningLevel" : 75, "criticalLevel" : 90, "checkIntervalMinutes" : 5, "allowInserts" : true, "mergeHosts" : true, "setStatusOnCreate" : true } ] } ] }' 'http://localhost:8080/foundation-webapp/api/biz/hosts'
JSON Results:
{ "successful" : 3, "failed" : 0, "entityType" : "Host", "operation" : "Update", "warning" : 0, "results" : [ { "entity" : "host6", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/hosts/host6", "message" : "Update" }, { "entity" : "host6:local_cpu_httpd", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/services/local_cpu_httpd%3FhostName=host6", "message" : "Update" }, { "entity" : "host6:local_cpu_java", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/services/local_cpu_java%3FhostName=host6", "message" : "Update" } ], "count" : 3 }
1.25.5 Create or Update Services Using JSON
curl -H GWOS-API-TOKEN:5f71df72-9e0f-4f70-9143-d7c562d9ccec -H GWOS-APP-NAME:cloudhub -H 'Accept: application/json' -X POST -H 'Content-Type: application/json' -d '{"services" : [ { "properties" : {}, "host" : "host6", "service" : "local_cpu_httpd", "status" : "PENDING", "message" : "PENDING - new", "serviceGroup" : "cpu", "hostGroup" : "hosts", "device" : "10.0.0.6", "appType" : "NAGIOS", "agentId" : "a4ca80e0-e855-43ee-86d8-f4e499f0a824", "warningLevel" : -1, "criticalLevel" : -1, "checkIntervalMinutes" : 5, "allowInserts" : true, "mergeHosts" : true, "setStatusOnCreate" : false }, { "properties" : {}, "host" : "host6", "service" : "local_cpu_java", "status" : "PENDING", "message" : "PENDING - new", "serviceGroup" : "cpu", "hostGroup" : "hosts", "device" : "10.0.0.6", "appType" : "NAGIOS", "agentId" : "a4ca80e0-e855-43ee-86d8-f4e499f0a824", "warningLevel" : -1, "criticalLevel" : -1, "checkIntervalMinutes" : 5, "allowInserts" : true, "mergeHosts" : true, "setStatusOnCreate" : false } ] }' 'http://localhost:8080/foundation-webapp/api/biz/services'
XML Results:
{ "successful" : 3, "failed" : 0, "entityType" : "ServiceStatus", "operation" : "Update", "warning" : 0, "results" : [ { "entity" : "host6", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/hosts/host6", "message" : "Insert" }, { "entity" : "host6:local_cpu_httpd", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/services/local_cpu_httpd%3FhostName=host6", "message" : "Insert" }, { "entity" : "host6:local_cpu_java", "status" : "success", "location" : "http://localhost:8080/foundation-webapp/api/services/local_cpu_java%3FhostName=host6", "message" : "Insert" } ], "count" : 3 }