# Resource data collection from windows servers to Elasticsearch using cURL & JSON

**URL:** <https://discuss.elastic.co/t/resource-data-collection-from-windows-servers-to-elasticsearch-using-curl-json/55891>\
**Category:** Elasticsearch\
**Created:** [July 19, 2016, 3:25pm UTC](https://discuss.elastic.co/t/resource-data-collection-from-windows-servers-to-elasticsearch-using-curl-json/55891 "2016-07-19T15:25:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajkumar3v](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rajkumar3v](https://discuss.elastic.co/u/rajkumar3v)\
**Post date:** [July 19, 2016, 3:25pm UTC](https://discuss.elastic.co/t/resource-data-collection-from-windows-servers-to-elasticsearch-using-curl-json/55891/1 "2016-07-19T15:25:23Z")

</div>

Hi guys,

We have made a custom shell scripts to collect resource allocation, utilization data from Linux servers and pushing it to elastic and its runningsuccessfully. But not succeed on windows servers with same method due to parsing and limitation of json support on windows powershell.

Just consider my below script as sample format and looking someone help to make it work bez i am new to powershell scripting and JSON

Hear the above JSON format is not support directly in powershell. how to sort out this issue? or let me know how to collect similar data from windows server to elastic

cpu\_utilization=C:\script\cpu.ps1  
mem\_utilization=C:\script\mem.ps1  
disk\_utilization=C:\script\disk.ps1  
total\_cpu=C:\script\totcpu.ps1  
total\_mem=C:\script\totmem.ps1  
total\_disk=C:\script\totdisk.ps1  
tenant\_id=C:\script\tenant.ps1  
server\_id=C:\script\server\_id.ps1  
appProfile\_id=C:\script\app\_id.ps1  
dt\_milli=Get-date

curl -XPUT [http://10.5.5.5:9200/cloud/server-utilization/${host}\_${dt\_id}](http://10.5.5.5:9200/cloud/server-utilization/%24%7Bhost%7D_%24%7Bdt_id%7D) -d '  
{  
"cpu\_util" : '${cpu\_utilization}',  
"mem\_util" : '${mem\_utilization}',  
"disk\_util" : '${disk\_utilization}',  
"hostname" : "'${host}'",  
"tot\_cpu" : "'${tot\_cpu}'",  
"tot\_mem" : "'${tot\_mem}'",  
"tot\_disk" : "'${tot\_disk}'",  
"timestamp" : "'${dt\_id}'",  
"time\_milli" : '${dt\_milli}',  
"tenant\_id" : "'${tenant\_id}'",  
"server\_id" : "'${server\_id}'",  
"app\_id" : "'${appProfile\_id}'",  
"uptime" : "'${uptime\_duration}'"  
}'

Thanks in advance,  
Raj

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 20, 2016, 8:55am UTC](https://discuss.elastic.co/t/resource-data-collection-from-windows-servers-to-elasticsearch-using-curl-json/55891/2 "2016-07-20T08:55:54Z")

</div>

Why not just use topbeat?  
[https://www.elastic.co/guide/en/beats/topbeat/current/index.html](https://www.elastic.co/guide/en/beats/topbeat/current/index.html)

---

<div class="post-metadata">

**Author:** ![rajkumar3v](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@rajkumar3v](https://discuss.elastic.co/u/rajkumar3v)\
**Post date:** [July 21, 2016, 2:52pm UTC](https://discuss.elastic.co/t/resource-data-collection-from-windows-servers-to-elasticsearch-using-curl-json/55891/3 "2016-07-21T14:52:10Z")

</div>

Hello Mark Walkom,

I have checked with Metricbeat & topbeat, Both are similar in the way of metric collection.  
they are able to collect "total allocated memory" but "total allocated CPU" is NOT available and It is top most required.

Another thing is unable to assign custom ID for my servers and tenant.

Thank you,  
RAj

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:33pm UTC](https://discuss.elastic.co/t/resource-data-collection-from-windows-servers-to-elasticsearch-using-curl-json/55891/4 "2017-07-05T22:33:39Z")

</div>


