Forum Discussion
Hank_Stallings
Nimbostratus
Jun 11, 2010PS iControl Dashboard Question
Hey from Nashville!!
I have a question regarding the PowerShell script (http://devcentral.f5.com/wiki/defau...board.html).
It's very cool, however in my environment we have a zillion pools...so the script takes forever to run. How can I change the script to allow for filtering based on pool name?
Line 152 of the code reads:
$PoolList = (Get-F5.iControl).LocalLBPool.get_list() | Sort-Object;
Can a variable be defined (like $filter=$null) that can be added to the console at runtime.
Like:
iControlDashboard.ps1 host uid pwd filter
So my command at runtime would look like:
PS iControlDashboard.ps1 MyBIGIP hank password dev
So that the dashboard would only show pools whose name contain "dev".
Any help is appreciated!
Hank
PS: Also when we configure nodes, we define the server name in the node record. On the node record the field is called "Name". Would like to pull that information into the dashboard as well.
4 Replies
- Ask and you shall receive. I've updated the iControlDashboard codeshare entry with an additional input parameter for the pool and changed the line you referred to as
$PoolList = (Get-F5.iControl).LocalLBPool.get_list() | Where-Object { $_.ToLower().IndexOf($Pool.ToLower()) -ne -1 } | Sort-Object;
IndexOf will return a non-negative number if the substring is contained in the specified string. This essentially does a regular expression match to "*value*" without the overhead of a regular expression. If you only want to match to the beginning of the string, you could change the "IndexOf" to "StartsWith" or some other string function of your choice.
Hope this helps...
-Joe - Hank_Stallings
Nimbostratus
Thanks Joe,
So, when I run the script as before,PS c:\temp\iControlDashboard.ps1 BIGIP Username Password
I get an error like:
TRAPPED: System.Management.Automation.PSInvalidCastException
TRAPPED: Cannot convert value "22928446623" to type "System.Int32". Error: "Value was either too large or too small for an Int32."
If I run it with:PS c:\temp\iControlDashboard.ps1 BIGIP Username Password "*dev*"
I get this error:
TRAPPED: System.Web.Services.Protocols.SoapHeaderException
TRAPPED: Could not find element by name: pool_names
Thanks,
Hank - Hank_Stallings
Nimbostratus
If I change I make this change it works:
$PoolList = (Get-F5.iControl).LocalLBPool.get_list() | Where-Object {$_.ToLower() -match ($Pool)} | Sort-Object;
Thanks for your help!
Hank - Hank_Stallings
Nimbostratus
PS: Also when we configure nodes, we define the server name in the node record. On the node record the field is called "Name". Would like to pull that information into the dashboard as well.
The node address.screen_name is the only parameter I can't bring into this...is that a possibility?
Thanks
Hank
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
