![monit restart service monit restart service](https://computingforgeeks.com/wp-content/uploads/2020/10/monit-web-page-inside.png)
If I use the part for the cronjob I become: /home/scripts/prtg.sh sinusbot_fg EAF84951-0F8E-4A69-8F75-0AA47E48B6B9
![monit restart service monit restart service](https://kb.cloudkilat.com/assets/uploads/posts/monit-3-sys.png)
I'm currently try to use the script with my values but I have only "No Data". To set this limit, select Enable alerting based on limits in the channel's settings and enter "1" in the Lower Error Limit (#) field. Set a limit on the sensor's $service status channel. You can leave the default settings for all other options.Port: 5050 (Use a different port or Identification Token for every sensor.).Create this sensor with the following settings: The response will be sent to the HTTP Push Data Advanced sensor. : (use the Port-Host combination of the configured sensor here).Note: Keep in mind that you need to adjust the path and the parameters of the crontab, like in the examples below: */5 * * * * /PATH/TO/THESCRIPT/script.sh
#Monit restart service code#
To open the CRONTAB file, enter the command crontab -e as root and paste the code into the last line. Wget -O/dev/null "$prtghost/$identtoken?content=$service status0Service: $service can't restart properly! Please take action!"Ĭreate the CRONTAB below on your Linux server to use the script. #Send response to PRTG that the restart was not successful Wget -O/dev/null "$prtghost/$identtoken?content=$service status1Service: $service restarted properly!" #Send response to PRTG that the restart was successfully If (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
![monit restart service monit restart service](https://www.atlantic.net/wp-content/uploads/2020/11/monit3-300x140.png)
Wget -O/dev/null "$prtghost/$identtoken?content=$service status0Service: $service is down, but will restart!" #Send response to PRTG that the service is not started. Wget -O/dev/null "$prtghost/$identtoken?content=$service status1Service: $service is running!" #Send response to PRTG that the service is running. If (( $(pgrep -x $service | wc -l) > 0 )) #Enter the Identification Token of the HTTP Push Data Advanced sensor. #Enter the server address of your PRTG, including HTTPS/HTTP and the sensor port. #The script also tries to restart the service if it is not started. #This script checks if a certain service is running. Save the following script on the target system, where it can be executed by CRON.
![monit restart service monit restart service](https://i.stack.imgur.com/Fw2Zj.png)
#Monit restart service how to#
This article applies as of PRTG 22 How to monitor, automatically restart, and report the current status of a Linux service