GET all custom properties of entity, nodes and appmonitors

Hey There, I'm trying to workaround the way to get all the custom properties of a node, or an appmonitor. Why? Well... Custom Properties are not static in the place I work, we change them every now and then and I would like to get all of them without specifying which ones, since SWQL doesn't admit the SELECT * FROM clause I'm pretty fried... I've been evaluating the possibility to get de metadata of custom properties and getting that way all the names of the properties and creating a query from that list of names and then generating that query, seems pretty awful, does anyone have a better idea about how to implement this? 

Thanks in advance!

Fran.

Parents
  • I can think of 2 ways to get this done @frn  

    First, use the 'Manage Custom Properties page'. You can export all the values in addition to just getting the fields. You can also update them in the exported file and import them back in if needed. 

    Then there is SWQL studio in the SDK. When you use 'Generate Select Statment' it provides the entire list of possible fields for you. 

    Let me know if that helps

  • Hey! Thanks for your reply, this is really good info but just not what I was looking for. In my case I'm querying from nodeJS via the implementation SDK in that language, I'm currently using sth like this:

    'SELECT \
          nodeName, \
          ipAddress, \
          NodeID, \
          Nodes.CustomProperties.primarycontact as [contact], \
          Nodes.CustomProperties.env as [environment], \
          Nodes.CustomProperties.priority as [impact], \
          uri as [orion_uri], \
          objectSubType as [orion_objectSubType], \
          community as [orion_community] \
          from Orion.Nodes WHERE nodeName = @node OR ipAddress = @node'

    But I will like to get all customs properties like:
    SELECT * FROM Orion.NodesCustomProperties WHERE... 
     
    I hope this helps to explain myself better!
    Thanks again for your reply!
  • I follow, and you will have to get the properties ahead of time I believe. So maybe do a query like: 

    SELECT Field FROM Orion.CustomProperty Where TargetEntity = 'Orion.NodesCustomProperties'
    And use Javascript to build the query you need. 
  • Probably, that's pretty ugly to do but it seems the only way right now. Thanks a lot! I will leave the post open for a few days so maybe someone has any other ideas, meanwhile I will implement this.

  • There won't be another way, they wanted to discourage select * from SWQL so they don't allow it, and they also don't support pivots/unpivot, https://github.com/solarwinds/OrionSDK/wiki/SWQL-Functions .  so the only other way you could do something similar in SQL would be declaring variables and creating dynamic SQL (also not allowed in SWQL), but if you are building a query on the fly then doing it in javascript is functionally the same thing.

  • Thanks for your answer! There where all very helpful. I have found a solution:

    First getting de node URI via a query, after that I'm using GET to this uri 

    swis://hostname/Orion/Orion.Nodes/NodeID=1/CustomProperties

    This way a get some extra information which I can delete and I save time of making that custom query.
    Thanks again for your answers!
Reply
  • Thanks for your answer! There where all very helpful. I have found a solution:

    First getting de node URI via a query, after that I'm using GET to this uri 

    swis://hostname/Orion/Orion.Nodes/NodeID=1/CustomProperties

    This way a get some extra information which I can delete and I save time of making that custom query.
    Thanks again for your answers!
Children
No Data