VMware vSphereの監視

最終更新日: 03 年 2024 月 XNUMX 日

LogicMonitor は、すぐに使用できる VMware vSphere の監視を提供します。 この監視スイートは、vSphere Web サービスと自動化 API を利用して、VMware vCenter Server Appliance (VCSA)、VMware ESXi ホスト、および仮想マシンを監視します。

技術タイプ

サーバーおよび運用ハードウェア

互換性

2023 年 XNUMX 月の時点で、LogicMonitor の VMware vSphere パッケージは以下と互換性があることが知られています。

  • VMware vCenter Server Appliance 6.7 ~ vCenter Server 8.0.x
  • VMware ESXi 6.5 GA ~ ESXi 8.0.x

セットアップ要件

  • VMware vSphere ロジックモジュール
  • LogicMonitor_Collector_Snippets データソース
  • コレクター 32.400 以降
  • vCenter および ESXi 読み取り専用ユーザーの認証情報
  • VMware ツール
    VMware Tools は次からダウンロードできます。 VMWare カスタマーコネクト.

注: vSphere パフォーマンス カウンターを有効にし、デフォルト設定 (カウンター レベルと間隔) で構成する必要があります。 デフォルト以外の構成を使用すると、一部のデータポイントでデータが適切にレポートされなくなる可能性があります。

VMware vSphere modules are organized into the following categories:

  • monitoring of ESXi hosts
  • monitoring the runtime of the vCenter appliance
  • monitoring the various vSphere objects (datastores, virtual machines, clusters, and so on).

The different categories require different user permissions.

The following table lists the categories that VMware vSphere modules monitor and the user permissions required for each category:

カテゴリーUser Permissions Required
ESXiホストLocal read-only user

注: Note: vSphere does not currently support domain users for ESXi hosts. For more information, see the following version applicable documentation from VMware:ESXi 7.x: VMware Host Client での ESXi ユーザーの追加
ESXi 8.x: VMware Host Client での権限の管理

