dbabits / monit Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU Affero General Public License v3.0
License: GNU Affero General Public License v3.0
(bitbucket issue 810)
This CHECK PROGRAM generates random successes and failures, using bash's $RANDOM to trigger divide by 0.
As you see, in case of SUCCESS, MONIT_EVENT still shows 'Status failed'
In fact, it always shows this status. The UI paints accordingly.
Relevant configuration:
43 CHECK PROGRAM NodeManager WITH PATH "/bin/bash -c 'echo $(( 1/($RANDOM%2) ))'"
44 IF STATUS = 0 THEN EXEC "/bin/bash -c '/bin/env | grep MONIT| cat - <(echo SUCCESS;echo)'"
45 REPEAT EVERY 1 CYCLES
46
47 IF STATUS !=0 THEN EXEC "/bin/bash -c '/bin/env | grep MONIT| cat - <(echo FAILURE;echo)'"
48 REPEAT EVERY 1 CYCLES
[dab@d129668-005:/home/dab] /home/dab/scripts/monit -c /home/dab/UserDirs/dba/dev/utils/monit.conf -v | egrep -v 'proc file|system statistic|M/Monit'
M/Monit enabled but no httpd allowed -- please add 'set httpd' statement
Runtime constants:
Control file = /home/dab/UserDirs/dba/dev/utils/monit.conf
Log file = (not defined)
Pid file = /home/dab/.monit.pid
Id file = /local/data/scratch/monit.id
State file = /local/data/scratch/monit.state
Debug = True
Log = False
Use syslog = False
Is Daemon = True
Use process engine = True
Limits = {
= programOutput: 512 B
= sendExpectBuffer: 256 B
= fileContentBuffer: 512 B
= httpContentBuffer: 1 kB
= networkTimeout: 5 s
= programTimeout: 30 s
= stopTimeout: 10 s
= startTimeout: 10 s
= restartTimeout: 10 s
= }
On reboot = start
Poll time = 3 seconds with start delay 0 seconds
Mail from = Monit Support <[email protected]>
Mail reply to = [email protected]
Mail subject = $SERVICE $EVENT at $DATE
Mail message = Monit $ACTION $SERVI..(truncated)
Start monit httpd = False
The service list contains the following entries:
System Name = d341369-005
Monitoring mode = active
On reboot = start
Every = Check service every 1 cycles
Program Name = NodeManager
Path = /bin/bash -c echo $(( 1/($RANDOM%2) ))
Monitoring mode = active
On reboot = start
Program timeout = terminate the program if not finished within 30 s
Status = if exit value != 0 then exec '/bin/bash -c /bin/env | grep MONIT| cat - <(echo FAILURE;echo)' repeat every 1 cycle(s)
Status = if exit value = 0 then exec '/bin/bash -c /bin/env | grep MONIT| cat - <(echo SUCCESS;echo)' repeat every 1 cycle(s)
-------------------------------------------------------------------------------
pidfile '/home/dab/.monit.pid' does not exist
Starting Monit 5.25.3 daemon
'd341369-005' Monit 5.25.3 started
'NodeManager' program started
'NodeManager' status succeeded (0) -- 1
'NodeManager' status failed (0) -- 1
'NodeManager' exec: '/bin/bash -c /bin/env | grep MONIT| cat - <(echo SUCCESS;echo)'
MONIT_PROGRAM_STATUS=0
MONIT_DATE=Tue, 29 Jan 2019 11:47:44
MONIT_HOST=d341369-005
MONIT_EVENT=Status failed
MONIT_SERVICE=NodeManager
MONIT_DESCRIPTION=status failed (0) -- 1
SUCCESS
'NodeManager' program started
'NodeManager' status failed (1) -- /bin/bash: 1/(5532%2) : division by 0 (error token is ") ")
'NodeManager' exec: '/bin/bash -c /bin/env | grep MONIT| cat - <(echo FAILURE;echo)'
'NodeManager' status succeeded (1) -- /bin/bash: 1/(5532%2) : division by 0 (error token is ") ")
'NodeManager' program started
MONIT_PROGRAM_STATUS=1
MONIT_DATE=Tue, 29 Jan 2019 11:47:47
MONIT_HOST=d341369-005
MONIT_EVENT=Status failed
MONIT_SERVICE=NodeManager
MONIT_DESCRIPTION=status failed (1) -- /bin/bash: 1/(5532%2) : division by 0 (error token is ") ")
FAILURE
'NodeManager' status succeeded (0) -- 1
'NodeManager' status failed (0) -- 1
'NodeManager' exec: '/bin/bash -c /bin/env | grep MONIT| cat - <(echo SUCCESS;echo)'
MONIT_PROGRAM_STATUS=0
MONIT_DATE=Tue, 29 Jan 2019 11:47:50
MONIT_HOST=d341369-005
MONIT_EVENT=Status failed
MONIT_SERVICE=NodeManager
MONIT_DESCRIPTION=status failed (0) -- 1
SUCCESS
'NodeManager' program started
'NodeManager' status succeeded (0) -- 1
'NodeManager' status failed (0) -- 1
'NodeManager' exec: '/bin/bash -c /bin/env | grep MONIT| cat - <(echo SUCCESS;echo)'
MONIT_PROGRAM_STATUS=0
MONIT_DATE=Tue, 29 Jan 2019 11:47:53
MONIT_HOST=d341369-005
MONIT_EVENT=Status failed
MONIT_SERVICE=NodeManager
MONIT_DESCRIPTION=status failed (0) -- 1
SUCCESS
example, even with an all but empty configuration (nothing being monitored), monit -v dumps this stuff every second, filling the log and obstructing the useful info.
Without -v it's silent and doesn't output anything.
This is the stuff I need, and it's only available with -v:
'LongRunningCheck' status check deferred - waiting on program to exit
'LongRunningCheck' status succeeded (0) -- no output
'LongRunningCheck' program started
'LongRunningCheck' status check deferred - waiting on program to exit
Below is the stuff I want to get rid of:
Why is it looking for all procs running on the system, when not asked to do so?
Does it expect to be running as root? (Docs don't say it)
Is there a way to turn it off?
Cannot open proc file '/proc/9011/io' -- Permission denied
Cannot read proc file '/proc/9011/attr/current' -- Invalid argument
Cannot open proc file '/proc/9012/io' -- Permission denied
Cannot read proc file '/proc/9012/attr/current' -- Invalid argument
Cannot open proc file '/proc/9013/io' -- Permission denied
Cannot read proc file '/proc/9013/attr/current' -- Invalid argument
Cannot open proc file '/proc/9017/io' -- Permission denied
Cannot read proc file '/proc/9017/attr/current' -- Invalid argument
Cannot open proc file '/proc/902/io' -- Permission denied
Cannot read proc file '/proc/902/attr/current' -- Invalid argument
Cannot open proc file '/proc/909/io' -- Permission denied
Cannot read proc file '/proc/909/attr/current' -- Invalid argument
Cannot open proc file '/proc/912/io' -- Permission denied
Cannot read proc file '/proc/912/attr/current' -- Invalid argument
Cannot open proc file '/proc/915/io' -- Permission denied
Cannot read proc file '/proc/915/attr/current' -- Invalid argument
Cannot read proc file '/proc/9348/attr/current' -- Invalid argument
Cannot open proc file '/proc/940/io' -- Permission denied
Cannot read proc file '/proc/940/attr/current' -- Invalid argument
Cannot open proc file '/proc/941/io' -- Permission denied
Cannot read proc file '/proc/941/attr/current' -- Invalid argument
Cannot open proc file '/proc/943/io' -- Permission denied
Cannot read proc file '/proc/943/attr/current' -- Invalid argument
Cannot open proc file '/proc/946/io' -- Permission denied
Cannot read proc file '/proc/946/attr/current' -- Invalid argument
Cannot open proc file '/proc/952/io' -- Permission denied
Cannot read proc file '/proc/952/attr/current' -- Invalid argument
Cannot open proc file '/proc/958/io' -- Permission denied
Cannot read proc file '/proc/958/attr/current' -- Invalid argument
Cannot read proc file '/proc/9647/attr/current' -- Invalid argument
Cannot open proc file '/proc/9669/io' -- Permission denied
Cannot read proc file '/proc/9669/attr/current' -- Invalid argument
Cannot open proc file '/proc/9700/io' -- Permission denied
Cannot read proc file '/proc/9700/attr/current' -- Invalid argument
Cannot open proc file '/proc/9702/io' -- Permission denied
Cannot read proc file '/proc/9702/attr/current' -- Invalid argument
Cannot open proc file '/proc/9730/io' -- Permission denied
Cannot read proc file '/proc/9730/attr/current' -- Invalid argument
Cannot open proc file '/proc/9759/io' -- Permission denied
Cannot read proc file '/proc/9759/attr/current' -- Invalid argument
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.