Categories
linux

Contoh setting munin dengan nginx + spawn-fcgi

Hasilnya, munin boleh diakses pada www.domain.com (contoh)

/etc/init.d/munin-fcgi

[code lang=’plain’]PATH=/usr/local/bin/:/usr/local/sbin:$PATH
DAEMON=$(which spawn-fcgi)
FCGI_GRAPH_SOCK=/var/run/munin/fastcgi-munin-graph.sock
FCGI_HTML_SOCK=/var/run/munin/fastcgi-munin-html.sock
WWW_USER=www-data
FCGI_USER=www-data
FCGI_GROUP=www-data
FCGI_SPAWN_GRAPH=/usr/lib/munin/cgi/munin-cgi-graph
FCGI_SPAWN_HTML=/usr/lib/munin/cgi/munin-cgi-html
PIDFILE_GRAPH=/var/run/munin/fastcgi-munin-graph.pid
PIDFILE_HTML=/var/run/munin/fastcgi-munin-html.pid
DESC=”Munin FCGI for Graph and HTML”
test -x $DAEMON || exit 0
test -x $FCGI_SPAWN_GRAPH || exit 0
test -x $FCGI_SPAWN_HTML || exit 0
start() {
$DAEMON -s $FCGI_GRAPH_SOCK -U $WWW_USER -u $FCGI_USER -g $FCGI_GROUP -P $PIDFILE_GRAPH $FCGI_SPAWN_GRAPH 2> /dev/null || echo “Graph Already running”
$DAEMON -s $FCGI_HTML_SOCK -U $WWW_USER -u $FCGI_USER -g $FCGI_GROUP -P $PIDFILE_HTML $FCGI_SPAWN_HTML 2> /dev/null || echo “HTML Already running”
}
stop() {
kill -QUIT `cat $PIDFILE_GRAPH` || echo “Graph not running”
kill -QUIT `cat $PIDFILE_HTML` || echo “HTML Not running”
}
restart() {
kill -HUP `cat $PIDFILE_GRAPH` || echo “Can’t reload Graph”
kill -HUP `cat $PIDFILE_HTML` || echo “Can’t reload HTML”
}
case “$1” in
start)
echo “Starting $DESC: ”
start
;;
stop)
echo “Stopping $DESC: ”
stop
;;
restart|reload)
echo “Restarting $DESC: ”
stop
sleep 1
start
;;
*)
echo “Usage: $SCRIPTNAME {start|stop|restart|reload}” >&2
exit 3
;;
esac
exit $?[/code]

/etc/munin/munin.conf

[code lang=’plain’]dbdir /var/lib/munin
htmldir /var/cache/munin/www
logdir /var/log/munin
rundir /var/run/munin
tmpldir /etc/munin/templates
staticdir /etc/munin/static
includedir /etc/munin/munin-conf.d
[www.domain.com]
address 127.0.0.1
use_node_name yes[/code]

/etc/nginx/sites-enabled/munin

[code lang=’plain’]server {
listen 80;
root /var/cache/munin/www;
index index.html index.htm;
server_name www.domin.com;
auth_basic “Administrator Login”;
auth_basic_user_file /var/www/.htpasswd;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
location ^~ /munin-cgi/munin-cgi-graph/ {
fastcgi_split_path_info ^(/munin-cgi/munin-cgi-graph)(.*);
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/munin/fastcgi-munin-graph.sock;
include fastcgi_params;
}
location ^~ /munin-cgi/munin-cgi-html/ {
fastcgi_split_path_info ^(/munin-cgi/munin-cgi-html)(.*);
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/var/run/munin/fastcgi-munin-html.sock;
include fastcgi_params;
}
}[/code]

Rujukan:

Nginx configuration for Munin


http://serverfault.com/questions/670535/munin-nginx-no-dynazoom-into-graphs
https://www.howtoforge.com/tutorial/server-monitoring-with-munin-and-monit-on-ubuntu-14-04/

Categories
linux load test

Formula mengira pm.max_children untuk PHP FPM

Dapatkan jumlah RAM dalam MB dan /run/shm dalam MB

[code lang=’plain’]$ awk ‘/MemTotal/ {printf(“%.2f\n”,$2/1024)}’ /proc/meminfo
128756.27

$ df -m
Filesystem 1M-blocks Used Available Use% Mounted on
/dev/mapper/app1–vg-root 541986 42284 475016 9% /
none 1 0 1 0% /sys/fs/cgroup
udev 64368 1 64368 1% /dev
tmpfs 12876 2 12875 1% /run
none 5 0 5 0% /run/lock
none 64379 0 64379 0% /run/shm
none 100 0 100 0% /run/user
/dev/sda2 237 45 180 20% /boot
/dev/sda1 511 4 508 1% /boot/efi
/dev/dm-2 307196 83294 223903 28% /var/www[/code]

Formula:

(((TotalMemoryinMB-TMPFSinMB)*.8)/75)

(((128756.27-64379)*.8)/75) = 686

Sumber: http://ispeakl33t.com/calculate-pm-max_children

Categories
linux load test

Menetapkan bilangan maksimum pengguna pada tsung

Tetapkan maxuser pada teg clients

[code lang=’xml’]


[/code]

Tetapkan maxnumber pada teg users

[code lang=’xml’]




[/code]