TritonDataCenter / triton-cmon

The Metric Agent Proxy for Triton's Container Monitor https://github.com/joyent/rfd/blob/master/rfd/0027/README.md
Mozilla Public License 2.0
6 stars 12 forks source link

triton-cmon#37 Want stopped instances to be discoverable #36

Closed blackwood821 closed 2 years ago

blackwood821 commented 2 years ago

The default behavior will remain unchanged but you can opt-in to discover stopped instances in addition to running instances via a new discover_include_stopped SAPI configuration parameter.

blackwood821 commented 2 years ago

@bahamat I made your suggested change.

blackwood821 commented 2 years ago

@bahamat I made your suggested changes.

bahamat commented 2 years ago

There's an image in the experimental channel. Can you try it out and make sure it's behaving as you expect?

blackwood821 commented 2 years ago

@bahamat I'm testing the image now:

[root@headnode (neptune) ~]# sdcadm avail -C experimental cmon
SERVICE  IMAGE                                 VERSION
cmon     cc8b9f68-3620-4e6e-88d2-a19489348a09  cmon@PR-36-20220222T220200Z-g141d707
[root@headnode (neptune) ~]# sdcadm update -C experimental cmon
Finding candidate update images for the "cmon" service.
Using channel experimental

This update will make the following changes:
    download 1 image (60 MiB):
        image cc8b9f68-3620-4e6e-88d2-a19489348a09
            (cmon@PR-36-20220222T220200Z-g141d707)
    update "cmon" service to image cc8b9f68-3620-4e6e-88d2-a19489348a09
        (cmon@PR-36-20220222T220200Z-g141d707):
        instance "29439549-5a40-4273-b8d5-772c1472161c" (cmon0) on server 5c2e28ab-b9e2-d8e5-18fc-94c691a3baae

Would you like to continue? [y/N] y

Create work dir: /var/sdcadm/updates/20220223T135755Z
Downloading image cc8b9f68-3620-4e6e-88d2-a19489348a09
    (cmon@PR-36-20220222T220200Z-g141d707)
Imported image cc8b9f68-3620-4e6e-88d2-a19489348a09
    (cmon@PR-36-20220222T220200Z-g141d707)
"cmon" VM already has a delegate dataset
Updating image for SAPI service "cmon"
    service uuid: 56d0225b-d9a6-4dda-b51d-cf9d1df2c296
Installing image cc8b9f68-3620-4e6e-88d2-a19489348a09
    (cmon@PR-36-20220222T220200Z-g141d707)
Reprovisioning VM 29439549-5a40-4273-b8d5-772c1472161c on server 5c2e28ab-b9e2-d8e5-18fc-94c691a3baae
Waiting for cmon instance 29439549-5a40-4273-b8d5-772c1472161c to come up
Updated successfully (elapsed 42s).
[root@headnode (neptune) ~]# sdcadm insts cmon
INSTANCE                              SERVICE  HOSTNAME  VERSION                          ALIAS
29439549-5a40-4273-b8d5-772c1472161c  cmon     headnode  PR-36-20220222T220200Z-g141d707  cmon0
blackwood821 commented 2 years ago

@bahamat I've tested the experimental image using the following values for discover_include_stopped:

  1. "true"
  2. "false"
  3. "foobar"
  4. value not present in SAPI

All scenarios worked as expected where stopped containers were only included in the discover response for test case 1.

blackwood821 commented 2 years ago

@bahamat I made your suggested changes and tested them. I also stepped through the new code in the debugger and verified that the cache entry for a VM that transitions from running to stopped gets removed when discover_include_stopped is not enabled.