Sign In with your
Trend Micro Account
Need Help?
Need More Help?

Create a technical support case if you need further support.

Using REST API to query Tenant protection usage in Deep Security 9.0

    • Updated:
    • 12 Feb 2015
    • Product/Version:
    • Deep Security 9.0
    • Platform:
    • Linux - Red Hat RHEL 5 64-bit
    • Linux - Red Hat RHEL 6 64-bit
    • Windows 2003 Enterprise 64-bit
    • Windows 2008 Enterprise 64-bit
    • Windows 2008 Server R2
    • Windows 2012 Enterprise
Summary

You would like to charge each Tenant according to database usage and protection time. Use REST API to query this information in Deep Security 9.0.

Details
Public

When querying database usage and hours of protection, you can pass the following parameters:

  • sID - session identifier (required)
  • tenantName - name of the Tenant to query (optional)
  • tID - the ID of the Tenant for which host protection information will be retrieved (optional)
  • from - the start date from which usage data will be gathered. If not specified, data from the last hour will be used.
  • to - the date up to which usage data will be gathered. If not specified, the current server time will be used.
 
If neither tenantName nor tID is specified, host protection information for all tenants will be retrieved. If both are specified, tID will be used over tenantName.

To query using REST API:

  1. Log in to DSM using REST API by entering the following URL:

    https://<DSM IP address>:4119/rest/authentication/login

  2. Type “Application/xml” on the Content Type field.
  3. Type the following entries in the field under Content Options:

    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    <dsCredentials>
    <password>P@ssw0rd</password>
    <tenantName></tenantName>
    <userName>WebService</userName>
    </dsCredentials>

  4. Under Actions, click POST button.
    The following should appear with “200 OK” status and session ID. In our example, the session ID is 236DEDC9A5AA870481636CE9ED3B7388:

Access "https://<DSM IP address>:4119/rest/tenants?sID=<session ID>".

For example:

https://192.254.254.254:4119/rest/tenants?sID=236DEDC9A5AA870481636CE9ED3B7388

You will see results similar to the following:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <tenantListing>
- <tenants>
  <agentInitiatedActivationPassword>2B50058B-7225-F320-0289-81774BEAFDE9</agentInitiatedActivationPassword>
  <allModulesVisible>true</allModulesVisible>
  <country>US</country>
  <databaseServerID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
  <demoMode>false</demoMode>
  <description />
  <guid>6906099B-6E44-CE89-25FA-7271F47D180E</guid>
  <hideUnlicensedModules>false</hideUnlicensedModules>
  <language>en</language>
  <name>aaron</name>
  <state>ACTIVE</state>
  <tenantID>1</tenantID>
  <timeZone>Asia/Shanghai</timeZone>
  </tenants>
  </tenantListing>

The Tenant ID is 1.

Query the hours of protection using "https://<DSM IP address>:4119/rest/monitoring/usages/hosts/protection?sID=<session ID>&from=<start date and time>&to=<stop date and time>&tID=<Tenant ID>".

For example:

https://192.254.254.254:4119/rest/monitoring/usages/hosts/protection?sID=236DEDC9A5AA870481636CE9ED3B7388&from=3 Jun 2014 00:00&to=3 Jun 2014 23:59:59&tID=1

You will get the following result:

  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <TenantHostProtectionListing>
  <hostID1Type>HOSTNAME</hostID1Type>
  <hostID2Type>IPADDRESS</hostID2Type>
  <hostID3Type>OS</hostID3Type>
- <TenantHostProtection>
  <hostID>4</hostID>
  <hostID1>192.xxx.xx.x</hostID1>
  <hostID2>192.xxx.xx.x</hostID2>
  <hostID3>Microsoft Windows Server 2008 R2 (64 bit) Service Pack 1 Build 7601</hostID3>
  <protectionStartDate>2014-06-03T19:03:36.320+08:00</protectionStartDate>
  <protectionStopDate>2014-06-03T19:57:16.933+08:00</protectionStopDate>

  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantHostProtection>
  </TenantHostProtectionListing>

Query the database usage using "https://<DSM IP address>:4119/rest/monitoring/usages/databases?sID=<session ID>&from=<start date and time>&to=<stop date and time>&tID=<Tenant ID>".

For example:

https://192.254.254.254:4119/rest/monitoring/usages/databases?sID=236DEDC9A5AA870481636CE9ED3B7388&from=3 Jun 2014 00:00&to=3 Jun 2014 23:59:59&tID=1

You will see details of the Tenant database usage:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <TenantDatabaseUsageListing>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T00:32:00.570+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T03:57:40.690+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T04:49:02.227+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T05:40:21.937+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T06:31:41.477+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T07:23:19.097+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T09:07:02.710+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T12:32:29.603+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T15:07:31.087+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T16:52:23.820+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>391118848</databaseSize>
  <sampleTime>2014-06-03T19:28:09.620+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>391118848</databaseSize>
  <sampleTime>2014-06-03T20:20:09.720+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>391118848</databaseSize>
  <sampleTime>2014-06-03T21:11:35.203+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>391118848</databaseSize>
  <sampleTime>2014-06-03T23:46:33.677+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T08:14:39.213+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T09:58:21.580+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T10:49:42.197+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T11:41:04.387+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>391118848</databaseSize>
  <sampleTime>2014-06-03T22:55:12.343+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T13:24:09.843+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T14:15:30.333+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T01:23:21.687+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T17:44:16.197+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>391118848</databaseSize>
  <sampleTime>2014-06-03T22:03:53.633+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T02:15:00.303+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T03:06:21.090+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T15:59:09.620+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
- <TenantDatabaseUsage>
  <databaseSize>390070272</databaseSize>
  <sampleTime>2014-06-03T18:36:10.307+08:00</sampleTime>
  <tenantID>1</tenantID>
  <tenantName>aaron</tenantName>
  </TenantDatabaseUsage>
  </TenantDatabaseUsageListing>

Premium
Internal
Rating:
Category:
Configure
Solution Id:
1103914
Feedback
Did this article help you?

Thank you for your feedback!

To help us improve the quality of this article, please leave your email here so we can clarify further your feedback, if neccessary:
We will not send you spam or share your email address.

*This form is automated system. General questions, technical, sales, and product-related issues submitted through this form will not be answered.

If you need additional help, you may try to contact the support team. Contact Support


To help us improve the quality of this article, please leave your email here so we can clarify further your feedback, if neccessary:
We will not send you spam or share your email address.

*This form is automated system. General questions, technical, sales, and product-related issues submitted through this form will not be answered.


Need More Help?

Create a technical support case if you need further support.