For vmware metrics, using 9 powershell scripts with powercli modules to pull metrics.
powershell scripts to read vmware status for (host, cluster, datastore, switch, network ports, storage adaptor ) percentage for ( mem overcommit, network usage) and events counts for reconfigure cluster events.
If i execute one by one in telegraf using exec plugin, i can get the outputs from command prompt and from services.
But i execute all KPI’s in telegraf, getting below errors. Please some one take a look and provide the solution for these. Thanks in advance.
telegraf conf:
[agent]
interval = “300s”
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = “0s”
flush_interval = “10s”
flush_jitter = “0s”
precision = “”
logtarget = “file”
logfile = “C:/temp/output.txt”
logfile_rotation_max_size = “10MB”
logfile_rotation_max_archives = 2
hostname =“xxx”
To get Host Status:
[[inputs.exec]]
commands = [ 'powershell -command “Connect-VIServer -Server "xxx" -User "xxx” -Password "xxx" | Out-Null; foreach ($vmh in Get-VMHost) { $hostname=$($vmh.Name); $state=$($vmh.ConnectionState); Write-Host vmhost_name="$hostname" host_state="$state" } ; Disconnect-VIServer -Confirm:$false " ']
timeout = “60s”
data_format = “logfmt”
name_override = “vcenter_host”
[[processors.converter]]
namepass = [“vcenter_host”]
[processors.converter.fields]
tag = [“vmhost_name”]
output:
C:\Program Files\Telegraf\bin>telegraf.exe --test --config …\conf\123.conf
2022-01-21T09:27:01Z I! Starting Telegraf 1.18.0
vcenter_host,host=xxx,platform=windows,vmhost_n
ame=xxx host_state=“Connected” 1642757231000
000000
Errors:
Major error:
2022-01-21T08:16:12Z E! [inputs.exec] Error in plugin: exec: command timed out for command 'powershell -command "
also received other 2 errors:
2022-01-21T07:16:02Z E! [agent] Error killing process: TerminateProcess: Access is denied.
2022-01-21T07:30:38Z W! [agent] [“outputs.kafka”] did not complete within its flush interval
Please check and let me know how to fix this issues.