Hello, I am trying to run a script that returns a value of either 0 when a service is not running and 1 when it's running however i am a little lost as to how to go about it. Currently i have module that returns a string value with the status of a service like tentacle. Below is the module.
module_begin
module_name tent_status
module_type generic_data_string
module_interval 1
module_exec service tentacle_serverd status
module_description Status of tentacle Server
module_end
however this doesn't help me because when a process restarts it changes PIDs hence making it difficult to set a critical/warning status for it. I hence wrote a shellscript that returns a numerical value 1 if the service status contains a string like "is running" and 0 if it doesn't contain it.
#! /bin/bash
serVar=`service tentacle_serverd status`
statVar="is running"
if [[ "$serVar" == *"$statVar"* ]]
then echo 1
else echo 0
fi
I was wondering which directory i would have to place it so that i can run it through a module. Or am i going about it the wrong way. For example. module_begin module_name tent_status module_type generic_data module_interval 1 module_exec ~/Documents/tentacle.sh module_description check status of tentacle module_end Thanks for any help you can give.
