結論
環境変数を用いる。
簡易具体例
result =<<~EOM 対象サービス: #{ENV['MONIT_SERVICE']} 詳細: #{ENV['MONIT_DESCRIPTION']} EOM puts result
具体的にはドキュメントを参照のこと
MONIT_SERVICE The name of the service (from monitrc) for which the program is executed. ---------- The following environment variables are only available in the service start/stop/restart program and exec action context: MONIT_EVENT The event that occurred on the service MONIT_DESCRIPTION A description of the error condition MONIT_DATE The time and date (RFC 822 style) the event occurred MONIT_HOST The host the event occurred on