Active IQ Unified Manager Discussions

REST interface for data source job status

jauling_chou
4,906 Views

We rely heavily on WFA and OCUM to manage our NetApp storage, from reporting to simple operational tasks.

 

Our WFA 4.1 Windows instance has a data source job that routinely pulls storage data from OCUM. This is pretty normal I think?

 

We rely heavily on this data source job, and we need to be sure it runs properly. I was wondering if anyone knew of a way to use REST to pull the data source job status from WFA? I know I can go to this URL, and it gets me a list of data sources that I've defined:

https://WFA_SERVER_NAME/rest/data_sources/

 

Here is an example of the OCUM data source from that URL:

 

<dataSource name="OCUM71RC1_PROD" schema="cm_storage">
   <type>OnCommand Unified Manager - 7.0,7.1 (MYSQL)</type>
   <ip>OCUM_SERVER_NAME</ip>
   <port>3306</port>
   <interval>5</interval>
   <atom:link rel="acquire" href="https://WFA_SERVER_NAME/rest/data_sources/OCUM71RC1_PROD/cm_storage/jobs"/>
   <atom:link rel="remove-data-source" href="https://WFA_SERVER_NAME/rest/data_sources/OCUM71RC1_PROD"/>
   <atom:link rel="edit-data-source" href="https://WFA_SERVER_NAME/rest/data_sources/OCUM71RC1_PROD"/>
   <atom:link rel="self" href="https://WFA_SERVER_NAME/rest/data_sources/OCUM71RC1_PROD/cm_storage"/>
   <atom:link rel="last_acquisition_jobs_by_type" href="https://WFA_SERVER_NAME/rest/data_sources/type/UID/jobs"/>
   <atom:link rel="data-source-type" href="https://WFA_SERVER_NAME/rest/data_source_types/UID"/>
   <atom:link rel="list" href="https://WFA_SERVER_NAME/rest/data_sources"/>
   <atom:link rel="acquire-data-source-by-name" href="https://WFA_SERVER_NAME/rest/data_sources/OCUM71RC1_PROD/jobs"/>
</dataSource>

 

I've obsfuscated some of the data above.

 

I took my browser and went through each of these hrefs, but couldn't find anything relavent to the data source job status. Does anyone know if this is exposed elsewhere?

 

 

1 ACCEPTED SOLUTION

mbeattie
4,830 Views

Hi,

 

Yes you can query the job status of a data source using the REST API.

Check the Swagger interfact for browsing the WFA REST API's using your browser:

 

https://<%wfa_server%>/rest/docs/

 

You first need to find the UUID of the datasource using:

 

https://<%wfa_server%>/rest/data_sources

 

find the datasource by name then get the UUID and pass that into the following URI.

 

https://<%wfa_server%>/rest/data_sources/type/<%uuid%>/jobs

 

If you click the "Try it out" button you can view the aquisition job and status for that datasource.

 

wfa_datasource_rest.png

 

EG for my environment the URI is:

 

https://wfa.testlab.local/rest/data_sources/type/d3483508-8a4a-42c3-aa78-112b317f2edf/jobs

 

The REST output is:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<collection xmlns:atom="http://www.w3.org/2005/Atom">
  <acquisitionJob jobId="29740">
    <jobStatus>
      <plannedExecution>21/02/2018 9:05:07 AM</plannedExecution>
      <startTime>21/02/2018 9:05:10 AM</startTime>
      <duration>6</duration>
      <scheduleType>Recurring</scheduleType>
      <status>COMPLETED</status>
    </jobStatus>
    <dataSource name="OCUM" schema="cm_storage">
      <type>OnCommand Unified Manager - 7.0,7.1 (MYSQL)</type>
      <ip>testoc71.testlab.local</ip>
      <port>3306</port>
      <interval>30</interval>
      <atom:link rel="acquire" href="https://wfa.testlab.local/rest/data_sources/OCUM/cm_storage/jobs"/>
      <atom:link rel="remove-data-source" href="https://wfa.testlab.local/rest/data_sources/OCUM"/>
      <atom:link rel="edit-data-source" href="https://wfa.testlab.local/rest/data_sources/OCUM"/>
      <atom:link rel="self" href="https://wfa.testlab.local/rest/data_sources/OCUM/cm_storage"/>
      <atom:link rel="last_acquisition_jobs_by_type" href="https://wfa.testlab.local/rest/data_sources/type/d3483508-8a4a-42c3-aa78-112b317f2edf/jobs"/>
      <atom:link rel="data-source-type" href="https://wfa.testlab.local/rest/data_source_types/d3483508-8a4a-42c3-aa78-112b317f2edf"/>
      <atom:link rel="list" href="https://wfa.testlab.local/rest/data_sources"/>
      <atom:link rel="acquire-data-source-by-name" href="https://wfa.testlab.local/rest/data_sources/OCUM/jobs"/>
    </dataSource>
    <atom:link rel="acquisition-job-by-name" href="https://wfa.testlab.local/rest/data_sources/OCUM/jobs/29740"/>
    <atom:link rel="self" href="https://wfa.testlab.local/rest/data_sources/OCUM/cm_storage/jobs/29740"/>
  </acquisitionJob>