The runtime of vCenter appliance無し
The various vSphere objects (For example, (datastores, virtual machines, and clusters)A user can be placed in the following:
  • vCenter Single Sign-On (SSO) Domain
    \@vsphere.local 初期設定で
  • Active Directory (AD) ドメイン
  • The AD domain must be added to the SSO configuration.
  • ローカルユーザー
  • Typically added by using the localaccounts.user.add CLI command in the appliance API

VMware vCenter Appliance

For monitoring the vCenter Appliance’s runtime, the following can be used:

  • Domain users—The user needs to be assigned to the default SSO group SystemConfiguration.Administrators.

注: Administrator privileges are required due to these modules monitoring runtime statistics of the vCenter Appliance as a whole (for example, CPU/Mem/Filesystem usage, and running services).

  • ローカル ユーザー—The user needs to be assigned to the Superadministrator role.

注: If the SSO group SystemConfiguration.Administrators was previously deleted, it can be restored by creating a new group and naming it SystemConfiguration.Administrators. In addition, the SSO group can also be restored by running the following command: /usr/lib/vmware-vmafd/bin/dir-cli ssogroup create –name SystemConfiguration.Administrators

Assigning a user to the SystemConfiguration.administrator group provides a different set of permissions than assigning a user to the Administrator group. By default, the SystemConfiguration.A dministrator group only allows a user to access the VAMI (https://:5480), and not the vCenter environment. 

Using the same user for VMware vCenter Appliance and vSphere Monitoring

A single user can be used for monitoring both the vSphere and for the vCenter Appliance.

The following permissions are required:

ユーザータイプ必要な権限
Domain User
  • SystemConfiguration.Administrator SSO groupread-only role through global permissions, with Propagate to Children 使用可能
ローカルユーザー
  • Superadministrator local roleread-only role through global permissions, with Propagate to Children 有効になりました。

ESXiホストのユーザーの作成

The exact process varies by ESXi version. For more information, see VMware Host Client での ESXi ユーザーの追加 VMware から。 

Creating a user for vSphere

詳細については、を参照してください。 Add vCenter Single Sign-On Users VMware から。

Creating a user for vCenter Appliance Monitoring

詳細については、を参照してください。 Create a Local User Account in the vCenter Server Appliance VMware から。

注:Regardless of the domain, at least read-only global permissions are required for monitoring. After creating a user, you must be assigned Global Permissions to the read-only user group. To ensure modules can collect data, the Propagate to Children 有効にする必要があります。

モニタリングにリソースを追加する

You can add VMware vSphere resources using the following methods:

For a given VMware vCenter, the Enhanced Script Netscan creates a Resource Group with nested Resource Groups and Resources to match your vCenter organizational structure of Datacenters, Clusters, Resource Pools, user-defined vCenter Folders, ESXi Hosts, and Virtual Machines. The NetScan properties and filters allows you to control what Resource Groups are created and what ESXi Hosts and Virtual Machines are added to LogicMonitor as Resources. For more information about using Advanced Netscan, see 強化されたスクリプト ネットスキャン.

警告: LogicMonitor の推奨フィルター (一覧表示) を構成しない場合、NetScan は、ターゲット vCenter 環境で定義されているすべての ESXi ホストおよび仮想マシンを個別の LogicMonitor リソースとして追加しようとします。

  1. あなたの中で ロジックモニターポータル > モジュール > 応募者と、VMware vSphere LogicModule をインストールします。
  2. MFAデバイスに移動する  「リソース」 > 「追加」 > 「複数のデバイス」 > 「高度な NetScan」.
      高度な NetScan を追加する ページが表示されます
  3. この NetScan に関連付ける名前を入力します。 たとえば、「VMware vCenter」や「VMware vSphere」などです。 
  4. NetScan を実行するコレクタを選択します。
    デフォルトでは、NetScan は NetScan を実行するコレクタに新しいリソースを割り当てます。
  5. 選択 強化されたスクリプト NetScan   方法 ドロップダウンリスト。
  6. 「拡張スクリプト」セクションから、次を選択します。 デバイスの資格情報 > このスキャンにはカスタム認証情報を使用します。
  7. NetScan に必要な VMware API 認証情報を提供する次のプロパティを追加し、NetScan がリソースを作成および編成する方法と場所を変更します。
プロパティ必須
vcenter.uservCenter 読み取り専用ユーザー[メール保護]有り
vcenter.passvCenter 読み取り専用パスワード************有り
vcenter.ホスト名vCenter のホスト名

vcenter.url が設定されていない場合は、この値を使用して vCenter への接続が試行されます。
IPアドレスまたはFQDN有り
vcenter.表示名vCenter Server Appliance の表示名vcenter01有り
vcenter.urlVCSAにアクセスするためのURLhttps://<vcenter.hostname>/sdkいいえ
esx ユーザーESXi ホストへの接続に使用する認証情報

すべての ESXi ホストに同じ認証情報が使用されます。 このプロパティが設定されていない場合は、vCenter に指定された認証情報が使用されます。 提供された認証情報でホストに接続できない場合でも、デバイスは検出されるため、認証情報を ESXi ホスト リソースまたは親リソース グループに手動で設定する必要があります。
読み取り専用ユーザーいいえ
esx.パスESXi ホストへの接続に使用する認証情報。************いいえ
ルートフォルダ検出されたすべてのデバイスが LogicMonitor に配置されるルート フォルダー。 値は入れ子にすることができます。 リソース グループが存在しない場合は、NetScan によって作成されます。Customer01/VMware vSphere/vCenter01/いいえ
Discover.esxitrue の場合、LogicMonitor は esxi ホストを追加します。
注: このプロパティは仮想マシンの検出には影響しません。これらのプロパティは個別に切り替えることができます。
true、false (デフォルトは true)いいえ
Discover.vmtrue の場合、LogicMonitor は VM を検出します。

注: このプロパティは ESXi 検出には影響しません。これらのプロパティは個別に切り替えることができます。


true、false (デフォルトは true)
いいえ
view.hostAndCluster切り替えて、ホストとクラスターのインベントリ ビューを作成します。
データセンター > クラスタ > ホスト > リソース プール > VM

true の場合、LogicMonitor はこのフォルダー構造を再作成します。
true、false (デフォルトは true)いいえ
view.vmsAndTemplatesVM とテンプレートのインベントリ ビューの作成に切り替えます。
データセンター > クラスター > フォルダー > VM

LogicMonitor はこのフォルダー構造を再作成します。
Note: オプションに関係なく、VM テンプレートは検出されません。
true、false (デフォルトは true)いいえ
view.standaloneVmホストとクラスターのビューが使用されるとき、およびリソース プールにない VM がスタンドアロン VM と呼ばれるデフォルトのフォルダーに配置されるときを切り替えます。

LogicMonitor はこのフォルダー構造を再作成します。 
true、false (デフォルトは true)いいえ
  1. [フィルター] セクションで、次のフィルター プロパティを使用して、特定のリソース (仮想マシン、ESXi ホスト) を検出から除外します。

    これらのフィルターは、Active Discovery フィルターと同じように動作します。 次のデバイス レベルのプロパティが自動的に検出され、フィルタリングできます。 利用可能なフィルター操作は次のとおりです。 Equal、NotEqual、GreaterThan、GreaterEqual、LessThan、LessEqual、Contain、NotContain、Exist、NotExist、RegexMatch、RegexNotMatch

    次のリストは、これらのフィルターの使用方法の例を示しています。 

推奨事項: 大規模な vCenter 環境では、フィルタ操作または値を段階的に変更して、監視対象リソースをオンボードに追加できます。 たとえば、一度に XNUMX つのデータセンターだけを検出またはインポートするようにフィルターを構成したり、一度にいくつかのクラスターだけを検出またはインポートしたりするようにフィルターを構成すると、自動バランス型コレクター グループが監視ワークロードを分散する時間を確保できます。 

警告: リストされているフィルター プロパティを構成しない場合、NetScan はターゲット vCenter 環境で定義されているすべての ESXi ホストと仮想マシンを追加しようとします。

プロパティ操作必須
netscan.foundDNS等しいNetScan は仮想マシンの DNS 名 (true または false) を検出できました。いいえ
netscan.powerstate等しいネットスキャンが実行されたときの電源状態。 パワーオフの仮想マシンを検出からフィルタリングするために使用されます。電源が入っているいいえ
vcenter.データセンター等しい特定のフォルダー/リソース プールなどにあるすべての VM をフィルターで除外するために使用されます。 フィルタエントリごとに XNUMX つの値。データセンター01いいえ
等しくないデータセンター02いいえ
vcenter.cluster等しいリソースを検出/除外する vSphere クラスター。 デフォルトの動作では、対象の vCenter のすべてのクラスターが検出/インポートされます。 フィルタエントリごとに XNUMX つの値。クラスター01、クラスター02いいえ
等しくない開発者、
ホイール試乗
いいえ
vcenter.リソースプール等しいリソース プール。そのリソースを検出/除外します。デフォルトの動作では、すべての vCenter リソース プールがリソース グループとして、すべての VM がリソースとして検出/インポートされます。 フィルタエントリごとに XNUMX つの値。製品、ミッションクリティカル
vcenter.フォルダー等しくないvCenter フォルダー。そのリソースを検出/除外します。 デフォルトの動作では、すべての vCenter フォルダがリソース グループとして、すべての VM がリソースとして検出/インポートされます。 フィルタエントリごとに XNUMX つの値。vCLSいいえ
等しいMaryVM、JosephVMいいえ
vcenter.ホスト名RegexNotMatch検出または除外する ESXi ホストまたは仮想マシン。 デフォルトの動作では、すべての vCenter ESXi ホストおよび VM がリソースとして検出またはインポートされます。 フィルタエントリごとに XNUMX つの値。.*[Tt]est.*いいえ
vcenter.tags等しくないcategory.tag 形式のタグに基づいて検出または除外するリソース。 デフォルトの動作では、VM タグの値は無視されます。 フィルタエントリごとに XNUMX つの値。開発、テスト、モニタリングなしいいえ
  1. 選択 Groovyスクリプトを埋め込む 次のスクリプトを埋め込みます。

警告: スクリプトを編集しないでください。 編集された拡張スクリプト NetScan はサポートされていません。 LogicMonitor が提供するスクリプトを編集した場合、問題が発生した場合、LogicMonitor サポートは (独自の裁量により) サポートされているスクリプトで編集内容を上書きするよう要求する場合があります。 拡張スクリプト NetScan は、LM Envision リソースの作成を 600 時間あたり 600 以下に制限します。 XNUMX を超えるリソースを作成するには、すべてのリソースが追加されるまで NetScan を XNUMX 時間ごとに繰り返すようにスケジュールします。

/*******************************************************************************
 * © 2007-2024 - LogicMonitor, Inc. All rights reserved.
 ******************************************************************************/
import com.logicmonitor.common.sse.utils.GroovyScriptHelper
import com.logicmonitor.mod.Snippets
import groovy.json.JsonOutput

def debug = false
def log = false     //to find items in log use command - grep "VMware_vSphere_ESN" wrapper.log

def props, host, displayname
try
{
    host = hostProps.get('system.hostname')
    props = hostProps
    displayname = props.get('system.displayname')
    debug = true // Set debug to true to ensure we do not output sensitive properties
}
catch (Exception e)
{
    props = netscanProps
    host = props.get('vcenter.hostname')
    displayname = props.get('vcenter.displayname') ?: host
}
def user = props.get('vcenter.user') ?: props.get('vcsa.user') ?: props.get('esx.user')
def pass = props.get('vcenter.pass') ?: props.get('vcsa.pass') ?: props.get('esx.pass')
def addr = props.get('vcenter.url') ?: props.get('vcsa.url') ?: props.get('esx.url') ?: "https://${host}/sdk"
if (!user || !pass || !addr || !host || !displayname)
{
    throw new Exception("Required parameters are missing.  vcenter.user, vcenter.pass, vcenter.hostname  and vcenter.display name are required")
}
def hostnameSource = props.get("hostname.source")?.toLowerCase()
Boolean skipDeviceDedupe = props.get("skip.device.dedupe", "false").toBoolean()
def esxUser = props.get('esx.user')
def esxPass = props.get('esx.pass')
int eTimeout = 3
def rootFolder = props.get('rootFolder') ?: "vCenterResources"
def includeESXiHosts = (props.get('discover.esx') ?: true).toBoolean()
def includeVMs = (props.get('discover.vm') ?: true).toBoolean()
def includeHostsAndClustersView = (props.get('view.hostandcluster') ?: true).toBoolean()
def includeVMsAndTemplatesView = (props.get('view.vmsandtemplates') ?: true).toBoolean()
def includeStandaloneVM = (props.get('view.standaloneVm') ?: true).toBoolean()
def applyVCenterCredentialsToESXHost = (props.get('esx.vcentercredentials') ?: false).toBoolean()
modLoader = GroovyScriptHelper.getInstance()._getScript('Snippets', Snippets.getLoader()).withBinding(getBinding())
def emit = modLoader.load("lm.emit", "1.1")
def debugSnip = modLoader.load("lm.debug", "1.0")
def lmvSphere = modLoader.load("vmware.vsphere", "1.0")
def httpSnippet = modLoader.load("proto.http", "0")
def lmDebug = debugSnip.debugSnippetFactory(out, debug, log, "VMware_vSphere_Enhanced_Netscan")
def vSphere = lmvSphere.vSphereWebServicesAPIFactory(addr, user, pass, lmDebug)
def http = httpSnippet.httpSnippetFactory(props)
def lmApiSnippet = modLoader.load("lm.api", "0")
def lmApi = lmApiSnippet.lmApiSnippetFactory(props, http, lmDebug)
def maxESXiLoginFailure = (props.get('esx.maxloginfailures', '10').trim()).toInteger()
int ttlESXiLoginFailure = 0

List fields = ["name", "currentCollectorId", "displayName"]
Map args = ["size": 1000, "fields": fields.join(",")]
def lmDevices, pathFlag, portalInfo, timeLimitSec, timeLimitMs
if (!skipDeviceDedupe)
{
    portalInfo = lmApi.apiCallInfo("Devices", args)
    timeLimitSec = props.get("lmapi.timelimit.sec", "60").toInteger()
    timeLimitMs = (timeLimitSec) ? Math.min(Math.max(timeLimitSec, 30), 120) * 1000 : 60000
    if (portalInfo.timeEstimateMs > timeLimitMs)
    {
        lmDebug.LMDebug("INFO: Estimate indicates LM API calls would take longer than time limit configured.  Proceeding with individual queries by display name for each device to add.")
        lmDebug.LMDebug("\t${portalInfo}\n\tNOTE:  Time limit is set to ${timeLimitSec} seconds.  Adjust this limit by setting the property lmapi.timelimit.sec.  Max 120 seconds, min 30 seconds.")
        pathFlag = "ind"
    }
    else
    {
        lmDebug.LMDebug("INFO: Response time indicates LM API calls will complete in a reasonable time range.  Proceeding to collect info on all devices to cross reference and prevent duplicate device creation.\n\t${portalInfo}")
        pathFlag = "all"
        lmDevices = lmApi.getPortalDevices(args)
    }
}
def now = new Date()
def dateFormat = "yyyy-MM-dd'T'HH:mm:ss.s z"
TimeZone tz = TimeZone.getDefault()

Map duplicateResources = [
"date"     : now.format(dateFormat, tz),
"message"  : "Duplicate display names found within LogicMonitor portal wherein hostname in LM does not match hostname in Netscan output.  Refer to documentation for how to resolve name collisions using 'hostname.source' netscan property.",
"total"    : 0,
"resources": []
]

List resources = []
Map ilpCredentials = [:]
Map tags = [:]
// Determine the vSphere host that we are making API queries to
Map productType = ['vpx': 0, 'embeddedEsx': 1]
def productId = productType[vSphere.getAbout().productLineId]

switch (productId)
{
    case 0: // vCenter
        ilpCredentials['vcenter.user'] = user
        ilpCredentials['vcenter.pass'] = pass
        ilpCredentials['vcenter.addr'] = addr

        tags = lmvSphere.vSphereAutomationAPIFactory(host, user, pass, lmDebug)
        .withCloseable() { it.getTagMap() }
        .collectEntries { k, v -> [(k): v.values] }

        lmDebug.LMDebugPrint("INFO: vCenter tags found: ${tags}")
        break
    case 1: // ESXi
        ilpCredentials['esx.user'] = esxUser ?: user
        ilpCredentials['esx.pass'] = esxPass ?: pass
        ilpCredentials['esx.addr'] = addr
        break
        // gsx(VMware_Server) and esx(VMware_ESX) are not supported
}

def vms = vSphere.getMOs('VirtualMachine').each { vSphere.updateEntityLineage(it) }
def hosts = vSphere.getMOs('HostSystem').each { vSphere.updateEntityLineage(it) }

tagPropPrefix = 'VMware.vCenter.tag'
Closure tagFormatter = { (it) ? it.collectEntries { _cat, _tag -> ["${tagPropPrefix}.${_cat}", _tag.join(',')] } : [:] }

def foundHost = null
// Discover each VM
vms.each { _vm ->
    Map device = [:]
    foundHost = (foundHost ?: (vSphere.isVmTheHost(_vm) ? _vm : null))
    if (!includeVMs && foundHost != _vm)
    {
        return
    }

    def MOR = _vm.MOR
    if (!MOR)
    {
        lmDebug.LMDebug("ERROR: MOR not found for ${_vm}, skipping")
        return
    }

    def deviceGroups = []
    def compLine = vSphere.getComputeLineage(MOR?.val)
    def vmLine = vSphere.getVmLineage(MOR?.val)
    def compFolder = (includeHostsAndClustersView) ? folderFormatter(compLine, rootFolder, includeStandaloneVM) : null
    def vmFolder = (includeVMsAndTemplatesView) ? folderFormatter(vmLine, rootFolder, includeStandaloneVM) : null

    if (foundHost == _vm)
    {
        // Rely on the vmFolder here. If customer is not including standalone VMs, but the vCenter is a standalone VM, discover it anyway
        def baseFolder = (vmFolder ?: folderFormatter(vmLine, rootFolder, includeStandaloneVM))?.split('/')[0]
        deviceGroups << baseFolder
    }

    if (includeVMs)
    {
        deviceGroups << compFolder << vmFolder
    }
    deviceGroups = deviceGroups.minus(null)

    if (!deviceGroups)
    {
        lmDebug.LMDebug("DEBUG: VM ${_vm.name} skipped due to no containing folder determined. This could be due to different filters being set.")
        return
    }

    def hostname = _vm.name
    lmDebug.LMDebug("\t\tINFO: hostname for VM ${_vm.name} set to $hostname")

    /***** add all properties to the device *****/
    if (foundHost == _vm)
    { // This is the vCenter VM
        device = [
        'hostname'   : "${host}",
        'displayname': "${displayname}",
        'hostProps'  : [
        'system.categories': 'VMware_vCenter,VMware_VM',
        'vCenter.vm.name'  : _vm.name
        ],
        'groupName'  : deviceGroups
        ]
        device.hostProps += tagFormatter(tags[vSphere.rootFolder.MOR.value])
    }
    else
    {
        device = [
        'hostname'   : hostname,
        'displayname': _vm.name,
        'hostProps'  : [
        'system.categories': 'VMware_VM',
        'vCenter.vm.name'  : _vm.name
        ],
        'groupName'  : deviceGroups
        ]
    }

    // If the netscan is running on a vCenter device
    if (productId == 0)
    {
        // Add vCenter tags
        device.hostProps += tagFormatter(tags[MOR?.value as String])

        // Add all parent entities as device properties
        def lineage = lineageParser(compLine + vmLine)
        lineage.each { k, v -> device.hostProps?."vcenter.${k.toLowerCase()}" = v.join(',') }
    }

    duplicateCheckAndAdd(device, resources, duplicateResources, lmApi, pathFlag, hostnameSource, skipDeviceDedupe, lmDevices, args, lmDebug)
}
if (includeESXiHosts)
{
    hosts.each { _host ->
        Map device = [:]

        def MOR = _host.MOR
        if (!MOR)
        {
            lmDebug.LMDebug("ERROR: MOR not found for ${_host}, skipping")
            return
        }

        /****** Device group set ******/
        def deviceGroups = []
        def compLine = vSphere.getComputeLineage(_host.MOR?.val)
        def compFolder = folderFormatter(compLine, rootFolder, includeStandaloneVM)
        deviceGroups << "${compFolder}/ESXi hosts"
        deviceGroups = deviceGroups.minus(null)


        def vSphere1 = null
        def addr1 = "https://${_host.name}/sdk"
        def user1 = esxUser ?: user
        def pass1 = esxPass ?: pass

        lmDebug.LMDebug("INFO: Attempting to login to the ESX host ${_host} (${_host.name}) with user $user1")

        try
        {
            if (ttlESXiLoginFailure > maxESXiLoginFailure)
            {
                vSphere1 = lmvSphere.vSphereWebServicesAPIFactory(addr1, user1, pass1, eTimeout, eTimeout, lmDebug)
            }
            else
            {
                vSphere1 = null
            }
        }
        catch (Exception e)
        {
            lmDebug.LMDebug("\tDEBUG: Unable to login to ESXi host ${_host} at ${addr1}, skipping...")
            lmDebug.LMDebug("\t\tERROR: $e")
            ttlESXiLoginFailure++
        }
        if (!vSphere1)
        {
            lmDebug.LMDebug("DEBUG: Unable to connect to ESXi host ${_host.name} with the provided credentials")

            // We were unable to connect to the ESXi host directly, just add it as a standard device
            device = [
            'hostname'   : _host.name,
            'displayname': _host.name,
            'hostProps'  : ['esx.netscan.status': 'Netscan did not connect to ESX host.'], // Do not set the system category 'VMware_ESXi' since we can't actually use this as an ESXi device
            'groupName'  : deviceGroups
            ]
        }
        else
        {
            lmDebug.LMDebug("INFO: Successful connection to ESXi host ${_host.name}")
            def esxHost = vSphere1.getMOs('HostSystem')[0]
            device = [
            'hostname'   : esxHost.name,
            'displayname': esxHost.name,
            'hostProps'  : [
            'esx.user'         : user1,
            'esx.pass'         : pass1,
            'esx.addr'         : addr1,
            'system.categories': 'VMware_ESXi'
            ],
            'groupName'  : deviceGroups
            ]
        }

        device.hostProps.'vcenter.hostname' = host
        if (applyVCenterCredentialsToESXHost)
        {
            device.hostProps += ilpCredentials
        }

        // If the netscan is running on a vCenter device
        if (productId == 0)
        {
            // Add vCenter tags
            device.hostProps += tagFormatter(tags[MOR?.value as String])

            // Add all parent entities as device properties
            def lineage = lineageParser(compLine)
            lineage.each { k, v -> device.hostProps?."vcenter.${k.toLowerCase()}" = v.join(',') }
        }

        duplicateCheckAndAdd(device, resources, duplicateResources, lmApi, pathFlag, hostnameSource, skipDeviceDedupe, lmDevices, args, lmDebug)
    }
}

if (duplicateResources["resources"].size() > 0)
{
    def netscanDupLog = new File("../logs/NetscanDuplicates/${rootFolder.replaceAll(" ", "_")}.json")
    new File(netscanDupLog.getParent()).mkdirs()
    duplicateResources["total"] = duplicateResources["resources"].size()
    def json = JsonOutput.prettyPrint(JsonOutput.toJson(duplicateResources))
    netscanDupLog.write(json)
    if (hostnameSource)
    {
        lmDebug.LMDebug("${duplicateResources["resources"].size()} devices found that were resolved with hostname.source=${hostnameSource} in netscan output.  See LogicMonitor/Agent/logs/NetscanDuplicates/${rootFolder.replaceAll(" ", "_")}.json for details.")
    }
    else
    {
        lmDebug.LMDebug("${duplicateResources["resources"].size()} devices found that were not reported in netscan output.  See LogicMonitor/Agent/logs/NetscanDuplicates/${rootFolder.replaceAll(" ", "_")}.json for details.")
    }
}
emit.resource(resources, debug)
return 0

String folderFormatter(List lineage, String rootFolder = '', includeStandaloneVM)
{
    if (lineage.size() > 1)
    {
        def folder = lineage.collect { Map folderMap ->
            switch (folderMap.type.toUpperCase())
            {
                case 'FOLDER':
                    if (folderMap.parent[0] == null)
                    { // This is the parent folder
                        return ((rootFolder) ?: "VMware - ${folderMap.name}")
                    }
                    else if (folderMap.name == 'vm')
                    {
                        return 'VMs' // VMs and templates folder
                    }
                    else
                    {
                        return folderMap.name
                    }
                    break
                case 'DATACENTER':
                    return "Datacenter - ${folderMap.name}"
                    break
                case 'CLUSTERCOMPUTERESOURCE':
                    return "Cluster - ${folderMap.name}"
                    break
                case 'RESOURCEPOOL':
                    return "Resource Pool - ${folderMap.name}"
                    break
                case 'COMPUTERESOURCE':
                    return 'Standalone ESXi hosts'
                default:
                    return folderMap.name
            }
            // Don't put the device in a folder named after it
        }[0..-2]

        if (lineage.size() >= 2)
        {
            // Check for standalone VMs that are not in a resourcePool, and put them in their own standalone folder
            if (lineage[-1].type == 'VIRTUALMACHINE' && (lineage[-2].type != 'RESOURCEPOOL' && lineage[-2].type != 'FOLDER'))
            {
                if (includeStandaloneVM)
                {
                    folder << 'Standalone VMs'
                }
                else
                {
                    // This is a standalone, and if we don't want to include it, return nothing
                    return null
                }
            }
        }
        return folder.join('/')
    }
    return null
}

Map lineageParser(List lineage)
{
    Map out = [:].withDefault { [] }

    lineage.each { out[it?.type] << it?.name }
    out.collectEntries { k, v ->
        v.unique()
        switch (k.toUpperCase())
        {
            case 'CLUSTERCOMPUTERESOURCE':
                k = 'CLUSTER'
                break
            case 'FOLDER':
                v.remove('vm') // Autogenerated folders
                v.remove('Datacenters')
                break
        }
        _out = [k, v]
    }
}

void duplicateCheckAndAdd(Map resource, resources, Map duplicateResources, def lmApi, def pathFlag, def hostnameSource, def skipDeviceDedupe, def lmDevices, def args, def lmDebug)
{
    if (skipDeviceDedupe)
    {
        resources.add(resource)
        return
    }

    // Check for existing resource in LM portal with this displayname
    String displayname = resource.displayname
    Integer collectorId
    def deviceMatch = null
    if (pathFlag == "ind")
    {
        deviceMatch = lmApi.findPortalDevice(displayname, args)
    }
    else if (pathFlag == "all")
    {
        deviceMatch = lmApi.checkExistingDevices(displayname, lmDevices)
    }
    lmDebug.LMDebug("Check for device matches: $deviceMatch")
    if (deviceMatch)
    {
        if (resource.hostname != deviceMatch.name)
        {
            def collisionInfo = [
            (resource.displayname): [
            "Netscan" : ["hostname": resource.hostname],
            "LM"      : [
            "hostname"   : deviceMatch.name,
            "collectorId": deviceMatch.currentCollectorId],
            "Resolved": false
            ]
            ]
            if (hostnameSource == "lm" || hostnameSource == "logicmonitor")
            {
                collisionInfo[displayname]["Resolved"] = true
                resource.hostname = deviceMatch.name
                collectorId = deviceMatch.currentCollectorId
                deviceMatch = false
            }
            else if (hostnameSource == "netscan")
            {
                collisionInfo[displayname]["Resolved"] = true
                resource.displayname = "${resource.displayname} - ${resource.hostname}"
                deviceMatch = false
            }
            else
            {
                lmDebug.LMDebug("ERROR: Could not find valid value for device property 'hostname.source'.")
                lmDebug.LMDebug("\t INFO: Value returned $hostnameSource, valid values are 'lm' or 'netscan'")
            }

            duplicateResources["resources"].add(collisionInfo)
        }
        else
        {
            deviceMatch = false
        }
    }

    if (collectorId)
    {
        resource.collectorId = collectorId
        duplicateResources["resources"][displayname]["Netscan"][0]["collectorId"] = collectorId
    }

    if (!deviceMatch)
    {
        resources.add(resource)
    }
}
  1.  スケジュール セクション、選択 このNetScanをスケジュールに従って実行する。 動的環境の場合、NetScan を XNUMX 時間ごとに実行するようにスケジュールできます。

注: 後続の NetScan の実行では、VMware vCenter の変更に基づいてリソースまたはリソース グループが追加または移動されます。 ただし、NetScan にはリソースを削除する機能がありません。

  1. 選択 Save or 保存して実行.

NetScan を実行した後、追加されたリソースの数の履歴を確認するか、NetScan がリソースを作成しない場合はエラー メッセージを確認します。 必要に応じて作成します 動的リソース グループ ビジネス ニーズごとにリソースを整理し、ワークロード固有の監視資格情報を適用します。 

リソースへのプロパティの手動割り当て

If you add hosts through an Advanced Netscan, then the relevant properties and credentials are discovered and assigned to the hosts automatically. If the hosts are added manually into LogicMonitor, use the following properties. For more information , see デバイスの追加.

ESXi ホスト

プロパティExample values必須
esx ユーザー ESXi 読み取り専用ユーザールート有り
esx.パスESXi読み取り専用パスワード*****有り
esx.urlOptional URL to access the ESXi
デフォルト値は https://<host>/sdk
https://esx01/sdkいいえ
esx.maxloginfailuresMaximum number of times the ESXi credentials will be attempted before giving up. Once the max is hit the ESXi host will be setup as devices without credentials and a esx.netscan.status saying it can’t connect. \n Default=10いいえ

vCenter Server Appliance のホスト プロパティ

There are multiple options for configuring the vcenter user. For more information, see Using the same user for VMware vCenter Appliance and vSphere Monitoring.

プロパティExample values必須
vcenter.uservCenter user[メール保護]有り
vcenter.passvCenter password********有り
vcenter.urlOptional URL to access the VCSA
デフォルト値は https://<host>/sdk
https://vcenter01/sdkいいえ
vcsa.userOptional vCenter SystemConfiguration.Administrator SSO group user or SuperAdmin local user[メール保護]いいえ
vcsa.passOptional vCenter SystemConfiguration.Administrator SSO group password or SuperAdmin local password********いいえ

注: In vSphere, there are no API only users. By default every user should be able to access both the host’s web interface and perform API calls. If a user is unable to, then this could point to some configuration issues for the user/role. In the case of vCenter Server Appliance monitoring, the VAMI interface (default access on port 5480) must also be accessible. 

考慮事項

コレクタープロキシ

If you are using a proxy for your Collector access, then you must exclude the appliance hosts from being proxied by your Collector or the Collector cannot access the VMware API. This is done by adding a value to the proxy.exclude setting in your Collector’s agent.conf file that reflect these hosts, proxy.exclude=hostname1|hostname2|hostname3|…, where the various hostnames represent the IPs/hostnames for the various ESXi or vCenter hosts that have been added into LogicMonitor and are being monitored by the Collector.

If the Collector is not able to access the VMware API and your ESXi/vCenter device has been added through its hostname, edit the device to use its IP instead and repeat these configuration edits if needed.

Modifying the API Port or URL

If your vCenter or ESXi hosts are configured to expose their API on nonstandard ports, you can set the properties vcenter.url or esx.url with an appropriate URL (For example, https://192.168.1.100:8443/sdk).

LogicModulesをインポートする

From the LogicMonitor Exchange, import all VMware vSphere Monitoring LogicModules from the package. For more information, see パッケージ内のLogicModules。 これらの LogicModule がすでにインストールされている場合は、最新バージョンであることを確認してください。

After the LogicModules are imported, data collection automatically begins.

トラブルシューティング

  • If not able to receive most data on the VMware_vCenterAppliance_* modules, ensure the user permissions are configured correctly. The user must be able to access the VAMI, default at https://HOST:5480. Due to the vCenterAppliance modules monitoring the runtime of the vCenter environment, you need specific administrator level access. The following details what settings should be assigned for user type:
ユーザー権限
Domain usersSystemConfiguration.Adminstrator SSO group
ローカル ユーザーSuperAdmin role

注:This is different than assigning the user the Administrator role. The VAMI operates outside of the vCenter environment, and so access to SystemConfiguration.Adminstrator only allows access to the VAMI and not the vCenter client. 

  • If only some of the VMware_vSphere_* or VMware_Esxi_* modules are able to report data, ensure the user permissions are configured correctly. When assigning the read-only role to a user, the option to ‘Propagate to Children’ must be enabled. You can verify that the correct permissions are set by accessing the vCenter Client with the configured user. You must be able to view all of the various vSphere objects (hosts, datastores, switches, VMs) that you want to monitor. VMware will only display objects that the user has access to, and accessing a parent object, for example, ESXi host does not inherently give access to the children, like VMs.
  • vCenter の 5 分間統計収集レベルが「レベル 1」に設定されている場合、一部のデータポイントはデータを返さない可能性があります。 監視対象の必要なすべてのカウンタにアクセスするには、vCenter 統計収集レベルを「レベル 2」に設定する必要があります。 これは、vSphere Web Client 内で次のように実行できます (「flex」または「flash」インターフェイス (HTML5 ではない) を使用する必要があります)。
    1. ツリーでvCenterインスタンスを選択します。
    2. Video Cloud Studioで 構成 タブには何も表示されないことに注意してください。
    3. 選択 > 統計 > 編集.
    4. 「統計レベル」列のドロップダウンから、表にリストされている最初の項目として「レベル 2」を選択します。

注: the vCenter database requirements must be added to the vCenter server requirements if they are on the same machine.

If vCenter does not have enough resources, vCenter may refuse some connections to the API (HTTPS) port (seen in the HTTPS- DataSource in LogicMonitor), or it may report a value of “-1” to some performance queries. Both of these situations cause gaps in graphs.

Netscan Troubleshooting

The NetScan for this suite can update existing devices in the portal to add relevant information retrieved from the VMware vSphere API. It is also possible for the NetScan to create duplicate devices in the portal when a conflict exists where the display name is the same, but the value for system.hostname is different.

To ensure devices are updated properly and duplicate devices are not created, this NetScan uses LogicMonitor’s API to query existing devices and report name conflicts discovered. This file can be accessed in the collector logs. For more information, see コレクターロギング.

The devices in this report are not reported to LogicMonitor as part of the NetScan output unless the NetScan has been configured with the property hostname.source. This property allows a user to resolve the name conflicts discovered by selecting the source of the hostname that is used in the NetScan output. Two possible hostname sources are determined by the following values:

  • “lm” or “logicmonitor” Devices with name conflicts use the existing system.hostname in LogicMonitor to ensure a device in the portal is updated using the NetScan. This setting does not create a new device.
  • “netscan” Devices with name conflicts maintain system.hostname determined in the NetScan script and update the display name reported to append – <system.hostname> 一意であり、ポータルに追加できることを確認するためです。 このオプションは、厳密な命名規則がなく、同じ表示名を持つ複数のデバイスがある場合に役立ちます。

注:NetScan は、system.hostname の値を更新できません。 NetScans は、表示名、カスタム プロパティ、およびグループ割り当てを更新できます。

パッケージ内の VMware vSphere LogicModules

VMware vSphere モジュールは、監視対象のコンポーネントに基づいて XNUMX つの異なるカテゴリに分類されます。

VMware ESXi モジュールは、VMware ESXi ホストの可用性、パフォーマンス、およびハードウェア センサーの監視と、vCenter によって管理されていないスタンドアロン ESXi ホストの仮想マシンの監視を提供します。

表示名タイプ説明置き換え
VMware_ESXi_CPUデータソースホストの CPU の使用率を追跡します。VMware_ESXi_リソース
VMware_ESXi_HostPerformance
VMware_ESXi_データストアスループットデータソースvSphere / vCenter ホストのパフォーマンス メトリックを監視します。VMware_ESXi_Datastoreパフォーマンス
VMware_ESXi_Datastoreの使用状況データソースESXi データストアのストレージ容量を監視します。 データは、データストアにアクセスできる場合にのみ有効です。VMware_ESXi_DatastoreCapacity
VMware_ESXi_DisksデータソースESXi ホストのディスク使用量を監視します。VMware_ESXi_HostPerformance
VMware_ESXi_HardwareHealthSensorデータソースESXi によって報告されるハードウェア健全性センサーを監視します。 監視されるセンサーは、ストレージ / メモリ / プロセッサー監視タブにあるハードウェア健全性センサーであり、VMware_ESXi_SystemHealthSensor によって報告されるシステム センサーとは別のものです。 ステータスが不明またはグレーのセンサーは、アクティブな検出から除外されます。vmware_esxi_hardwarehealthsensors
VMware_ESXi_HardwareSensorFans
VMware_ESXi_HardwareSensorPower
VMware_ESXi_HardwareSensor

VMware_ESXi_LogicalProcessorsデータソースESXi ホスト CPU の論理プロセッサの使用率を追跡します。VMware_ESXi_HostCPUコア数
VMware_ESXi_メモリデータソースESXi ホストで使用可能なメモリを監視します。VMware_ESXi_HostPerformance
VMware_ESXi_NetworkInterfacesデータソースESXi ホストのネットワーク インターフェイスの帯域幅を監視します。VMware_ESXi_HostInterfaces
VMware_ESXi_NetworkStateデータソースESX ホストのネットワークと分散ポート グループのステータスを監視します。VMware_ESXi_NetworkStatus
VMware_ESXi_PowerデータソースESXi ホストの電力使用量を監視します。無し
VMware_ESXi_SystemHealthSensorデータソースVMware によって報告された、ESXi ホスト上のハードウェア健全性システム センサーを監視します。 監視されるシステム センサーは、追加のストレージ、メモリ、CPU センサー、ハードウェア センサーとは別のものです。無し
VMware_ESXi_VirtualMachineDiskCapacityデータソース個々の仮想マシンの仮想ディスク ストレージ容量メトリックを監視します。VMware_vSphere_vDisk容量
VMware_ESXi_VirtualMachinePerformanceデータソースESXi 仮想マシンの CPU、ディスク、メモリ、およびネットワーク パフォーマンス メトリックを監視します。VMware_vSphere_VMパフォーマンス
VMware_ESXi_VirtualMachineSnapshotsデータソース個々の仮想マシン上のスナップショットの経過時間を監視します。VMware_vSphere_VM スナップショット
VMware_ESXi_VirtualMachineStatusデータソース電源、ハートビート、フォールト トレランス、ゲスト ツールの状態、および個々の仮想マシンの最後のパワーオンからの時間を追跡します。VMware_vSphere_VMステータス
VMware_vSphere_Network_TopologyトポロジーソースvCenter からのデータに基づいて VMware ネットワーク トポロジを生成します。VMware_vCenter_Network_Topology
VMware_vSphere_VirtualMachine_TopologyトポロジーソースvCenter からのデータに基づいて VMware 仮想マシン トポロジを生成します。VMware_vCenter_VM_トポロジ
addERI_ESXiプロパティソースホスト UUID、MAC アドレス、IQN、WWN を含む、トポロジ マッピング用の VMware ESXi ホストのデバイス外部リソース ID (ERI) を設定します。 ERI タイプ (ERT) を「ハイパーバイザー」に設定します。無し
VMware_vSphere_情報プロパティソースvSphere ホストの追加情報を提供します。VMware_ESXi_ObjectCount
VMware_vCenter_ObjectCount
VMware_LM_トラブルシューターデータソースさまざまな設定をチェックして、ESXi/vCenter 収集が適切に機能することを確認します。 発見された問題を修正する方法をユーザーに指示します。無し

VMware vCenterAppliance モジュールは、VMware vCenter Server Appliance の可用性とパフォーマンスの監視に関するデータを提供します。

表示名タイプ説明置き換え
VMware_vCenterAppliance_Backupデータソース最新のバックアップ発生からリカバリ バックアップ情報を収集します。VMware_VCSA_バックアップ
VMware_vCenterAppliance_CPUデータソースvCenter ホストの CPU 情報を監視します。VMware_VCSA_CPU
VMware_vCenterAppliance_DiskPerformanceデータソースvCenter ホストのディスク パフォーマンスを監視します。VMware_VCSA_Diskパフォーマンス
VMware_vCenterAppliance_FileSystemPartitionsデータソースvCenter ホストのファイルシステム パーティションの使用率を監視します。VMware_VCSA_ファイルシステム容量
VMware_vCenterAppliance_FileSystemSwapデータソースvCenter ホストのディスク スワップの使用率を監視します。VMware_VCSA_スワップ
VMware_vCenterAppliance_HealthStatusデータソースapplmgmt、データベース ストレージ、ロード、メモリ、ソフトウェア パッケージ、ストレージ、スワップ、システムなどのさまざまなシステム サービスの vCenter ホストの健全性ステータスを監視します。VMware_VCSA_HealthStatus
VMware_vCenterAppliance_HighAvailabilityデータソースvCenter HA (VCHA) のステータスを監視します。VMware_vCenter_AdmissionControl
VMware_vCenter_HANodeHealth
VMware_vCenter_HAステータス
VMware_vCenterAppliance_MemoryデータソースvCenter ホストのメモリ情報を監視します。VMware_VCSA_メモリ
VMware_vCenterAppliance_NetworkInterfacesデータソースvCenter ホストのネットワーク接続を監視します。VMware_VCSA_ネットワーク
VMware_vCenterAppliance_PowerデータソースvCenter 環境の合計電力使用量を監視します。無し
VMware_vCenterAppliance_ServicesデータソースvCenter ホストのサービスの実行状態を監視します。VMware_VCSA_サービス
addCategory_vCenterプロパティソースHA (VCHA) および VCSA バックアップを備えた vCenter クラスターなど、オプションの追加の vCenter 監視サービス (使用中の場合) のカテゴリを設定します。addCategory_vCenterHA
VMware_vSphere_情報プロパティソースvSphere ホストの追加情報を提供します。VMware_ESXi_ObjectCount
VMware_vCenter_ObjectCount
VMware_LM_トラブルシューターデータソースさまざまな設定をチェックして、ESXi/vCenter 収集が適切に機能することを確認します。 発見された問題を修正する方法をユーザーに指示します。無し

VMware vSphere モジュールは、vSphere 環境 (仮想マシン、クラスター、リソース プール、データストアなど) の可用性とパフォーマンスの監視を提供します。

表示名タイプ説明置き換え
VMware_vSphere_ClustersデータソースvCenter デバイス上の ESX ホスト クラスタの CPU およびメモリ メトリックを監視します。VMware_vCenter_Clusterパフォーマンス
VMware_vSphere_DatastoreClustersデータソースvCenter データストア クラスタのストレージ使用量を監視します。VMware_vCenter_DatastoreClusters
VMware_vSphere_DatastoreStatusデータソースvSphere データストアの稼働状況を監視します。VMware_vCenter_DatastoreStatus
VMware_vSphere_データストアスループットデータソースvSphere / vCenter ホストのパフォーマンス メトリックを監視します。VMware_vCenter_Datastoreパフォーマンス
VMware_vSphere_Datastoreの使用状況データソースvCenter データストアのストレージ使用量を監視します。 データは、データストアにアクセスできる場合にのみ有効です。VMware_vCenter_DatastoreCapacity
VMware_vSphere_HighAvailabilityデータソースvSphere High Availability (vSphere HA) とアドミッション コントロール (HA に利用可能なリソース、vSphere HA エージェント (FDM) で問題が発生しているかどうかなど) を監視します。VMware_vCenter_AdmissionControl
VMware_vSphere_HostStatusデータソースvCenter ESXi ホストの状態を監視します。VMware_vCenter_HostStatus
VMware_vSphere_NetworkStateデータソースvCenter ネットワークと分散仮想ポート グループのステータスを監視します。VMware_vCenter_NetworkStatus
VMware_vSphere_ResourcePoolsデータソースvCenter デバイス上のリソース プールの CPU およびメモリのメトリックを監視します。VMware_vCenter_ResourcePools
VMware_vSphere_VirtualMachineDiskCapacityデータソース個々の仮想マシンの仮想ディスク ストレージ容量メトリックを監視します。VMware_vCenter_VMDiskCapacity
VMware_vSphere_VirtualMachineNetworkInterfaceデータソース仮想マシン インターフェイスのデータ スループットとパケット送信を監視します。VMware_vCenter_VMInterface
VMware_vSphere_VirtualMachinePerformanceデータソース個々の仮想マシンの CPU、ディスク、メモリ、およびネットワークのパフォーマンス メトリックを監視します。VMware_vCenter_VMパフォーマンス
VMware_vSphere_VirtualMachineSnapshotsデータソース個々の仮想マシン上のスナップショットの経過時間を監視します。VMware_vCenter_VMSnapshots
VMware_vSphere_VirtualMachineStatusデータソース電源、ハートビート、フォールト トレランス、ゲスト ツールの状態、および個々の仮想マシンの最後のパワーオンからの時間を追跡します。VMware_vCenter_VMStatus
VMware_vCenter_Cluster_TopologyトポロジーソースvCenter からのデータに基づいて VMware クラスター トポロジを生成します。VMware_ESXi_トポロジ
VMware_vCenter_Datastore_TopologyトポロジーソースvCenter からのデータに基づいて VMware データストア トポロジを生成します。VMware_ESXi_トポロジ
VMware_vSphere_Network_TopologyトポロジーソースvCenter からのデータに基づいて VMware ネットワーク トポロジを生成します。VMware_vCenter_Network_Topology
VMware_vSphere_VirtualMachine_TopologyトポロジーソースvCenter からのデータに基づいて VMware 仮想マシン トポロジを生成します。VMware_vCenter_VM_トポロジ
addERI_vCenterプロパティソースUUID を含む、トポロジ マッピング用の VMware ESX vCenter のデバイス外部リソース ID (ERI) を設定します。 ERI タイプ (ERT) を「PhysicalServer」に設定します。無し
addCategory_vCenterプロパティソースHA (VCHA) および VCSA バックアップを備えた vCenter クラスターなど、オプションの追加の vCenter 監視サービス (使用中の場合) のカテゴリを設定します。addCategory_vCenterHA
VMware_vSphere_情報プロパティソースvSphere ホストの追加情報を提供します。VMware_ESXi_ObjectCount
VMware_vCenter_ObjectCount
VMware_LM_トラブルシューターデータソースさまざまな設定をチェックして、ESXi/vCenter 収集が適切に機能することを確認します。 発見された問題を修正する方法をユーザーに指示します。無し

When setting static datapoint thresholds on the various metrics tracked by this package’s modules, LogicMonitor follows the technology owner’s best practice KPI recommendations.

推奨事項:If necessary, we encourage you to adjust these predefined thresholds to meet the unique needs of your environment. For more information, see データポイントの静的しきい値の調整.

レガシーモジュールからの移行

現在、これらのレガシー モジュールのいずれかを使用して VMware デバイスを監視している場合、新しいモジュールのインポート時にデータが失われることはありません。 これは、モジュールの上書きを排除するためにモジュール名が変更されているためです。 詳細については、「」を参照してください。 非推奨のLogicModules.

ただし、モジュールの両方のセットがアクティブである限り、重複したデータが収集され、重複したアラートを受信することになります。 このため、vCenter Server に不要な負荷が追加されるのを避けるために、新しいモジュール セットをインポートした後に上記のモジュールを無効にし、それらが環境で意図したとおりに動作することを確認する必要があります。

推奨事項:When a DataSource is disabled, it stops querying the host and generating alerts, but maintains all historical data. You may want to delete the legacy modules altogether, but consider this move carefully as all historical data will be lost at deletion. For more information, see データソースまたはインスタンスの監視を無効にする.

記事上で