In this example, we use a Bash script with CURL to post the request to AIMS. The script will get the current CPU and UTC timestamp and use these variables in the JSON.


#!/bin/bash

while true; do
CPU=`top -b -n1 | grep "Cpu(s)" | awk '{print $2 + $4}'`
UTCDATE=`date -u '+%Y-%m-%dT%H:%M:%SZ'`

curl --location --request POST 'https://api.aimsinnovation.com/api/environments/{environmentId}/statpoints/' \
--header 'Content-Type: application/json' \
--header 'X-System: 10' \
--header 'Authorization: Basic yourkey' \
--data-raw '[
    {
        "nodeRef": {
            "nodeType": "aims.int-sys.server",
            "parts": {
                "part1": "part1value"
            }
        },
        "statType": "aims.int-sys.server-cpu",
        "time": "'"$UTCDATE"'",
        "value": "'"$CPU"'"
    }
]'
sleep 15
done