I have an inventory provides for storing the hardware version, “hw_version” (appears issuing “mender show-provides”). I would like to update that value from the client side when a script reads GPIO inputs.
It looks like “mender send-inventory” could be what I’m looking for, but not entirely how to use it properly (what the command options and options are).
Thanks for reaching out. Its actually really simple, just add an executable file to /usr/share/mender/inventory which outputs the desired information as key-value pairs and the client will take care of the rest. Find more information here: Inventory | Mender documentation
Thank you for the reply! A few follow up questions:
During the build process, I have “hw_version” defined (MENDER_ARTIFACT_PROVIDES:append = “hw_version:0.1”), does that need to be removed in order for “hw_version” value to be update later using new executable in /usr/share/mender/inventory?
I created “mender-inventory-hardware” (executable) and added “hw_version2=0.2” as a test. How long does it usually take to see the update on the Mender Server? Does “mender send-inventory” cause it to immediately updated?
For 1), I’m not completely sure. However, the rationale should not be to tinker with the results or output, but adjust the information generation as required. Hence, if the provides tag shows up in the inventory thought you want to modify it, you should either remove it from the artifact generation (easy) or adjust the partial script which places it in the inventory (slightly more complicated).
For 2), it will be updated at the next inventory update poll cycle, by default 28800 seconds IIRC. And yes, mender send-inventory should have the effect immediately.
Thank you for your help, the updating of the inventory is working.
I do have one issue and maybe should start another thread for this, but I removed the previous provides from the artifact generation(MENDER_ARTIFACT_PROVIDES:append = “hw_version:0.1”), created a release and deployment, but the removed artifact generated provides value is still appearing along side the new value that is stored in mender-inventory-hardware.