Pages

Monday, February 26, 2018

[curl] OpenBMC Watchdog

List Watchdog Objects
[curl]
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/watchdog/list

For example
[curl in Linux]
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/watchdog/list
{
  "data": [
    "/xyz/openbmc_project/watchdog/host0"
  ],
  "message": "200 OK",
  "status": "ok"
}


Enumerate of Watchdog
[curl]
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/watchdog/enumerate

For example
[curl in Linux]
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/watchdog/enumerate
{
  "data": {
    "/xyz/openbmc_project/watchdog/host0": {
      "Enabled": 1,
      "ExpireAction": "xyz.openbmc_project.State.Watchdog.Action.HardReset",
      "Initialized": 0,
      "Interval": 30000,
      "TimeRemaining": 24583
    }
  },
  "message": "200 OK",
  "status": "ok"
}


Enable or Disable Host Watchdog
[curl]
Enable
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": 1}' https://${bmc_ip}/xyz/openbmc_project/watchdog/host0/attr/Enabled
Disable
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": 0}' https://${bmc_ip}/xyz/openbmc_project/watchdog/host0/attr/Enabled

For example
[curl in Linux]
$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": 1}' https://192.168.88.38/xz/openbmc_project/watchdog/host0/attr/Enabled
{
  "data": null,
  "message": "200 OK",
  "status": "ok"
}
$ curl b cjar -k https://192.168.88.38/xyz/openbmc_project/watchdog/host0
{
  "data": {
    "Enabled": 1,
    "ExpireAction": "xyz.openbmc_project.State.Watchdog.Action.HardReset",
    "Initialized": 0,
    "Interval": 2400000,
    "TimeRemaining": 2398289
  },
  "message": "200 OK",
  "status": "ok"
}


Host Watchdog Expire Action
[curl]
Get Host Watchdog Expire Action
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/watchdog/host0/attr/ExpireAction
Set Expire Action to Hard Reset
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.State.Watchdog.Action.HardReset" }' https://${bmc_ip}/xyz/openbmc_project/watchdog/host0/attr/ExpireAction
Set Expire Action to Power Cycle
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.State.Watchdog.Action.PowerCycle" }' https://${bmc_ip}/xyz/openbmc_project/watchdog/host0/attr/ExpireAction
Set Expire Action to Power Off
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.State.Watchdog.Action.PowerOff" }' https://${bmc_ip}/xyz/openbmc_project/watchdog/host0/attr/ExpireAction

For example
[curl in Linux]
$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "xyz.openbmc_project.Stte.Watchdog.Action.PowerOff" }' https://192.168.88.38/xyz/openbmc_project/watchdog/host0/attr/ExpireAction
{
  "data": null,
  "message": "200 OK",
  "status": "ok"
}
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/watchdog/host0/attr/ExpireAction
{
  "data": "xyz.openbmc_project.State.Watchdog.Action.PowerOff",
  "message": "200 OK",
  "status": "ok"
}


Host Watchdog Interval
[curl]
Get Interval
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/watchdog/host0/attr/Interval
Set Interval
curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "<INTERVAL_ms>"}' https://${bmc_ip}/xyz/openbmc_project/watchdog/host0/attr/Interval

For example
[curl in Linux]
$ curl -c cjar -b cjar -k -H "Content-Type: application/json" -X PUT -d '{"data": "3000"}' https://192.168.88.38/xyz/openbmc_project/watchdog/host0/attr/Interval
{
  "data": null,
  "message": "200 OK",
  "status": "ok"
}
$ curl b cjar -k https://192.168.88.38/xyz/openbmc_project/watchdog/host0/attr/Interval
{
  "data": 3000,
  "message": "200 OK",
  "status": "ok"
}


Check Host Watchdog Time Remaining
[curl]
curl -b cjar -k https://${bmc_ip}/xyz/openbmc_project/watchdog/host0/attr/TimeRemaining

For example
[curl in Linux]
$ curl -b cjar -k https://192.168.88.38/xyz/openbmc_project/watchdog/host0/attr/TimeRemaining
{
  "data": 2377451,
  "message": "200 OK",
  "status": "ok"
}




Last Updated: 26-02-2018

6 comments:

  1. Awesome website. Helped us out a lot with this crazy spec.

    ReplyDelete
  2. Thank you for creating this website

    ReplyDelete
  3. thank you for making awesome stuff. it was a difficult to navigate and understand thro' this spec. this blog made things lot easier.

    ReplyDelete
  4. Great insights on using curl with OpenBMC for managing watchdog timers! For those of you in Guildford, UK looking for expert computer services, check out 1st Class Computer Services. Their team excels in providing comprehensive solutions that ensure your systems are running optimally.

    ReplyDelete