Script: FixOrionVol.ps1

Author: Ben Scherer

Description:  This script will fix monitoring of volumes that are reporting down in orion due to being formatted, having label changed,etc..


3/28/2016 - Updated regex

3/28/2016 - added debug

  • This is great!  I've tried to think of a way to do this and couldn't figure it out.  Looking over the code I have a few questions.  I see no looping in the code, how do you run this against multiple nodes/volumes?  In general, what's the way you created this code to be ran?  As a scheduled task, or just a module that people could copy/paste from to build their own custom script?

    Thanks for this.

  • I am using Alert Manager(Screenshot below).

    I could probably remove the -IP parameter and just pull it from the nodes table.

    See this   FixAllOfflineVol_Windows.ps1  for the same version of the script,except it will pull back a list of all offline windows volumes and attempt to fix them.  I just threw this together pretty quickly and did a quick test to make sure it didnt blow anything up. But i would look it over yourself too.

    powershell.exe -f f:\scripts\fixorionvolume.ps1 -swishost <OrionHost>-ip ${N=SwisEntity;M=Node.IP_Address} -username <username> -password <password> -volumeid ${N=SwisEntity;M=VolumeID}



  • Ahh, OK, running it as an Alert Action, got it.  That makes sense.  I will probably add to it to loop through all of the nodes and volumes that it pulls back so that I can run it as a scheduled task.  The problem I found with using alerts to make updates like this is that it adds a bunch of events and alert history entries to those respective tables.  In small to medium sized environments that wouldn't be a big deal, but our environment is pretty large and it adds a ton of bulk to those tables.  I had alerts that were updating a couple of custom properties for us every hour and after just a couple of weeks we had several million event AlertObjects and hundreds of thousands of AlertHistory and Events table entries which was slowing down any resources, reports, alerts, etc. that queried that table.  I converted all of it to Powershell scripts that run as scheduled tasks and deleted all of those entries from the SQL tables and that fixed a lot of slow down we had been experiencing due to the sudden table size growth.

    I just got an idea for a Feature Request after writing this.  Assuming it hasn't been suggested already, they should setup an Admin Jobs console (kind of like the NCM Jobs console) where you can run different automated tasks like updating custom properties or running SDK scripts like yours.  I'm sure there are other things I'm not thinking of as well that could be done.

    Anyways, thanks again for your help, this is a truly great script that I really wanted but was never sure how to create.

  • Understand..  I think the second script i posted will work for what you want to do.  Maybe add some logging, better debug output to it.


  • Hey - looks very nice and useful.

    Trying to run your script towards my Orion server, but nothing seems to happen. Should it work on NPM 12?

    It just hangs here, doesn't give any output or errors - just nothing happens - any ideas how I can debug?


  • Hi,

    This alert helping lot me.. i am not understand how to given the trigger action in body. I have own script.

    I hope this alert will trigger volume went to offline.

    I am simulating the alert like this way. please suggest on it anything change in trigger action.