</collection>

You could write a script or workflow (on a scheuduled basis) that alerts you if the datastore acquisition status is not 'completed'

 

Hope this helps

 

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

4 REPLIES 4

marz
4,901 Views

Unknown for the REST query, but you may configure a user (Administration > Users, right-click on the user and Edit or click to highlight and click the Pencil to edit) and set the Notify on: "Acquisition failure" checkbox.  WFA will send that user an email if acquisition fails.

NICKBARTON
4,855 Views

@jauling_chou

 

If you browse to the https://servername/rest/docs you get a pretty good dynamic layout of the REST information that is available in your current version. I believe you may be able to get what you are interested in through the:

/data_sources/{name}/{schema}/jobs/{job_id}

 

this will return an aquisitionJob element which contains parameters for start time, duration and status among other things. You will of course need to programatically determine the job_id you are after but that information is all attainable. 

 

 

-Nick

mbeattie
4,831 Views

Hi,

 

Yes you can query the job status of a data source using the REST API.

Check the Swagger interfact for browsing the WFA REST API's using your browser:

 

https://<%wfa_server%>/rest/docs/

 

You first need to find the UUID of the datasource using:

 

https://<%wfa_server%>/rest/data_sources

 

find the datasource by name then get the UUID and pass that into the following URI.

 

https://<%wfa_server%>/rest/data_sources/type/<%uuid%>/jobs

 

If you click the "Try it out" button you can view the aquisition job and status for that datasource.

 

wfa_datasource_rest.png

 

EG for my environment the URI is:

 

https://wfa.testlab.local/rest/data_sources/type/d3483508-8a4a-42c3-aa78-112b317f2edf/jobs

 

The REST output is:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<collection xmlns:atom="http://www.w3.org/2005/Atom">
  <acquisitionJob jobId="29740">
    <jobStatus>
      <plannedExecution>21/02/2018 9:05:07 AM</plannedExecution>
      <startTime>21/02/2018 9:05:10 AM</startTime>
      <duration>6</duration>
      <scheduleType>Recurring</scheduleType>
      <status>COMPLETED</status>
    </jobStatus>
    <dataSource name="OCUM" schema="cm_storage">
      <type>OnCommand Unified Manager - 7.0,7.1 (MYSQL)</type>
      <ip>testoc71.testlab.local</ip>
      <port>3306</port>
      <interval>30</interval>
      <atom:link rel="acquire" href="https://wfa.testlab.local/rest/data_sources/OCUM/cm_storage/jobs"/>
      <atom:link rel="remove-data-source" href="https://wfa.testlab.local/rest/data_sources/OCUM"/>
      <atom:link rel="edit-data-source" href="https://wfa.testlab.local/rest/data_sources/OCUM"/>
      <atom:link rel="self" href="https://wfa.testlab.local/rest/data_sources/OCUM/cm_storage"/>
      <atom:link rel="last_acquisition_jobs_by_type" href="https://wfa.testlab.local/rest/data_sources/type/d3483508-8a4a-42c3-aa78-112b317f2edf/jobs"/>
      <atom:link rel="data-source-type" href="https://wfa.testlab.local/rest/data_source_types/d3483508-8a4a-42c3-aa78-112b317f2edf"/>
      <atom:link rel="list" href="https://wfa.testlab.local/rest/data_sources"/>
      <atom:link rel="acquire-data-source-by-name" href="https://wfa.testlab.local/rest/data_sources/OCUM/jobs"/>
    </dataSource>
    <atom:link rel="acquisition-job-by-name" href="https://wfa.testlab.local/rest/data_sources/OCUM/jobs/29740"/>
    <atom:link rel="self" href="https://wfa.testlab.local/rest/data_sources/OCUM/cm_storage/jobs/29740"/>
  </acquisitionJob>
</collection>

You could write a script or workflow (on a scheuduled basis) that alerts you if the datastore acquisition status is not 'completed'

 

Hope this helps

 

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

jauling_chou
4,745 Views

Thanks everyone for the quick response to my question!

 

I admit, I did look at https://<%wfa_server%>/rest/data_sources/type/<%uuid%>/jobs, but for whatever reason, I failed to see the status field in the XML output. Thanks to @mbeattie for confirming that error messages are displayed too, which speeds troubleshooting.

 

I also took advice from @marz and also populated the email notification field for a user, which is the quickest way to get alerts for now, until I make use of the status URL.

 

Thanks again everyone!

Public