How to configure SAM to monitor containers or local instances ?
Monitoring IRIS through SAM (sam:1.0.0.115)
While I've used to make it work in the past, I'm not able any more to fix the already faced issue : "State: Unreachable"
Despite all the ip-addresses attempts (or hostname = host.docker.internal) and while "/api/monitor/metrics" is running well...
Could someone provide good practices to make it work cleanly ?
Product version: IRIS 2022.1
$ZV: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2022.1 (Build 114U) Mon Jan 31 2022 01:58:06 EST
It's not a big issue, to make it work. Just keep in mind that both containers, with SAM and monitored system, have to be in the same docker's network. If you run both images in with docker-compose, they by default will get the same network, so, in most cases, you may use IRIS service's name from docker-compose.yml as a hostname, and it will be able to connect to it internally inside that network.
If you need access from dockerized SAM to a dockerized IRIS, both working in different networks, you have to publish ports for IRIS, so, it should be available from the host, but from the docker, your SAM has to know the host's address and host.docker.internal is a way, to give it to him. And port should be the same as published when docker container is running.
When docker container is started with -p param, which says how to publish the port, possible to say, which IP to select, or select all for instance
-p 0.0.0.0:52273:52273
docker ps, may help with understanding how the container is available
8d8977f9d5f8 intersystemsdc/iris-community:preview "/tini -- /iris-main…" 6 days ago Up 3 days (healthy) 0.0.0.0:1972->1972/tcp, 2188/tcp, 53773/tcp, 0.0.0.0:52773->52773/tcp, 54773/tcp iris
if it shows something like 127.0.0.1:52773->52773, it will only be available as localhost or 127.0.0.1 and will not be accessible from another container and network, because of host.docker.internal will refer to another ip
Could you explain, how you running all the parts?
Thanks Dmitry for your reply.
Actually, I know all of this ; that's why I don't understand why it's not working any more...
Then I create a cluster + a target on my local instance (non-container) :
I check that /api/monitor/metrics runs well :
For containers, I'm using docker-compose.
I've tried with SAM in the same yml file to get everything in the same network, but, nothing is working (0.0.0.0, etc.)
127.0.0.1 will not work, due to it's still different host, and in case of this sam bundle, it should point to sam's iris. And will not work it, because, it should be available for prometheus container, not just for IRIS container for sam. So, you have to use, it's name as a host
iris
And to access, some IRIS external to docker, you may use
host.docker.internal
hostname, ordocker.for.mac.localhost
with Docker on macOSSo, the first line is points to SAM's IRIS, and second to an IRIS outside
I think
host.docker.internal
was added in some recent versions of Docker, so, probably check the version of DockerI'm running the very last version of Docker : 4.5.0 (74594)
docker.for.mac.localhost : same result
Same result with host.docker.internal :
So, host.docker.internal is 192.168.65.2 and it's the same network as in settings, but this IP is used to get access from the virtual docker's environment
Could you try to use one of your real host's IP, which comes from Wi-Fi for instance
my wifi gives me IP 192.168.1.170, and it works
ping and wget works well from SAM containers (tested from prometheus or nginx containers) ; I'm able to reach each IRIS instances (containers and non-containers).
But from the SAM UI, I'm still facing unreachable errors.
Maybe prometheus logs, have something that may help
After a reboot I'm now again able to reach 1 local instance (out of 2) and 0 containers + the IRIS-SAM instance.
isc_prometheus.yml