I am new to Solarwinds (and code/scripting in general) as an intern this summer.
I am trying to create a script as part of the remediation process for the local rules I am creating which can do two things.
1) if my string is not found at all in a device then I need the script to insert itself in
2) if my string is partially found, and therefor incorrect, for the old to be deleted and re-insert the correct script
I have set up all my rules to alert me when the string is incorrect and am trying to create a script to remediate. Is there a basic template that could be used to make this easy? Again I have limited experience with how this code works.
Thanks!
Example:
in my rule I set it to alert me when "logging host 10.10.58.10" string is not found in the nodes I set this for, say XX-1000-DC1. I need a remediation script that when I run it will insert in "logging host 10.10.58.10" into the config.
On a more complicated note, it would be preferred if there is a method of removing any incorrect script and replacing it with the correct one as well. Say my config already has "logging host 11.11.59.11" but I need it changed to "logging host 10.10.58.10". The problem here is that not all incorrect scripts in the config are the same.