寻找活动框架当前在中间层中的资源利用

rwqw0loc  于 2021-06-26  发布在  Mesos
关注(0)|答案(1)|浏览(454)

哪个http端点将帮助我找到当前资源利用率的所有活动框架?
我们需要这些信息是因为我们想要动态缩放Mesos簇,我们的算法需要关于每个活动框架正在使用什么资源的信息。

n8ghc7c1

n8ghc7c11#

我认为关注框架并不是你真正想要的。你要找的可能是mesos slave利用率,这可以通过调用请求

  1. http://{mesos-master}:5050/master/state-summary

在json答案中,您将发现 slaves 包含从属对象数组的属性:

  1. {
  2. "hostname": "192.168.0.3",
  3. "cluster": "mesos-hw-cluster",
  4. "slaves": [{
  5. "id": "bd9c29d7-8530-4c5b-8c50-5d2f60dffbf6-S2",
  6. "pid": "slave(1)@192.168.0.1:5051",
  7. "hostname": "192.168.0.1",
  8. "registered_time": 1456826950.99075,
  9. "resources": {
  10. "cpus": 12.0,
  11. "disk": 1840852.0,
  12. "mem": 63304.0,
  13. "ports": "[31000-32000]"
  14. },
  15. "used_resources": {
  16. "cpus": 5.75,
  17. "disk": 0.0,
  18. "mem": 14376.0,
  19. "ports": "[31000-31000, 31109-31109, 31267-31267, 31699-31699, 31717-31717, 31907-31907, 31979-31980]"
  20. },
  21. "offered_resources": {
  22. "cpus": 0.0,
  23. "disk": 0.0,
  24. "mem": 0.0
  25. },
  26. "reserved_resources": {},
  27. "unreserved_resources": {
  28. "cpus": 12.0,
  29. "disk": 1840852.0,
  30. "mem": 63304.0,
  31. "ports": "[31000-32000]"
  32. },
  33. "attributes": {},
  34. "active": true,
  35. "version": "0.27.1",
  36. "TASK_STAGING": 0,
  37. "TASK_STARTING": 0,
  38. "TASK_RUNNING": 7,
  39. "TASK_FINISHED": 18,
  40. "TASK_KILLED": 27,
  41. "TASK_FAILED": 3,
  42. "TASK_LOST": 0,
  43. "TASK_ERROR": 0,
  44. "framework_ids": ["bd9c29d7-8530-4c5b-8c50-5d2f60dffbf6-0000", "bd9c29d7-8530-4c5b-8c50-5d2f60dffbf6-0002"]
  45. },
  46. ...
  47. }

您可以迭代所有从属对象,并通过汇总 resources 然后减去 used_resources .
看见
http://mesos.apache.org/documentation/latest/endpoints/master/state-summary/
http://mesos.apache.org/documentation/latest/endpoints/

展开查看全部

相关问题