Does anyone have a sample perl script for monitoring a service within /etc/int.d?
I've struggled to find one already made and now I must learn how to create one. This would really help me get my feet firmly on the ground.
Basically, I have an asterisk Service on a remote linux server that I want to make sure is running. If not, then generate a warning or critical.
Thank you greatly
creating a perl Script to check service status
-
- Posts: 1
- Joined: Wed Oct 11, 2017 7:47 pm
Re: creating a perl Script to check service status
Just curious why you're not using the default "check_init_service" script to do that?
- tacolover101
- Posts: 432
- Joined: Mon Apr 10, 2017 11:55 am
Re: creating a perl Script to check service status
perl 4 lyfe. this is a good question though.eloyd wrote:Just curious why you're not using the default "check_init_service" script to do that?
Code: Select all
$s=(`service $ARGV[0] status`);
if ($s =~ '(running)') {
$val1="is";
$val2=1;
}
else {
$val1="is not";
$val2=0;
}