# Can't show inventory information on Hosted Mender

**URL:** <https://hub.mender.io/t/cant-show-inventory-information-on-hosted-mender/3735>\
**Category:** General Discussions\
**Created:** [June 11, 2021, 11:31am UTC](https://hub.mender.io/t/cant-show-inventory-information-on-hosted-mender/3735 "2021-06-11T11:31:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hancerli](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/hancerli/32/1185_2.png) [@hancerli](https://hub.mender.io/u/hancerli)\
**Post date:** [June 11, 2021, 11:31am UTC](https://hub.mender.io/t/cant-show-inventory-information-on-hosted-mender/3735/1 "2021-06-11T11:31:34Z")

</div>

Hi there,

I’m experiencing very strange behavior with the inventory script below. ( **mycommand** returns the following same JSON assigned to the vitals2 variable)

```auto
#!/bin/bash

vitals=$(mycommand)
echo "vitals='${vitals}'"
echo "vitals='{\"\":{\"info\":{},\"last_status\":{\"free\":-1,\"usage\":-1}},\"cpu_info\":{\"info\":{},\"last_status\":{\"free\":77.29083251953125,\"usage\":22.709163665771484}},\"ext_comp_info\":{},\"firmware_info\":{\"info\":{\"version\":\"v2.0.1-rc13\"},\"last_status\":{}},\"hdd_info\":{\"info\":{\"brand\":\"M62704\",\"model\":\"none\",\"serial\":\"0x164db72c\"},\"last_status\":{\"free\":54.70341873168945,\"free_raw\":1955632,\"usage\":45.29658126831055,\"usage_raw\":1619340}},\"os_info\":{\"info\":{\"arch\":\"armv7l\",\"dist_info\":\"#1SMPPREEMPTTueJul222:57:18+032019\",\"endianness\":\"little\",\"kernel_version\":\"4.14.108-ti-r108\",\"machine_name\":\"centrisv2\"},\"last_status\":{}},\"ram_info\":{\"info\":{},\"last_status\":{\"free\":66.53024291992188,\"free_raw\":330980,\"usage\":33.46975326538086,\"usage_raw\":166508}},\"swap_info\":{\"info\":{},\"last_status\":{\"free\":null,\"free_raw\":0,\"usage\":null,\"usage_raw\":0}},\"thermal_info\":{\"info\":{},\"last_status\":{\"temperature\":0}},\"uptime_info\":{\"info\":{},\"last_status\":{\"currentEpoch\":1623409763653,\"deviceDate\":\"11.06.2021\",\"deviceTime\":\"14:09:23\",\"uptime\":\"2325739\"}}}'"

```

And here’s the script output and Mender screenshot.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/0/0121322ec4dbab58045898ebc19f97ad577053fa.png)  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/mender/original/2X/f/ffb33de81960771a33567bb4df000009a5129132.png)

So as you can see from the script, on the third line I get the command output and echo it, and on the next line, I copied the command output and assigned it to the **vitals2** variable and echoed it as well. The script output is shown in the first image.

The issue is **vitals** variable shown empty on the Mender while **vitals2** has the proper content.

Any ideas?

---

<div class="post-metadata">

**Author:** ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)\
**Post date:** [June 11, 2021, 1:14pm UTC](https://hub.mender.io/t/cant-show-inventory-information-on-hosted-mender/3735/2 "2021-06-11T13:14:31Z")

</div>

My best guess is that some kind of shell globbing, wildcarding, or other parsing is taking place resulting in odd behavior. I think there are bash options to turn those off which may help. But the first step I would take is to replace the complicated JSON string with just a simple “HELLOWORLD” string or some such and make sure everything works as expected, and then back into the JSON string to see if you can figure out which part of the string is causing the issue.  
Drew

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [June 11, 2021, 3:10pm UTC](https://hub.mender.io/t/cant-show-inventory-information-on-hosted-mender/3735/3 "2021-06-11T15:10:31Z")

</div>

Have you checked that ‘mycommand’ is writing to stdout in case its actually outputting to stderr?

---

<div class="post-metadata">

**Author:** ![hancerli](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/hancerli/32/1185_2.png) [@hancerli](https://hub.mender.io/u/hancerli)\
**Post date:** [June 13, 2021, 10:21am UTC](https://hub.mender.io/t/cant-show-inventory-information-on-hosted-mender/3735/4 "2021-06-13T10:21:56Z")

</div>

@drewmoseley thanks for the suggestion. Even disabling the globbing didn’t help at all. Also, it doesn’t matter if **mycommand** returns a simple JSON or the one in the example, it is not shown on the mender.

@dellgreen thanks for the comment. And yes I’m sure it writes to the stdout, not to the stderr.

What’s more interesting is, I encoded the JSON with base64 or base32 to prevent any special characters from bugging the system, but even in this case some of the content was missing on the mender. Sometimes half of the string arrives, and sometimes the last 4 or 5 characters.

Drives me mad.

---

<div class="post-metadata">

**Author:** ![dellgreen](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/dellgreen/32/85_2.png) [@dellgreen](https://hub.mender.io/u/dellgreen)\
**Post date:** [June 13, 2021, 11:07am UTC](https://hub.mender.io/t/cant-show-inventory-information-on-hosted-mender/3735/5 "2021-06-13T11:07:16Z")

</div>

can you share the version info for the client as server you are using, as its sounds like maybe something isn’t flushing its buffers correctly under certain conditions as its not content specific.

in the meantime you could play with the http api to test uploading inventory info as this would narrow the problem to whether its the client or server.

---

<div class="post-metadata">

**Author:** ![hancerli](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/hancerli/32/1185_2.png) [@hancerli](https://hub.mender.io/u/hancerli)\
**Post date:** [June 14, 2021, 7:21am UTC](https://hub.mender.io/t/cant-show-inventory-information-on-hosted-mender/3735/6 "2021-06-14T07:21:22Z")

</div>

**Mender client:** fbed1ef runtime: go1.14.7  
**Mender host:** v2.6.1

I’ll go through the http api 👍
