This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to Parse a string in a rule condition

I have the need to take a string that is used as a Display Name for a database instance in Foglight for SQL Server and parse it.  For instance, the Display name might be something like C-Tier1-DatabaseInstance.   I am building a rule where I have the need to split the string in separate variables to build conditional statements.  What is the syntax to do something like this?

Parents
  • Hi,

    Assuming that you are working with Rule :  DBSS - Jobs Failed ...

    This rule uses the following topology type as scope : DBSS_Agent_Job_List

    So scope is of type DBSS_Agent_Job_List

     

     

    You can use the following code to take the host name of the database :

    scope.dbss_host.get("name")

     

     

    In General you can use the script console to write & test your code before applying to any rule :

    In your case :

    Open Script Console :

    Do a query for   !DBSS_Agent_Job_List

    Check your instances on the middle part,

    then select an instance of DBSS_Agent_Job_List and check it's properties on the bottom.

     

     

    Having selected an instance (this is your scope ! )

    You can create a new script  and write your code ...

    Press run and you can test it ...

     

     

    Regards

Reply
  • Hi,

    Assuming that you are working with Rule :  DBSS - Jobs Failed ...

    This rule uses the following topology type as scope : DBSS_Agent_Job_List

    So scope is of type DBSS_Agent_Job_List

     

     

    You can use the following code to take the host name of the database :

    scope.dbss_host.get("name")

     

     

    In General you can use the script console to write & test your code before applying to any rule :

    In your case :

    Open Script Console :

    Do a query for   !DBSS_Agent_Job_List

    Check your instances on the middle part,

    then select an instance of DBSS_Agent_Job_List and check it's properties on the bottom.

     

     

    Having selected an instance (this is your scope ! )

    You can create a new script  and write your code ...

    Press run and you can test it ...

     

     

    Regards

Children
No Data