Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
2
votes
2
answers
2075
views
Displaying messages to tty using whiptail through monit
I would like to display a [`whiptail`](http://manpages.ubuntu.com/manpages/intrepid/man1/whiptail.1.html) message on the login screen that is triggered by `monit`, but I am without luck. I understand it might be something to do with interactive/non-interactive shell. Here is the script that gets tri...
I would like to display a [
whiptail
](http://manpages.ubuntu.com/manpages/intrepid/man1/whiptail.1.html) message on the login screen that is triggered by monit
, but I am without luck.
I understand it might be something to do with interactive/non-interactive shell. Here is the script that gets triggered by monit
.
#!/bin/bash
/usr/bin/whiptail --infobox 'Hello World.' 7 25 >/dev/tty1
Is there a trick, or should I avoid using whiptail?
Yuri
(121 rep)
Jul 24, 2013, 11:59 PM
• Last activity: Apr 18, 2025, 05:04 AM
0
votes
1
answers
47
views
Send monit alert at most once in Linux?
My script to send sms #send-sms.sh curl "http://10.10.10.10:1084/somerandomhexcode&username=username@goes.here&password=passwordgOesHere&countryCode=countrycodegoeshere&mobileNumber=%2bphone_number_with_country_code_goes_here&message=message_goes_here" I've tested this script independently and it se...
My script to send sms
#send-sms.sh
curl "http://10.10.10.10:1084/somerandomhexcode&username=username@goes.here&password=passwordgOesHere&countryCode=countrycodegoeshere&mobileNumber=%2bphone_number_with_country_code_goes_here&message=message_goes_here "
I've tested this script independently and it sends SMS successfully.
My monit config to check if a certain glassfish domain is down:
check host DOMAIN_I_WANT_TO_CHECK with address 127.0.0.1
if failed port 10080 then exec "/root/send-sms.sh"
send-sms.sh
is executable with chmod 777
.
Imagine a scenario where the server goes down at 11 PM till 5AM, and alert keeps going every 60 seconds. It'll be an absolute nightmare. How do I avoid such scenarios?
achhainsan
(543 rep)
Mar 10, 2024, 03:18 PM
• Last activity: Feb 15, 2025, 01:11 PM
0
votes
2
answers
435
views
server monitoring / intrusion detection for home NAS
I'm looking for some kind of monitor or intrusion detection to monitor my NAS. The following things I would like to monitor: 1. Incoming network traffic (source -> Router -> NAS) from another 1. country -> E-Mail Alert New users have been created on the system -> 1. E-Mail Alert Unexpectedly high I...
I'm looking for some kind of monitor or intrusion detection to monitor my NAS.
The following things I would like to monitor:
1. Incoming network traffic (source -> Router -> NAS) from another
1. country -> E-Mail Alert New users have been created on the system ->
1. E-Mail Alert Unexpectedly high I / O load -> E-Mail Alert monitoring
1. service (Apache, MySQL, etc.) -> E-Mail Alert / Service restart
The service monitoring, point 4, I could solve with Monit . But what about the other points?
Is there something ready or does anyone have ideas how something could work together, for example, with Monit?
For example, to point 2, I would like to observe changes to a file which all users may update, e.g., passwd.
I am grateful for suggestions or solutions.
Floyd
(101 rep)
Aug 6, 2015, 02:40 PM
• Last activity: Aug 11, 2024, 09:47 AM
3
votes
2
answers
1702
views
Who changes `/proc/sys/kernel/random/boot_id` in Linux (SLES)?
Well, I thought it's just logical that the kernel changes `/proc/sys/kernel/random/boot_id` during boot, and then keeps that value while running. At least that would make sense to me if the intended use of `boot_id` is to find out *when* the machine rebooted. When monitoring the file using `monit`,...
Well, I thought it's just logical that the kernel changes
/proc/sys/kernel/random/boot_id
during boot, and then keeps that value while running.
At least that would make sense to me if the intended use of boot_id
is to find out *when* the machine rebooted.
When monitoring the file using monit
, I noticed that the file seems to change even if the machine did not reboot; that means the timestamp of the file changes, not the contents.
So I wonder who changes the file's timestamps.
For reference, here's my monit configuration being used:
~~~lang-monitrc
check file bootid with path /proc/sys/kernel/random/boot_id
#if changed timestamp then alert
if content !=
"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
then alert
if changed checksum then alert
group local
~~~
When checking the monitoring results I got:
~~~lang-text
File 'bootid'
status OK
monitoring status Monitored
monitoring mode active
on reboot start
permission 444
uid 0
gid 0
size 0 B
access timestamp Tue, 07 May 2024 11:01:31
change timestamp Tue, 07 May 2024 11:01:31
modify timestamp Tue, 07 May 2024 11:01:31
content match no
checksum d174a6b860689b62417af5eccd2b17ee (MD5)
data collected Tue, 07 May 2024 11:46:11
~~~
Cross-checking I got:
~~~lang-text
# stat /proc/sys/kernel/random/boot_id
File: '/proc/sys/kernel/random/boot_id'
Size: 0 Blocks: 0 IO Block: 1024 regular empty file
Device: 4h/4d Inode: 9770501 Links: 1
Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2024-05-07 11:01:31.721335498 +0200
Modify: 2024-05-07 11:01:31.721335498 +0200
Change: 2024-05-07 11:01:31.721335498 +0200
Birth: -
# uptime
11:49am up 14 days 0:49, 4 users, load average: 0.00, 0.00, 0.00
~~~
The system is running SLES12 SP5 on x86_64, and the only "suspects" are cron-jobs and "snapper":
~~~lang-journal
May 07 11:00:01 v04 systemd: Started Session 7426 of user root.
May 07 11:00:01 v04 systemd: Started Session 7428 of user root.
May 07 11:00:01 v04 systemd: Started Session 7427 of user root.
May 07 11:00:01 v04 CRON: (root) CMD ([ -x /usr/lib64/sa/sa1 ] && exe
May 07 11:00:01 v04 run-crons: suse.de-snapper: OK
~~~
U. Windl
(1715 rep)
May 7, 2024, 10:00 AM
• Last activity: May 17, 2024, 10:08 AM
0
votes
2
answers
5974
views
How to check if a web server is reachable in Linux?
I want to poll every few minutes if an external web server is reachable from the Linux server. Assume the server is 10.20.30.40. I'm following this guide. https://www.baeldung.com/linux/hosts-network-availability The server is not pingable although it is reachable. Meaning ping will not succeed. Sad...
I want to poll every few minutes if an external web server is reachable from the Linux server.
Assume the server is 10.20.30.40.
I'm following this guide.
https://www.baeldung.com/linux/hosts-network-availability
The server is not pingable although it is reachable.
Meaning ping will not succeed.
Sadly netcat isn't installed.
But I can telnet the server at port 443
achhainsan
(543 rep)
Dec 11, 2023, 09:40 AM
• Last activity: Dec 11, 2023, 10:05 AM
2
votes
1
answers
1804
views
How can I monitor load average CPU other servers via monit tools?
How can I monitor load average CPU other servers via monit tools? this example shows the only localhost. check System my_server if loadavg (1min) > 4 then alert if loadavg (5min) > 2 then alert if memory usage > 12% then alert if swap usage > 25% then alert if cpu usage (user) > 80% then alert if cp...
How can I monitor load average CPU other servers via monit tools?
this example shows the only localhost.
check System my_server
if loadavg (1min) > 4 then alert
if loadavg (5min) > 2 then alert
if memory usage > 12% then alert
if swap usage > 25% then alert
if cpu usage (user) > 80% then alert
if cpu usage (system) > 30% then alert
if cpu usage (wait) > 20% then alert
pyramid13
(639 rep)
Feb 8, 2018, 08:28 AM
• Last activity: Mar 13, 2021, 09:14 PM
1
votes
0
answers
1123
views
Check systemd unit with monit
I need to check a program that has a systemd unit under user namespace and this is my monit conf (systemd conf works without any problem): ``` check program foo with path "/usr/bin/systemctl --user -q is-active foo" as uid pioz and gid pioz start program = "/usr/bin/systemctl --user start foo" as ui...
I need to check a program that has a systemd unit under user namespace and this is my monit conf (systemd conf works without any problem):
check program foo with path "/usr/bin/systemctl --user -q is-active foo" as uid pioz and gid pioz
start program = "/usr/bin/systemctl --user start foo" as uid pioz and gid pioz
stop program = "/usr/bin/systemctl --user stop foo" as uid pioz and gid pioz
if status != 0 then restart
if 5 restarts within 5 cycles then timeout
This conf does not work because I get the error Failed to connect to bus: No such file or directory
. I get the same error if I run the follow command sudo /usr/bin/systemctl --user -q is-active foo
, so seems that the directive as uid pioz and gid pioz
does not work. If I change the config like this, all works well.
check program foo with path "/bin/su -c '/usr/bin/systemctl --user -q is-active foo' pioz"
start program = "/bin/su -c '/usr/bin/systemctl --user start foo' pioz"
stop program = "/bin/su -c '/usr/bin/systemctl --user stop foo' pioz"
if status != 0 then restart
if 5 restarts within 5 cycles then timeout
Any idea why as uid
does not work?
Pioz
(103 rep)
Sep 21, 2020, 07:18 AM
15
votes
3
answers
10063
views
What command in monitrc can I use to start/stop systemd services?
I like using monit for the web interface where I can see running monitored processes. I recently upgraded a server to Ubuntu 16.04 and it is using systemd. I have everything else running but I cannot find the right monit commands to control systemd... I used to do `/etc/init.d/process start` or `sto...
I like using monit for the web interface where I can see running monitored processes. I recently upgraded a server to Ubuntu 16.04 and it is using systemd.
I have everything else running but I cannot find the right monit commands to control systemd...
I used to do
/etc/init.d/process start
or stop
or whatever. That obivously no longer works so I tried ...
systemctl start process
which didn't work either. What can I do here? My monitrc is pasted below...(old style which worked on 14.04)
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
check process sshd with pidfile /var/run/sshd.pid
start program = "etc/init.d/ssh start"
stop program = "etc/init.d/ssh stop"
Joff
(393 rep)
Nov 18, 2016, 03:54 AM
• Last activity: May 21, 2020, 08:59 AM
12
votes
1
answers
6515
views
Install monit in Debian 10 (buster)
I try to install `monit` in Debian Buster, but it sais Package monit is not available, but is referred to by another package. How do I find out this referenced package? Or do I need to install an alternative monitoring too in buster?
I try to install
monit
in Debian Buster, but it sais
Package monit is not available, but is referred to by another package.
How do I find out this referenced package? Or do I need to install an alternative monitoring too in buster?
rubo77
(30435 rep)
Mar 23, 2020, 06:11 AM
• Last activity: Mar 27, 2020, 11:08 AM
1
votes
0
answers
749
views
Issues when installing Monit
I have recently been trying to install Open Media Vault along with exFAT support (exfat-fuse and exFAT-utils), however, when Monit tries to install it returns with the following error: sudo apt install exfat-fuse Reading package lists... Done Building dependency tree Reading state information... Don...
I have recently been trying to install Open Media Vault along with exFAT support (exfat-fuse and exFAT-utils), however, when Monit tries to install it returns with the following error:
sudo apt install exfat-fuse
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
exfat-utils
The following NEW packages will be installed:
exfat-fuse exfat-utils
0 upgraded, 2 newly installed, 0 to remove and 14 not upgraded.
1 not fully installed or removed.
Need to get 67.7 kB of archives.
After this operation, 260 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.datamossa.io/raspbian buster/main armhf exfat-fuse armhf 1.3.0-1 [27.5 kB]
Get:2 http://mirror.datamossa.io/raspbian buster/main armhf exfat-utils armhf 1.3.0-1 [40.3 kB]
Fetched 67.7 kB in 2s (32.4 kB/s)
Selecting previously unselected package exfat-fuse.
(Reading database ... 155288 files and directories currently installed.)
Preparing to unpack .../exfat-fuse_1.3.0-1_armhf.deb ...
Unpacking exfat-fuse (1.3.0-1) ...
Selecting previously unselected package exfat-utils.
Preparing to unpack .../exfat-utils_1.3.0-1_armhf.deb ...
Unpacking exfat-utils (1.3.0-1) ...
Setting up monit (1:5.26.0-1) ...
Job for monit.service failed because the control process exited with error code.
See "systemctl status monit.service" and "journalctl -xe" for details.
invoke-rc.d: initscript monit, action "start" failed.
● monit.service - LSB: service and resource monitoring daemon
Loaded: loaded (/etc/init.d/monit; generated)
Active: failed (Result: exit-code) since Mon 2019-12-09 12:50:10 AEST; 386ms ago
Docs: man:systemd-sysv-generator(8)
Process: 15158 ExecStart=/etc/init.d/monit start (code=exited, status=1/FAILURE)
Dec 09 12:50:09 raspberrypi systemd: Starting LSB: service and resource monitoring daemon...
Dec 09 12:50:09 raspberrypi monit: Starting daemon monitor: monitSegmentation fault
Dec 09 12:50:09 raspberrypi monit: failed!
Dec 09 12:50:09 raspberrypi systemd: monit.service: Control process exited, code=exited, status=1/FAILURE
Dec 09 12:50:10 raspberrypi systemd: monit.service: Failed with result 'exit-code'.
Dec 09 12:50:10 raspberrypi systemd: Failed to start LSB: service and resource monitoring daemon.
dpkg: error processing package monit (--configure):
installed monit package post-installation script subprocess returned error exit status 1
Setting up exfat-utils (1.3.0-1) ...
Setting up exfat-fuse (1.3.0-1) ...
Processing triggers for man-db (2.8.5-2) ...
Errors were encountered while processing:
monit
E: Sub-process /usr/bin/dpkg returned an error code (1)
We can obviously see that the control process exited and caused this:
`Failed to start LSB: service and resource monitoring daemon.
` However, I have no idea what went wrong and how to fix this. Any ideas on how I could successfully install the Monit Package?
NR Technology
(11 rep)
Dec 9, 2019, 03:00 AM
• Last activity: Dec 19, 2019, 10:07 AM
0
votes
1
answers
136
views
Monit ignore pipes for some reason
I have Monit script to monitor my tvheadend service. To start the program I would like to use start command start program = "/etc/init.d/tvheadend start && /usr/bin/python /root/antik_epg/antik_xmltv.py | /usr/bin/socat - UNIX-CONNECT:/etc/tvheadend/epggrab/xmltv.sock" But for some reason the Monit...
I have Monit script to monitor my tvheadend service.
To start the program I would like to use start command
start program = "/etc/init.d/tvheadend start
&& /usr/bin/python /root/antik_epg/antik_xmltv.py
| /usr/bin/socat - UNIX-CONNECT:/etc/tvheadend/epggrab/xmltv.sock"
But for some reason the Monit ignores command after pipe.
It just starts
tvheadend
and only runs /usr/bin/python /root/antik_epg/antik_xmltv.py
.
It does not run /usr/bin/socat - UNIX-CONNECT:/etc/tvheadend/epggrab/xmltv.sock
How to run all commands?
I have tried to run custom scripts:
start program = "/bin/ash -c '/root/tvheadend_start.sh'"
But the result was same.
The command runs perfectly directly from bash.
Thanks for your help.
user9338787
(1 rep)
Dec 4, 2019, 09:49 PM
• Last activity: Dec 6, 2019, 06:22 AM
1
votes
0
answers
49
views
want to live monitor all log files in one vieuw
I like to view all log files live like `tail -n0 somelog.log` But then for literally all log files on the system (CentOS 7) Or an other way to do this is also nice. I want to output this to a web page eventually.
I like to view all log files live
like
tail -n0 somelog.log
But then for literally all log files on the system (CentOS 7)
Or an other way to do this is also nice.
I want to output this to a web page eventually.
spacecabbie
(11 rep)
Nov 30, 2019, 03:27 PM
• Last activity: Nov 30, 2019, 07:00 PM
1
votes
1
answers
298
views
monit removed from CentOS8 and EPEL. Any replacement?
I upgraded to CentOS8 and noticed that monit removed from CentOS8 and EPEL. We have been using it to monitor processes. I know I can build it but wondering why it was removed. Was it replaced with a better package?
I upgraded to CentOS8 and noticed that monit removed from CentOS8 and EPEL. We have been using it to monitor processes.
I know I can build it but wondering why it was removed. Was it replaced with a better package?
Rahul
(323 rep)
Nov 22, 2019, 02:38 PM
• Last activity: Nov 25, 2019, 12:15 AM
0
votes
1
answers
302
views
monit:3: syntax error '='
I am trying to set up my virtual machine to shut down when my program completes, to stop the charges. I have written the following .monitrc for this purpose: SET DAEMON 30 CHECK PROCESS py MATCHING /usr/bin/python3 start program = "sudo /bin/systemctl poweroff -i" When I run monit, it responds: > /h...
I am trying to set up my virtual machine to shut down when my program completes, to stop the charges.
I have written the following .monitrc for this purpose:
SET DAEMON 30
CHECK PROCESS py MATCHING /usr/bin/python3
start program = "sudo /bin/systemctl poweroff -i"
When I run monit, it responds:
> /home/baruch/.monitrc:3: syntax error '='
monit -V responds:
> monit -V
>
> This is Monit version 5.20.0
>
> Built with ssl, with ipv6, with compression, with pam and with large files
OS: Linux instance-1 4.9.0-11-amd64 #1 SMP Debian 4.9.189-3+deb9u1 (2019-09-20) x86_64
I tried a similar .monitrc on my home computer (Ubuntu 16.04, Monit version 5.16) and it works fine:
SET DAEMON 30
CHECK PROCESS py MATCHING /home/baruch/datasets/Severstal/.env/bin/python3
start program = "/bin/systemctl poweroff -i"
Please help.
**EDIT:**
I need sudo because my virtual machine is set up in such way that
systemctl
does not work without sudo
(it asks for some credentials). However, sudo does not ask for any passwords, so it can be used in .monitrc.
Apparently, monit complained that sudo in the start command was without its path.
I changed my .monitrc as follows:
SET DAEMON 30
CHECK PROCESS py MATCHING /usr/bin/python3
start program = "/usr/bin/sudo /bin/systemctl poweroff -i"
In this way monit does not give any error message but does not work either.
I tried to run it with a log, monit -l, and the log contains only the following:
> [UTC Oct 26 20:27:31] info : Starting Monit 5.20.0 daemon
>
> [UTC Oct 26 20:27:31] info : 'instance-1' Monit 5.20.0 started
>
> [UTC Oct 26 20:31:01] info : Monit daemon with pid stopped
>
> [UTC Oct 26 20:31:01] info : 'instance-1' Monit 5.20.0 stopped
>
> [UTC Oct 26 20:31:20] info : Starting Monit 5.20.0 daemon
>
> [UTC Oct 26 20:31:20] info : 'instance-1' Monit 5.20.0 started
>
> [UTC Oct 26 20:35:32] info : Monit daemon with pid stopped
>
> [UTC Oct 26 20:35:32] info : 'instance-1' Monit 5.20.0 stopped
(Stopping here refers to my commands monit quit
.)
Any help will be appreciated.
Baruch Youssin
(101 rep)
Oct 25, 2019, 08:43 AM
• Last activity: Oct 26, 2019, 08:55 PM
0
votes
1
answers
1588
views
How to monitor python script using monit
I want to monitor my python script. I am trying to run the python script from monit but I am getting the error file as : > error: 'scraper' process is not running info: 'scraper' trying to restart info : 'scraper' start: '/bin/scraper start' error : 'scraper' failed to start (exit status -1) -- no o...
I want to monitor my python script. I am trying to run the python script from monit but I am getting the error file as :
> error: 'scraper' process is not running
info: 'scraper' trying to restart
info : 'scraper' start: '/bin/scraper start'
error : 'scraper' failed to start (exit status -1) -- no output
My monit configuration file is :
check process scraper with pidfile /var/run/scraper.pid
start = "/bin/scraper start"
stop = "/bin/scraper stop"
And my scraper file is :
#!/bin/bash
PIDFILE=/var/run/scraper.pid
case $1 in
start)
source /home
# Launch your program as a detached process
python3 /home/user/Desktop/weather.py 2>/dev/null &
# Get its PID and store it
echo $! > ${PIDFILE}
;;
stop)
kill cat ${PIDFILE}
# Now that it's killed, don't forget to remove the PID file
rm ${PIDFILE}
;;
*)
echo "usage: scraper {start|stop}" ;;
esac
exit 0
No idea what is happening here. If anyone can help me it wil great help. Thanks
Piyush
(111 rep)
Oct 25, 2019, 10:44 AM
• Last activity: Oct 26, 2019, 08:07 PM
0
votes
0
answers
664
views
Monit doesn't run 'start program'
I am trying to add one more process for monitoring through `monit`: ``` check process sidekiq_worker_flow with pidfile /home/flio/apps/stage-flow/current/tmp/pids/sidekiq-1.pid start program = "cd /home/flio/apps/stage-flow/current && source /etc/profile.d/rbenv.sh && bundle exec sidekiq -i 1 -e sta...
I am trying to add one more process for monitoring through
monit
:
check process sidekiq_worker_flow with pidfile /home/flio/apps/stage-flow/current/tmp/pids/sidekiq-1.pid
start program = "cd /home/flio/apps/stage-flow/current && source /etc/profile.d/rbenv.sh && bundle exec sidekiq -i 1 -e staging --pidfile /home/flio/apps/stage-flow/current/tmp/pids/sidekiq-1.pid --logfile /home/flio/apps/stage-flow/shared/log/sidekiq-1.log --daemon" as uid flio
stop program = "cd /home/flio/apps/stage-flow/current && bundle exec sidekiqctl stop /home/flio/apps/stage-flow/current/tmp/pids/sidekiq-1.pid 10" as uid flio
if 5 restarts within 15 cycles then timeout
Looks like the command for 'start program' never called, because I've tried to call some debug command (echo 'bla bla' > ~/monint_debug.log') but never get anything.
I've also run commands (under root) for start and stop manually - and it works properly.
I also have another similar script:
check process sidekiq_worker_2
with pidfile /var/www/flio/current/tmp/pids/sidekiq-1.pid
start program = "/bin/su -lc 'cd /var/www/flio/current && source /etc/profile.d/rbenv.sh && bundle exec sidekiq -i 1 -e production --pidfile /var/www/flio/current/tmp/pids/sidekiq-1.pid --logfile /var/www/flio/shared/log/sidekiq-1.log --daemon -C /var/www/flio/current/config/sidekiq_2.yml' flio"
stop program = "/bin/su -lc 'cd /var/www/flio/current && bundle exec sidekiqctl stop /var/www/flio/current/tmp/pids/sidekiq-1.pid 10' flio"
if 5 restarts within 15 cycles then timeout
and it works fine.
kunashir
(101 rep)
May 16, 2019, 08:14 AM
0
votes
1
answers
73
views
Monit - How to use different configurations for Day and Night time?
What is the most convenient way to configure `monit` to act different in day and night hours? The only thing I can figure out , is to use a `cron` job switch the `monitrc` file - let's say - at midnight, and restart the `Monit` service Any better solution?
What is the most convenient way to configure
monit
to act different in day and night hours?
The only thing I can figure out , is to use a cron
job switch the monitrc
file - let's say - at midnight, and restart the Monit
service
Any better solution?
lese
(2756 rep)
Nov 16, 2018, 03:59 PM
• Last activity: Nov 19, 2018, 08:46 AM
0
votes
1
answers
449
views
monit, http access with four different credentials types, one using PAM
monit 5.25.2 These are our credential settings: set httpd port 2812 allow localhost allow guest:guest read-only allow @wheel allow cleartext /opt/monit/htpasswd Rationale: - *localhost* to enable *monit status* - *guest:guest* to enable web access, read-only, for everyone as *guest* - *@wheel* to en...
monit 5.25.2
These are our credential settings:
set httpd port 2812
allow localhost
allow guest:guest read-only
allow @wheel
allow cleartext /opt/monit/htpasswd
Rationale:
- *localhost* to enable *monit status*
- *guest:guest* to enable web access, read-only, for everyone as *guest*
- *@wheel* to enable web access, full, for the local users, group *wheel*
- *cleartext* to enable web access, full, for a pair of users not on the host
I read the docs and I try to 'shuffle' the settings (sigh) but I cannot understand how to fix the usual problem: only one of this two usages is working:
- from commandline, monit status
- web access from a client pc (ip address isn't the host itself)
**UPDATE**
I stumbled upon two issues:
- allow localhost
Without it, all the clients pc can access, but *monit status* doesn't work.
Using 'allow localhost', it blocks the clients, so we have to specify also:
> allow 10.0.0.0/8
IMHO this isn't clear from the docs.
- tests from the clients pc... beware of credentials
Trying the accesses to monit from the pc, the browser caches the credentials... so these tests can be misleading.
**UPDATE**
I found the problem:
strace -s 512 -e connect,write /opt/monit/bin/monit status 2>&1 |more
connect(4, {sa_family=AF_INET, sin_port=htons(2812), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
write(4, "POST /_status HTTP/1.0\r\nContent-Type: application/x-www-form-urlencoded\r\nCookie: securitytoken=88521284dfbc7acea0521e16e11356d1\r\nContent-Length: 58\r\n\
r\nformat=text&securitytoken=88521284dfbc7acea0521e16e11356d1", 209) = 209
write(2, "You are not authorized to access monit..."
Why does it send the Cookie: securitytoken= ?
In the configuration we have defined
> allow guest:guest read-only
If I make the HTTP request with the *guest* credentials, it works:
"GET /_status?format=text HTTP/1.0\r\nAuthorization:Basic Z3Vlc3Q6Z3Vlc3Q=\r\n\r\n"
Massimo
(1055 rep)
Sep 11, 2018, 02:57 PM
• Last activity: Oct 1, 2018, 06:22 PM
2
votes
1
answers
1986
views
How do I configure to 'monit' monitor a process after it restarts?
I have [`monit`][1] configured to terminate a pair of processes when they consume too much CPU, but once either is terminated, `monit summary` reports "Not monitored" for the process, even after the OS relaunches it. How do I configure to 'monit' monitor a process after it restarts? ---- check proce...
I have
monit
configured to terminate a pair of processes when they consume too much CPU, but once either is terminated, monit summary
reports "Not monitored" for the process, even after the OS relaunches it.
How do I configure to 'monit' monitor a process after it restarts?
----
check process soagent
matching "soagent"
stop program = "/usr/bin/pkill -9 soagent"
if cpu > 20% for 1 cycles then stop
if cpu > 20% for 1 cycles then alert
check process callservicesd
matching "callservicesd"
stop program = "/usr/bin/pkill -9 callservicesd"
if cpu > 20% for 1 cycles then stop
if cpu > 20% for 1 cycles then alert
macOS 10.13.4, monit 5.25.2
orome
(416 rep)
May 31, 2018, 09:36 PM
• Last activity: Jun 3, 2018, 11:34 PM
2
votes
1
answers
1285
views
Monit alert/exec when host is back to normal
I use **Monit** to quick check uptime of Elasticsearch service. Here is my configuration: check host [Elasticsearch]-test with address 1.2.3.4 if failed port 9200 protocol http then exec "/alerting/monit2telegram/monit2telegram.sh" It means: when monit cannot do a http request to port 9200, then rec...
I use **Monit** to quick check uptime of Elasticsearch service.
Here is my configuration:
check host [Elasticsearch]-test with address 1.2.3.4
if failed
port 9200
protocol http
then exec "/alerting/monit2telegram/monit2telegram.sh"
It means: when monit cannot do a http request to port 9200, then receive a notification to telegram. It works perfectly when my elastic is down.
But when **host is back to normal**, how can i configure monit that push alert/exec to remind?
Hieu Huynh
(289 rep)
Apr 5, 2018, 04:41 AM
• Last activity: Apr 20, 2018, 06:52 AM
Showing page 1 of 20 total questions