Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Is there a way to script something that will show what LUNS are under which volumes?
I know you can do it with Systems Manager, but I'd like to see something more like a tree hierarchy...
Volume Name
-Luna
-Lunb
-Lunc
Volume Name
-Luna
-Lunb
Etc
Make sense?
Solved! See The Solution
Hello Justin,
Can you try this out, it might point you to the correct direction..
Just copy and paste the below scriptlet to your powershell window.
function LunName
{
[CmdletBinding()]
Param
(
# Param1 help description
[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
$vol
)
$luninfo = Get-NaLun | ?{$_.path -match "/vol/$vol/" } | ForEach-Object {$_.Path.replace("/vol/$vol/","")}
return $luninfo
}
Get-NaVol | select @{l='VolumeName';e={$_.name}},@{l='ContainedLunNames';e={([string]::Join(",",(LunName -vol $_.name)))}}
You can also export to csv as below
Get-NaVol | select @{l='VolumeName';e={$_.name}},@{l='ContainedLunNames';e={([string]::Join(",",(LunName -vol $_.name)))}} | Export-Csv "c:\volluninfo.csv"
Please do a search for one of my posts. We wrote something a while ago that should give you what you want
Here, I'll save you the trouble - https://communities.netapp.com/thread/23684
I actually saw that script, but it doesnt seem to output the info I was hoping/looking for....
I would like to see the volume name and then the specific LUNS associated to that volume under it. Preferably exported to XLS or a CSV file.
If I get some time, I will try to come up with a little bit of a sample... Not much free time these days..
Hi Justin,
Yes, you can do it, But it can get little tricky, you can use awk script to run against it. Can you please paste the output of qtree status?
Thanks
RK
*cough* awk *cough* 🙂
native powershell is the way to go....
I see what u mean .. but with very little effort it will give the result Justin wanted.
I have to be honest.. Not that i'm against it, but onCommand Reporting 1.1 seems to do a really nice job at it.
I love powershell, but heck, I can't compete with Cognos Developers...
We do a lot of cloning of volumes from Prod to test/QA. The volumes contain a tun (spelled it like that on purpose) of luns that are un-needed when we do the clone, so we go in and delete the un-needed luns.
Long story short, the DBA's ask to refresh a DB, which is usually one or 2 luns and since we clone the whole volume, and each volume has a tun of luns, its kind of a pain to find the volume...
With a script that populates what Volume has which Luns, I could go in and filter the LUN name and bingo bango.... easy.
Justin,
Give onCommand Report a shot..
I just went into our environment and created the report with data in it in 5 minutes.
I'm decent in powershell, but I can't compete with that.
Are you talking about Ops Manager?
Installing OnCommand Report now... waiting for a eval license from my sales guy....
How did you make out?
Hello Justin,
Can you try this out, it might point you to the correct direction..
Just copy and paste the below scriptlet to your powershell window.
function LunName
{
[CmdletBinding()]
Param
(
# Param1 help description
[Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
$vol
)
$luninfo = Get-NaLun | ?{$_.path -match "/vol/$vol/" } | ForEach-Object {$_.Path.replace("/vol/$vol/","")}
return $luninfo
}
Get-NaVol | select @{l='VolumeName';e={$_.name}},@{l='ContainedLunNames';e={([string]::Join(",",(LunName -vol $_.name)))}}
You can also export to csv as below
Get-NaVol | select @{l='VolumeName';e={$_.name}},@{l='ContainedLunNames';e={([string]::Join(",",(LunName -vol $_.name)))}} | Export-Csv "c:\volluninfo.csv"
Hi Vinith,
That is pretty neat, but it takes very longtime (50min) to generate output. I have like 34 volumes with 7 luns each,
Thanks
Ravi
Ravi - Which script, mine or his?
JGP,
Yours ran like a horse (2minutes), but Vivin's gives a different kind of output than yours. Vivin's is more for what Justin is looking for I guess.
Thanks
Ravi