Hello,
I am trying to gather stats via a python script which generates the data in JSON format. I get following error:
2018-05-08T19:25:20Z E! Error in plugin [inputs.exec]: exec: exit status 1 for command ‘/opt/web/vmware_inventory/vmware_inventory.py --host server1’: Traceback (most recent call last):…
2018-05-08T19:25:30Z E! Error in plugin [inputs.exec]: exec: exit status 1 for command ‘/opt/web/vmware_inventory/vmware_inventory.py --host serve1’: Traceback (most recent call last):…
Here is my telegraf configuration:
[[inputs.exec]]
commands = [ “/opt/web/vmware_inventory/vmware_inventory.py --host server1” ]
Timeout for each command to complete.
timeout = “5s”
measurement name suffix (for separating different commands)
name_suffix = “_vminven”
Used by the templating engine to join matched values when cardinality is > 1
separator = “_”
Data format to consume.
Each data format has its own unique set of configuration options, read
more about them here:
telegraf/DATA_FORMATS_INPUT.md at master · influxdata/telegraf · GitHub
#data_format = “influx”
data_format = “json”
#data_format = “Value”
#data_format = “nagios”
#data_format = “dropwizard”
name_override = “vm_inven”
Here is the actual JSON output:
[root@xxxx]# /opt/web/vmware_inventory/vmware_inventory.py --host server1
{
“resourcepool”: {
“_moId”: “xxx”,
“name”: “xxx”
},
“alarmactionsenabled”: true,
“configissue”: ,
“tag”: ,
“datastore”: [
{
“_moId”: “xxxx”,
“name”: “xxxx”
}
],
“triggeredalarmstate”: ,
“layout”: {
“disk”: ,
“swapfile”: “[Store165] xxx”,
“dynamictype”: null,
“dynamicproperty”: ,
“configfile”: ,
“snapshot”: ,
“logfile”:
},
“network”: ,
“effectiverole”: [
1
],
“storage”: {
“dynamictype”: null,
“timestamp”: {},
“dynamicproperty”: ,
“perdatastoreusage”:
},
“ansible_ssh_host”: “xxxx”,
“ansible_uuid”: “xxx”,
“layoutex”: {
“dynamictype”: null,
“timestamp”: {},
“dynamicproperty”: ,
“snapshot”: ,
“file”: ,
“disk”:
},
“config”: {
“alternateguestname”: “”,
“firmware”: “bios”,
“instanceuuid”: “xxxx”,
“cpuaffinity”: null,
“repconfig”: null,
“npivdesirednodewwns”: null,
“memoryhotaddenabled”: false,
“nestedhvenabled”: false,
“hardware”: {},
“vappconfig”: null,
“tools”: {},
“migrateencryption”: “opportunistic”,
“guestfullname”: “Microsoft Windows Server 2012 (64-bit)”,
“changeversion”: “2018-05-04T19:25:47.325721Z”,
“npivportworldwidename”: ,
“uuid”: “xxx”,
“messagebustunnelenabled”: false,
“consolepreferences”: null,
“forkconfiginfo”: {},
“cpuhotremoveenabled”: false,
“vpmcenabled”: false,
“npivonnonrdmdisks”: null,
“npivworldwidenametype”: null,
“swapstorageobjectid”: null,
“managedby”: null,
“version”: “vmx-11”,
“locationid”: “xxx”,
“maxmksconnections”: 40,
“template”: false,
“guestid”: “windows8Server64Guest”,
“bootoptions”: {},
“cpufeaturemask”: ,
“hotplugmemorylimit”: 32768,
“npivnodeworldwidename”: ,
“cpuallocation”: {},
“files”: {},
“memoryreservationlockedtomax”: false,
“scheduledhardwareupgradeinfo”: {},
“dynamictype”: null,
“createdate”: null,
“dynamicproperty”: ,
“initialoverhead”: {},
“datastoreurl”: ,
“memoryaffinity”: null,
“vmxconfigchecksum”: " xxxx",
“latencysensitivity”: {},
“changetrackingenabled”: false,
“npivtemporarydisabled”: true,
“memoryallocation”: {},
“ftinfo”: null,
“guestautolockenabled”: false,
“annotation”: “”,
“defaultpowerops”: {},
“vassertsenabled”: false,
“hotplugmemoryincrementsize”: 128,
“keyid”: null,
“name”: “xxx”,
“npivdesiredportwwns”: null,
“vflashcachereservation”: 0,
“extraconfig”: ,
“networkshaper”: null,
“modified”: {},
“vmstorageobjectid”: null,
“swapplacement”: “inherit”,
“flags”: {},
“guestintegrityinfo”: null,
“cpuhotaddenabled”: false
},
“customvalue”: ,
“permission”: ,
“parentvapp”: null,
“recenttask”: ,
“availablefield”: ,
“overallstatus”: “green”,
“ansible_host”: “xxx”,
“guest”: {
“hostname”: “xxxx”,
“toolsversionstatus”: “guestToolsNeedUpgrade”,
“generationinfo”: ,
“toolsversion”: “xxx”,
“guestfullname”: “Microsoft Windows Server 2012 (64-bit)”,
“disk”: ,
“appstate”: “none”,
“guestoperationsready”: true,
“toolsrunningstatus”: “guestToolsRunning”,
“guestfamily”: “windowsGuest”,
“toolsinstalltype”: null,
“guestid”: “windows8Server64Guest”,
“net”: ,
“appheartbeatstatus”: “appStatusGray”,
“guestkernelcrashed”: null,
“dynamictype”: null,
“screen”: {},
“dynamicproperty”: ,
“interactiveguestoperationsready”: true,
“powerpolicy”: null,
“ipaddress”: “xxx”,
“gueststate”: “running”,
“toolsversionstatus2”: “guestToolsSupportedOld”,
“toolsstatus”: “toolsOld”,
“ipstack”: ,
“gueststatechangesupported”: true,
“toolsupdatestatus”: null
},
“guestheartbeatstatus”: “green”,
“name”: “rich-msql-22-pv”,
“rootsnapshot”: ,
“configstatus”: “green”,
“value”: ,
“summary”: {
“customvalue”: ,
“guest”: {},
“dynamictype”: null,
“overallstatus”: “green”,
“dynamicproperty”: ,
“storage”: {},
“vm”: {},
“quickstats”: {},
“runtime”: {},
“config”: {}
},
“capability”: {
“quiescedsnapshotssupported”: true,
“cpufeaturemasksupported”: true,
“consolepreferencessupported”: false,
“vpmcsupported”: true,
“vmnpivwwnupdatesupported”: true,
“featurerequirementsupported”: true,
“diskonlysnapshotonsuspendedvmsupported”: null,
“snapshotconfigsupported”: true,
“bootoptionssupported”: true,
“poweredonmonitortypechangesupported”: true,
“virtualmmuusageignored”: null,
“changetrackingsupported”: true,
“nestedhvsupported”: true,
“settingdisplaytopologymodessupported”: false,
“reverttosnapshotsupported”: true,
“settingvideoramsizesupported”: true,
“settingscreenresolutionsupported”: true,
“virtualmmuusagesupported”: true,
“sesparsedisksupported”: true,
“s1acpimanagementsupported”: true,
“virtualexecusageignored”: null,
“poweredoffsnapshotssupported”: true,
“disksharessupported”: true,
“dynamictype”: null,
“vmnpivwwndisablesupported”: true,
“disablesnapshotssupported”: false,
“canconnectusbdevices”: null,
“pervmevcsupported”: null,
“swapplacementsupported”: true,
“bootretryoptionssupported”: true,
“memoryreservationlocksupported”: true,
“toolsrebootpredictsupported”: null,
“dynamicproperty”: ,
“recordreplaysupported”: true,
“settingdisplaytopologysupported”: true,
“locksnapshotssupported”: true,
“npivwwnonnonrdmvmsupported”: true,
“guestautolocksupported”: true,
“toolsautoupdatesupported”: true,
“multiplecorespersocketsupported”: true,
“securebootsupported”: null,
“multiplesnapshotssupported”: true,
“snapshotoperationssupported”: true,
“toolssynctimesupported”: true,
“hostbasedreplicationsupported”: true,
“messagebussupported”: false,
“vmnpivwwnsupported”: true,
“memorysnapshotssupported”: true,
“vmfsnativesnapshotsupported”: false
},
“snapshot”: null,
“runtime”: {
“powerstate”: “poweredOn”,
“paused”: false,
“featuremask”: ,
“instantclonefrozen”: null,
“onlinestandby”: false,
“snapshotinbackground”: false,
“cleanpoweroff”: null,
“featurerequirement”: ,
“question”: null,
“boottime”: {},
“maxmemoryusage”: 32768,
“offlinefeaturerequirement”: ,
“minrequiredevcmodekey”: “intel-merom”,
“suspendinterval”: 0,
“dynamicproperty”: ,
“quiescedforkparent”: null,
“dynamictype”: null,
“memoryoverhead”: null,
“vflashcacheallocation”: 0,
“cryptostate”: null,
“host”: {
“_moId”: “host-xxxx”,
“name”: “xxxxx”
},
“maxcpuusage”: 37188,
“device”: ,
“suspendtime”: null,
“recordreplaystate”: “inactive”,
“toolsinstallermounted”: false,
“consolidationneeded”: false,
“connectionstate”: “connected”,
“needsecondaryreason”: null,
“dasvmprotection”: {},
“faulttolerancestate”: “notConfigured”,
“nummksconnections”: 0
}
}
What is the best way to parse above data?