ahmed bouliche (Customer) asked a question.

how to create an monitor using whatsup gold api v1

I am want to create a TCPIP monitor active monitor using the API.

 

i am sending a PATCH request to the endpoint "http://localhost:9644/api/v1/monitors/-/config/template", and the data i am sending in the body of the request is this:

 

  1. {
  2.  
  3. "activeMonitors": [
  4.  
  5. {
  6.  
  7. "useInDiscovery": true,
  8.  
  9. "templateId": "",
  10.  
  11. "monitorTypeInfo": {
  12.  
  13. "name": "TCPIP Monitor",
  14.  
  15. "classId": "",
  16.  
  17. "requiredCredentials": [
  18.  
  19. ""
  20.  
  21. ],
  22.  
  23. "baseType": "active",
  24.  
  25. "assemblyName": "",
  26.  
  27. "manufacturer": "",
  28.  
  29. "plugInName": ""
  30.  
  31. },
  32.  
  33. "monitorId": "26",
  34.  
  35. "displayName": "My_Test_Monitor",
  36.  
  37. "description": "Monitor testing",
  38.  
  39. "propertyBags": [
  40.  
  41. {
  42.  
  43. "name": "",
  44.  
  45. "value": ""
  46.  
  47. }
  48.  
  49. ]
  50.  
  51. }
  52.  
  53. ],
  54.  
  55. "performanceMonitors": [],
  56.  
  57. "passiveMonitors": []
  58.  
  59. }
  60.  
  61.  

 

 

The error i am getting is this:

  1. {
  2.  
  3. "data": {
  4.  
  5. "idMap": [],
  6.  
  7. "errors": [
  8.  
  9. {
  10.  
  11. "templateId": "Active: 1",
  12.  
  13. "messages": [
  14.  
  15. "'displayName' cannot be empty, not created"
  16.  
  17. ]
  18.  
  19. }
  20.  
  21. ]
  22.  
  23. }
  24.  
  25. }

 

 

as you can see the display name is not empty in the data sent in the body of the request. why am i getting this error?


  • Mike Rockwell (Progress Software)

    If you are using the Swagger, and the "example" json data contains a LOT of data which may or may not be needed. IF you are only adding an "Active" monitor, you DO NOT need the "performanceMonitors": [], "passiveMonitors": [] because it "needs" data for those if you are entering them. Also it looks like the example is wrong, it is not DISPLAY NAME, it's just Name (go figure) Here is an example json to add a new TCP monitor on port 8080

     

    1. {
    2. "activeMonitors": [
    3. {
    4. "useInDiscovery": true,
    5. "monitorTypeInfo": {
    6. "classId": "1ee6ecd4-4c17-4ccc-8ff8-3147f445943f",
    7. "baseType": "Active"
    8. },
    9. "propertyBags": [
    10. {
    11. "name": "Port",
    12. "value": "8080"
    13. },
    14. {
    15. "name": "Protocol",
    16. "value": "TCP"
    17. },
    18. {
    19. "name": "Timeout",
    20. "value": "5"
    21. }
    22. ],
    23. "name": "My_Test_TCP",
    24. "description": "This is a test"
    25. }
    26. ]
    27. }

    I got the class ID from doing a "GET" on the template to see that the ID for TCP monitors are.

     

  • ahmed bouliche (Customer)

    It's working. Now i am trying to create a interface utilization performance monitor using the api. When i run get requests to get an idea of what parameters to pass in the body, I don't find any performance monitors in the response eventhough i have a couple of performance monitors for some device.

     

    How can i get the performance monitors i created using the UI? and how can i create a Interface Utilization Performance monitor using the api?

  • Mike Rockwell (Progress Software)

    use the "...:9644/api/v1/monitors/-?type=active" link to show all active monitors. There is also the search function to look for specified text in the display name, description or classId.

  • ahmed bouliche (Customer)

    I tried the endpoint with the parameter type to "performance" ("localhost:9644/api/v1/monitors/-?type=performance"). I get no result for the performance monitors.

  • Mike Rockwell (Progress Software)

    hmmm, when I run mine, I get 8 returned.

     

    "paging": {

    "pageId": "0",

    "size": 8

  • ahmed bouliche (Customer)

    Thanks a lot for your patience. I created an SNMP performance monitor using both the UI and the api. for the API, I sent a PATCH request to the endpoint "http://localhost:9644/api/v1/monitors/-/config/template" With the following request body:

    1. {
    2. "performanceMonitors": [
    3. {
    4. "monitorTypeInfo": {
    5. "classId": "2f300544-cba3-4341-9b05-2d1786f68e07",
    6. "baseType": "Performance"
    7. },
    8. "propertyBags": [
    9. {
    10. "name": "SNMP:OID",
    11. "value": "1.3.6.1"
    12. },
    13. {
    14. "name": "SNMP:Instance",
    15. "value": "0"
    16. },
    17. {
    18. "name": "SNMP:UseRawValues",
    19. "value": "0"
    20. },
    21. {
    22. "name": "SNMP:Retries",
    23. "value": "1"
    24. },
    25. {
    26. "name": "SNMP:Timeout",
    27. "value": "3"
    28. }
    29. ],
    30. "name": "another_test_performance_monitor",
    31. "description": "Enables Custom Performance Monitor reports"
    32. }
    33. ]
    34. }

    I got the classId from executing GET request to the endpoint "http://localhost:9644/api/v1/monitors/6/config/template?type=performance" after i created the SNMP performance monitor in the UI. I was confusing creating a monitor and adding them to a device.

  • Mike Rockwell (Progress Software)

    The "patch" is for editing, Put creates, Get returned info.

  • ahmed bouliche (Customer)

    with GET method i have to add a parameter "?deviceId=43" for example, but for PUT method, I get a 405 NOT ALLOWED error saying:

    1. {
    2. "message": "The requested resource does not support http method 'PUT'."
    3. }

    Is there a parameter i should add or should i change something in the body of the request?

    • Mike Rockwell (Progress Software)

      Are you adding a monitor directly to the device, or trying to add it to the Monitor Library?

  • ahmed bouliche (Customer)

    I am trying to add it to the monitors library and then adding it to the device.

10 of 11