bitnami / gonit Goto Github PK
View Code? Open in Web Editor NEWDrop-in replacement for monit written in Go, with Apache 2.0 license
Home Page: https://bitnami.com
License: Apache License 2.0
Drop-in replacement for monit written in Go, with Apache 2.0 license
Home Page: https://bitnami.com
License: Apache License 2.0
gonit.log:
time="2019-06-30T23:59:39-07:00" level=info msg="Performing process check php-fpm"
time="2019-06-30T23:59:39-07:00" level=info msg="Performing process check mysql"
time="2019-06-30T23:59:39-07:00" level=info msg="Performing process check nginx"
time="2019-07-01T00:01:39-07:00" level=info msg="Performing checks"
time="2019-07-01T00:01:39-07:00" level=info msg="Performing process check php-fpm"
time="2019-07-01T00:01:39-07:00" level=info msg="Performing process check mysql"
time="2019-07-01T00:01:39-07:00" level=info msg="Performing process check nginx"
time="2019-07-01T00:01:39-07:00" level=info msg="Service nginx is not running. Starting..."
time="2019-07-01T00:03:09-07:00" level=warning msg="Timed out waiting for nginx to start (4 tries left)"
time="2019-07-01T00:03:39-07:00" level=info msg="Performing checks"
time="2019-07-01T00:03:39-07:00" level=info msg="Performing process check php-fpm"
time="2019-07-01T00:03:39-07:00" level=info msg="Performing process check mysql"
time="2019-07-01T00:03:39-07:00" level=info msg="Performing process check nginx"
time="2019-07-01T00:03:39-07:00" level=info msg="Service nginx is not running. Starting..."
time="2019-07-01T00:05:09-07:00" level=warning msg="Timed out waiting for nginx to start (3 tries left)"
time="2019-07-01T00:05:39-07:00" level=info msg="Performing checks"
time="2019-07-01T00:05:39-07:00" level=info msg="Performing process check php-fpm"
time="2019-07-01T00:05:39-07:00" level=info msg="Performing process check mysql"
time="2019-07-01T00:05:39-07:00" level=info msg="Performing process check nginx"
time="2019-07-01T00:05:39-07:00" level=info msg="Service nginx is not running. Starting..."
time="2019-07-01T00:07:09-07:00" level=warning msg="Timed out waiting for nginx to start (2 tries left)"
time="2019-07-01T00:07:39-07:00" level=info msg="Performing checks"
time="2019-07-01T00:07:39-07:00" level=info msg="Performing process check php-fpm"
time="2019-07-01T00:07:39-07:00" level=info msg="Performing process check mysql"
time="2019-07-01T00:07:39-07:00" level=info msg="Performing process check nginx"
time="2019-07-01T00:07:39-07:00" level=info msg="Service nginx is not running. Starting..."
time="2019-07-01T00:09:09-07:00" level=warning msg="Timed out waiting for nginx to start (1 tries left)"
time="2019-07-01T00:09:39-07:00" level=info msg="Performing checks"
time="2019-07-01T00:09:39-07:00" level=info msg="Performing process check php-fpm"
time="2019-07-01T00:09:39-07:00" level=info msg="Performing process check mysql"
time="2019-07-01T00:09:39-07:00" level=info msg="Performing process check nginx"
time="2019-07-01T00:09:39-07:00" level=info msg="Service nginx is not running. Starting..."
time="2019-07-01T00:11:09-07:00" level=warning msg="Timed out waiting for nginx to start (0 tries left)"
/opt/bitnami/config/monit/conf.d/nginx.conf:
check process nginx
with pidfile "/opt/bitnami/nginx/logs/nginx.pid"
start program = "/opt/bitnami/nginx/scripts/ctl.sh start" with timeout 90 seconds
stop program = "/opt/bitnami/nginx/scripts/ctl.sh stop" with timeout 90 seconds
I can test these start/stop and they work. I traced the code in checks.go until I got to line 488 where it says:
c.StartProgram.Exec()
Searching for Exec lead me to line 336 where it says:
c.logger.Debug(exec.Command("/bin/bash", "-c", c.Cmd).Run())
What is c.Cmd? Does it get substituted without embedded quotes? this could cause an issue with starting:
$ /opt/bitnami/nginx/scripts/ctl.sh start # this works
$ /bin/bash -c /opt/bitnami/nginx/scripts/ctl.sh start # this doesn't
Thanks
$ make vet
+ vet-utils
+ vet-database
+ vet-testutils
+ vet-monitor
monitor/checks.go:292: literal copies lock value from check: monitor.check contains monitor.syncBool
exit status 1
make: *** [vet-monitor] Error 1
We are trying to get a notification when the system is in "Out of Memory" state.
This is our system.conf configuration,
check system localhost
if memory usage > 10% for 2 cycles then alert
oom checker:
/**
oom.c
allocate chunks of 10MB of memory indefinitely until you run out of memory
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define TEN_MB 10 * 1024 * 1024
int main(int argc, char **argv){
int c = 0;
int counter1=0;
while (1){
char *b = malloc(TEN_MB);
memset(b, TEN_MB, 0);
printf("Allocated %d MB\n", (++c * 10));
counter1++;
if (counter1 %1000 == 0){
sleep (5);
}
}
return 0;
}
/etc/gonit/gonitrc
set httpd port 2812 and
use address localhost
allow localhost
set daemon 30 #120 # check services at 2-minute intervals
set log /var/log/gonit.log
include /etc/gonit/conf.d/*.conf
Expecting alert on logs
executed this command tail -f /var/log/gonit.log /var/log/messages
time="2023-02-22T09:39:08+08:00" level=info msg="Performing checks"
time="2023-02-22T09:39:08+08:00" level=info msg="Performing check%!(EXTRA string=localhost)"
time="2023-02-22T09:41:08+08:00" level=info msg="Performing checks"
time="2023-02-22T09:41:08+08:00" level=info msg="Performing check%!(EXTRA string=localhost)"
time="2023-02-22T09:43:08+08:00" level=info msg="Performing checks"
time="2023-02-22T09:43:08+08:00" level=info msg="Performing check%!(EXTRA string=localhost)"
Gonit 0.2.8
Built on: 2023-01-25 05:10:10 UTC
Git Commit: 66756d0
The binary release isn't static and fails with a custom minimal alpine linux?
/lib64/ld-linux-x86-64.so.2 (0x7f86d4f11000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f86d4f11000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f86d4f11000)
And binary size is big with 8,5MB? Is it possible to build a shrinked and static binary?
[root@ip-172-17-** gonit]# nano Makefile
[root@ip-172-17--** gonit]# make build/aarch64
+ Building GOARCH=aarch64
go: unsupported GOOS/GOARCH pair linux/aarch64
make: *** [Makefile:45: build/aarch64] Error 2
[root@ip-172-17--** gonit]# nano Makefile
[root@ip-172-17--** gonit]# make build
+ Building GOARCH=aarch64
go: unsupported GOOS/GOARCH pair linux/aarch64
make: *** [Makefile:45: build/aarch64] Error 2
[root@ip-172-17-** gonit]# nano Makefile
[root@ip-172-17-** gonit]# make build
+ Building GOARCH=amd64
*** Gonit binary created under ./dist/gonit/ ***
[root@ip-172-17-** gonit]# nano Makefile
[root@ip-172-17-** gonit]# make build
+ Building GOARCH=arm64
*** Gonit binary created under ./dist/gonit/ ***
[root@ip-172-17-** gonit]# gonit
Control file '/etc/gonit/gonitrc' does not exists
[root@ip-172-17-** gonit]#
Gonit Arm64/aarch64 Graviton support
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.