Check if a pipeline is running with the monitoring APIs?

Is there a way to know if a pipeline has failed with the monitoring APIs - or any other API?

My issue is that the file output plugin "freezes" when the target volume is full. Hence, I want my log rotator to check if a pipeline is frozen, and if it is, restart logstash. I thought I could do it with the API, but haven't found the right endpoint.

What about monitoring via the Metricbeat Module ? Also can you not parse the logs directly to Elasticsearch via the Filebeat Module and alert & trigger on error messages?

I don't see how the way I collect the metrics is relevant? I'm under the impression that the information about whether a pipeline is running or not is not present in the metrics, regardless of how they're collected. What's more, since my end goal is to restart Logstash, I don't really want to do this remotely from ES but rather be directly from the host where Logstash is running.