Scraping conditionally

Is there a way to scrape only if certain conditions are met? For example, I am running Grafana Agent on some SQL Server servers that are in a cluster. The SQL Server instance name is the same for all of these servers however the service is only running on one of them at any given time. (the current owner of the cluster).

Would it be possible to have Grafana Agent scrape the SQL Server only if say, the service is running? or if the port is currently open on that server? or any other thing that could be used conditionally?

1 Like