Hi all
first tks for this forum. i just see that very good tool exist -> powercli
i try to do somethings.
first i want per vm the % of uptime per vm
and the average of cpu usage, mem usage etc... from last year.
i can do this per script but i don't found how.
tks for your help
That is indeed the function, but you need to call the function to make it return some results.
That is what the Sample Usage section in my blog post shows.
For example:
$vm = Get-VM MyVM
Get-VMUptime -VM $vm
will call the function for the VM called MyVM, and the results will be displayed on the screen.
Practically you can do the following:
. ./get-vmuptime.ps1
$vm = Get-VM -Name One-Of-Your-VM
Get-VMUptime -VM $vm
Let me know if that works
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Get-VMUptime work on esx 4.1 ? because powercli said that this command is not know command.
That is why you need to do the dot-sourcing of the .ps1 file that contains the function definition first.
Like I said that way PowerShell "knows" the function.
Once the function is known, you can call it.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
haaa i understand tks
i want to do some complex things.
in my script i want to specify interval date except day not work and time work.
for exemple from 8h to 18h and not the sunday for last month very complex i thing.
do you know thta i can build script like that ?
The Get-VMUptime function returns the start and finish of each interval for which it has data.
You can check if your custom intervals fall within that timerange.
To produce reports for specific time ranges and specific days you can have a look at my PowerCLI & vSphere statistics – Part 2 – Come together post. It contains a sample script to work with a Custom sampling period.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
2h that i search
but 0 entry in my file
i try like this
tks advance for your help
The Get-VMUptime function doesn't return the same objects as the Get-Stat cmdlet.
You would have to test if the special intervals you have fall inside the timespan returned by the function.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
like that
Luc i found your very good post
it's the same that my other script, i try something to integer works days but i don't found how. can you help me please ?
This script uses metrics returned by Get-Stat, so you could update the Where-clause, that now only check the instance, to also check the timespans (like you already tried to do in the previous script).
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
OK Luc
but how to know metric for get-* ?
tks advance
Perhaps I don't understand your question correctly, but the counters are defined in the $metrics variable in that script.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Sorry, but I have the impression you are trying to compare apples with pears.
The Get-VMUptime function returns 1 or more objects that each have a Start and Finish property that hold a DateTime value and a percentage indicating how much time in between Start and Finish the VM was up..
For example, for a VM that hasn't been down for the requested interval, you will get back 1 object. Something like this
You now want to check if specific time intervals for specific days are present in this interval.
That should be possible, you can check if your interval falls within the interval delimited by Start and Finish.
But I'm not sure how you want to convert the uptime percentage.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
that i want it's that script show me % of uptime between the start and end time in the works time of users ->
so this is work but i want to export this on csv file. it's here that not works.
tks Luc