Check service is running or not on remote machine before run Logstash exec input plugin

The exec plugin itself can't do that, but why not perform the check from the program run by the exec plugin?