Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can execute nagios commands from command line in linux

I am using nagios o centos server and i only want to monitor the localhost only.

I have defined my service like this

define service{
 host_name  localhost
 service_description Site1Service
 check_command  check_http-site1
 use   generic-service
 notification_interval 1440
}

and

command like this in commands.cfg

define command{
 command_name check_http-site1
 command_line /usr/lib/nagios/plugins/check_http -H site1.dreaddomain.com
}

I am getting critical error in there. so i want to check from command line if that service is running or not

like image 331
user2424160 Avatar asked Feb 16 '23 23:02

user2424160


1 Answers

You actually have the answer in your config - just execute in shell:

/usr/lib/nagios/plugins/check_http -H site1.dreaddomain.com

You may add -v for verbose output.

Nagios is only a scheduler and executes commands at specified intervals. Then reports the state based on response.

like image 73
Alexy Avatar answered Feb 27 '23 09:02

Alexy