locked
Override values based on a discovered value RRS feed

  • Question

  • Hi All

    I am looking at a way to target a value in a registry key to act as the threshold value in an override.  Almost like a dynamic threshold value

    For example, I can create a discovery to include values in registry and store that in a property.  I then want to apply an override to that class/group for the Disk Space threshold value and have the value set as the value in the discovered property.

    So someone will update this reg value with 5 for example and that would be the threshold value override for their server.

    The idea being is that I can then do a kind of self service for Disk Space and let users control their disk threshold values without needing to touch the override packs.

    Anyone know how I would approach this?

    Thanks

    Andrew

    Wednesday, July 8, 2020 8:11 PM

All replies

  • I think I would create groups based on the registry key, and then overrides for these groups.

    You can do that using a scripted group discovery : https://janscman.wordpress.com/2012/11/27/dynamically-creating-groups/

    Or using native registry probe and a ClassAndRelationship mapper (in french only but you can still use the code fragment) : https://blog.piservices.fr/post/2020/07/06/SCOM-Creation-et-peuplement-dynamique-de-groupes-a-partir-dune-cle-de-registre-(le-retour-en-mieux) 

    Only issue with both solutions is that they not only populate the groups based on the registry key, but they also dynamically create the groups themselves : if one or more server have a given value for the registry key, the corresponding group is created and populated. 

    This is super convenient, but it has one caveat in your case : if no more server has that value, the group disappears and so the override becomes invalid.

    But to work around that issue, you could still create the groups as regular groups and only use these exemples to populate them.



    • Edited by CyrAz Wednesday, July 8, 2020 9:22 PM
    Wednesday, July 8, 2020 9:06 PM
  • Thanks for the reply.

    But how would I get the value from the registry key in to the override value, for example, Non-System Drive Warning Threshold = x (where x is the value retrieved from the registry key)?

    So I have my group with the values from the registry keys.  I now create an override for disk space and target that group but I have to enter a value for the threshold, where I want that value to be the value discovered.

    Andrew

    Wednesday, July 8, 2020 9:33 PM
  • Since there would be a group per value, you would need to create an override per group... that can be done very quickly with code snippets : https://kevinholman.com/2014/01/21/how-to-use-snippets-in-vsae-to-write-lots-of-workflows-quickly/
    • Edited by CyrAz Wednesday, July 8, 2020 9:58 PM
    Wednesday, July 8, 2020 9:58 PM
  • Hmm ok, might have to approach it differently then by way of a new rule.

    To create 100 Groups for each value from 1 to 100% would look a bit cluttered.

    Might be best to create a new rule and then mimic the base figures but then incorporate the reg key values dynamically if one exists.

    How I do that is another matter! :-)

    Just thought this would be a neat way of allowing some basic common threshold requests via a self service without impacting the pack itself.  One for next year I think!

    Thanks for your replies and ideas

    Andrew

    • Proposed as answer by PChip Friday, July 10, 2020 1:33 PM
    Thursday, July 9, 2020 9:51 AM
  • Indeed, recreating the rules and including the registry key check in the workflow would be a very good way of achieving this :)
    Thursday, July 9, 2020 10:04 AM
  • How I do that is another matter! :-)

    You may want to look at the ex MVA course now available on Channel9.  You can actually benefit from this as you can target the workflow to Windows Computer (or Windows Server) instead of a specific version of the OS.  So you will later only have 1 workflow to manage.

    Offhand, I would create the workflow as such: 

    Scheduler

    - Performance Probe

    - - Registry Probe

    - - - Condition Detection (compares the Perf to Registry)

    HTH, feel free to ask any questions while in your journey!

    Friday, July 10, 2020 1:53 PM
  • How I do that is another matter! :-)

    You may want to look at the ex MVA course now available on Channel9.  You can actually benefit from this as you can target the workflow to Windows Computer (or Windows Server) instead of a specific version of the OS.  So you will later only have 1 workflow to manage.

    Offhand, I would create the workflow as such: 

    Scheduler

    - Performance Probe

    - - Registry Probe

    - - - Condition Detection (compares the Perf to Registry)

    HTH, feel free to ask any questions while in your journey!

    That was my first idea as well but I'm not sure you can do perf probe > reg probe and keep the data from both in the workflow... If you can, that's defintiely the best solution.

    Otherwise you could create a custom logical disk class that inherits from the native one and extends it with a "threshold" attribute, discover that attribute with a registry probe and then use only a perf probe in the workflow and a $target$ expression in the condition detection to check the perf value against the registry threshold

    Friday, July 10, 2020 2:49 PM