Skip to main content

在vROps中报表n天以前创建的快照

有很多种方法可以用来做虚拟机快照报表。比如PowerCLI、VRTools、甚至vSphere Client本身也可以。今天我会分享如何使用vRealize Operations Manager (vROps) 6.x做自定义天数以前创建的虚拟机快照的报表。用vROps做表表的好处是可以通过计划任务自动以邮件形式发送报表,并提供PDF和CSV两种格式的表。 我在网上找到了一篇文章谈到如何用vROps实现类似报表。但要求修改vROps的规则,这可能会影响到vROps的全局计算模型。如果你的团队们需要为各自的报表设置不同的条件怎么办?



当我完成这篇文章的时候发现有个漏洞。如果你要报表n天前的快照,但是在n天之内你删除了这个快照并且创建了一个新快照。那么这个虚拟机依旧会出现在报表中!但我觉得公布这篇文章还是有价值的,因为这是在vROps中创建报表的一种方式。

每一个报表都需要和一个视图关联。所以第一步是创建视图。以管理员身份登录,前往 Views -> 创建一个新视图 -> 输入新视图的名字和描述 -> 在Presentation这一步选择List -> 在Subjects这一步选择Virtual Machine。


Data部分比较复杂。在Disk Space指标下选择Snapshot Space (GB) -> 在Data标签卡下的Transformation下拉菜单中选择Last -> 在Time Settings标签卡中选择Advanced -> 设置Relative Start DatePrevious 4 Days;设置Relative End DatePrevious 3 Days -> 在Filter标签卡第一个下拉菜单选择Metrics、第二个下拉菜单选择Disk Space|Snapshot|Virtual Machine Used (GB) 、第三个下拉菜单选择is greater than、第四个输入0.

[caption id="attachment_944" align="aligncenter" width="300"]Data标签下选择Transformation Data标签下选择Transformation[/caption]

[caption id="attachment_945" align="aligncenter" width="300"]Time Settings标签卡中选择时间范围 Time Settings标签卡中选择时间范围[/caption]

[caption id="attachment_946" align="aligncenter" width="300"]在Filter标签卡下设置过滤器 在Filter标签卡下设置过滤器[/caption]

在上边的步骤中,Snapshot Space (GB)指标的Transformation被设为Last,这样只会显示该指标在被选中时间段的最后值。如果值为0可以认为在选中的时间期间没有快照产生。在上例中,时间区间被定为过去的4天和过去的3天之间。这表示vROps只显示从过去4天到过去3天(其实就是1天)之间最后的值。如果值为0可以认为在这1天里没有快照产生。另外在filter标签下我们以Snapshot | Virtual Machine Used (GB)大于0来过滤要检查的虚拟机。根据我的测试,在这里的指标值都是当前的数据。所以它可以先过滤掉现在已经没有快照的虚拟机,这样只用列出当前有快照,且在过去的4天和过去的3天之间有过快照的虚拟机。

然后只要在所有下一步中保持默认选项并最终完成视图的创建。新的视图会出现在列表中,接下来只要根据这个视图创建报表即可。网上有很多文章介绍如何做的。

Popular posts from this blog

Connect-NsxtServer shows "Unable to connect to the remote server"

When you run Connect-NsxtServer in the PowerCLI, it may show "Unable to connect to the remote server".  Because the error message is a little bit confusing with other login issues. It's not easy to troubleshoot. The actual reason is the NSX-T uses a self-signed certificate, and the PowerCLI cannot accept the certificate automatically. The fix is super easy. You need to set the PowerCLI to ignore the invalid certificate with the following command: Set-PowerCLIConfiguration -Scope User -InvalidCertificateAction:Ignore -Confirm:$false

Setup Terraform and Ansible for Windows provisionon CentOS

Provisioning Windows machines with Terraform is easy. Configuring Windows machines with Ansible is also not complex. However, it's a little bit challenging to combine them. The following steps are some ideas about handling a Windows machine from provisioning to post configuration without modifying the winrm configuration on the guest operating system. Install required repos for yum. yum -y install https://repo.ius.io/ius-release-el7.rpm yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum -y install https://packages.endpointdev.com/rhel/7/os/x86_64/endpoint-repo.x86_64.rpm yum -y install epel-release yum -y install yum-utils yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo Install  Terraform . sudo yum -y install terraform Install  Ansible . sudo yum -y install ansible Install  Kerberos . yum -y install gcc python-devel krb5-devel krb5-libs krb5-workstation

How to List All Users in Terraform Cloud

Terraform has a rich API. However, the API documentation does not mention how to list all users. We can leverage the organization membership API and the PowerShell command  Invoke-RestMethod  to get a user list. 1. Create an organization token in Terraform Cloud. 2. Create the token variable ( $Token ) in PowerShell. $Token = "abcde" 3. Create the API parameters variable in PowerShell. $params = @{ Uri = "https://app.terraform.io/api/v2/organizations/ZHENGWU/organization-memberships?page%5Bsize%5D=100" Authentication = "Bearer" Token = $Token ContentType = "application/vnd.api+json" } Note: You need to replace ZHENGWU with your own organization name. And I used 100 at the end of the URI to retrieve the first 100 users. It can be any number.  4. Retrieve the API return and list the user's email address. $Test = Invoke-RestMethod @params $Test.data.attributes.email