If you want to stay in Python, you can achieve the same end result by using Python's socket module to try and connect to a given host and port to determine whether or not the port that a service is listening behind, is open.Ī Python package or tool for monitoring network services on other hosts like this probably already exists. ![]() Run the script every once in a while to check up on the services, and do your thing. If you are only dealing with network services with exposed ports:Ī very simple solution would involve using a script and a port scanner (nmap) if a port that a service is listening behind, is open, then we can assume that the service is running. From the top of my head, here are some ideas: ![]() If you want to check whether or not a process is running on another host, there are many ways to approach this problem, and the solution depends on how deep you want to go (or need to go), and what your local situation is. As far as I know, psutil can only be used for gathering information about local processes, and is not suitable for retrieving information about processes running on other hosts.
0 Comments
Leave a Reply. |