{"id":1184,"date":"2016-05-03T23:38:57","date_gmt":"2016-05-03T15:38:57","guid":{"rendered":"https:\/\/umarzuki.org\/blogku\/?p=1184"},"modified":"2016-05-03T23:38:57","modified_gmt":"2016-05-03T15:38:57","slug":"contoh-setting-munin-dengan-nginx-spawn-fcgi","status":"publish","type":"post","link":"https:\/\/umarzuki.org\/blog\/2016\/05\/03\/contoh-setting-munin-dengan-nginx-spawn-fcgi\/","title":{"rendered":"Contoh setting munin dengan nginx + spawn-fcgi"},"content":{"rendered":"<p>Hasilnya, munin boleh diakses pada www.domain.com (contoh)<\/p>\n<p>\/etc\/init.d\/munin-fcgi<\/p>\n<p>[code lang=&#8217;plain&#8217;]PATH=\/usr\/local\/bin\/:\/usr\/local\/sbin:$PATH<br \/>\nDAEMON=$(which spawn-fcgi)<br \/>\nFCGI_GRAPH_SOCK=\/var\/run\/munin\/fastcgi-munin-graph.sock<br \/>\nFCGI_HTML_SOCK=\/var\/run\/munin\/fastcgi-munin-html.sock<br \/>\nWWW_USER=www-data<br \/>\nFCGI_USER=www-data<br \/>\nFCGI_GROUP=www-data<br \/>\nFCGI_SPAWN_GRAPH=\/usr\/lib\/munin\/cgi\/munin-cgi-graph<br \/>\nFCGI_SPAWN_HTML=\/usr\/lib\/munin\/cgi\/munin-cgi-html<br \/>\nPIDFILE_GRAPH=\/var\/run\/munin\/fastcgi-munin-graph.pid<br \/>\nPIDFILE_HTML=\/var\/run\/munin\/fastcgi-munin-html.pid<br \/>\nDESC=&#8221;Munin FCGI for Graph and HTML&#8221;<br \/>\ntest -x $DAEMON || exit 0<br \/>\ntest -x $FCGI_SPAWN_GRAPH || exit 0<br \/>\ntest -x $FCGI_SPAWN_HTML || exit 0<br \/>\nstart() {<br \/>\n  $DAEMON -s $FCGI_GRAPH_SOCK -U $WWW_USER -u $FCGI_USER -g $FCGI_GROUP -P $PIDFILE_GRAPH $FCGI_SPAWN_GRAPH 2> \/dev\/null || echo &#8220;Graph Already running&#8221;<br \/>\n  $DAEMON -s $FCGI_HTML_SOCK  -U $WWW_USER -u $FCGI_USER -g $FCGI_GROUP -P $PIDFILE_HTML $FCGI_SPAWN_HTML 2> \/dev\/null || echo &#8220;HTML Already running&#8221;<br \/>\n}<br \/>\nstop() {<br \/>\n  kill -QUIT `cat $PIDFILE_GRAPH` || echo &#8220;Graph not running&#8221;<br \/>\n  kill -QUIT `cat $PIDFILE_HTML` || echo &#8220;HTML Not running&#8221;<br \/>\n}<br \/>\nrestart() {<br \/>\n  kill -HUP `cat $PIDFILE_GRAPH` || echo &#8220;Can&#8217;t reload Graph&#8221;<br \/>\n  kill -HUP `cat $PIDFILE_HTML` || echo &#8220;Can&#8217;t reload HTML&#8221;<br \/>\n}<br \/>\ncase &#8220;$1&#8221; in<br \/>\n  start)<br \/>\n    echo &#8220;Starting $DESC: &#8221;<br \/>\n    start<br \/>\n  ;;<br \/>\n  stop)<br \/>\n    echo &#8220;Stopping $DESC: &#8221;<br \/>\n    stop<br \/>\n  ;;<br \/>\n  restart|reload)<br \/>\n    echo &#8220;Restarting $DESC: &#8221;<br \/>\n    stop<br \/>\n    sleep 1<br \/>\n    start<br \/>\n  ;;<br \/>\n  *)<br \/>\n    echo &#8220;Usage: $SCRIPTNAME {start|stop|restart|reload}&#8221; >&amp;2<br \/>\n    exit 3<br \/>\n  ;;<br \/>\nesac<br \/>\nexit $?[\/code]<\/p>\n<p>\/etc\/munin\/munin.conf<\/p>\n<p>[code lang=&#8217;plain&#8217;]dbdir   \/var\/lib\/munin<br \/>\nhtmldir \/var\/cache\/munin\/www<br \/>\nlogdir \/var\/log\/munin<br \/>\nrundir  \/var\/run\/munin<br \/>\ntmpldir \/etc\/munin\/templates<br \/>\nstaticdir \/etc\/munin\/static<br \/>\nincludedir \/etc\/munin\/munin-conf.d<br \/>\n[www.domain.com]<br \/>\n    address 127.0.0.1<br \/>\n    use_node_name yes[\/code]<\/p>\n<p>\/etc\/nginx\/sites-enabled\/munin<\/p>\n<p>[code lang=&#8217;plain&#8217;]server {<br \/>\n        listen 80;<br \/>\n        root \/var\/cache\/munin\/www;<br \/>\n        index index.html index.htm;<br \/>\n        server_name www.domin.com;<br \/>\n        auth_basic &#8220;Administrator Login&#8221;;<br \/>\n        auth_basic_user_file \/var\/www\/.htpasswd;<br \/>\nlocation \/nginx_status {<br \/>\n        stub_status on;<br \/>\n        access_log   off;<br \/>\n        allow 127.0.0.1;<br \/>\n        deny all;<br \/>\n        }<br \/>\nlocation ^~ \/munin-cgi\/munin-cgi-graph\/ {<br \/>\n    fastcgi_split_path_info ^(\/munin-cgi\/munin-cgi-graph)(.*);<br \/>\n    fastcgi_param PATH_INFO $fastcgi_path_info;<br \/>\n    fastcgi_pass unix:\/var\/run\/munin\/fastcgi-munin-graph.sock;<br \/>\n    include fastcgi_params;<br \/>\n}<br \/>\nlocation  ^~ \/munin-cgi\/munin-cgi-html\/ {<br \/>\n    fastcgi_split_path_info ^(\/munin-cgi\/munin-cgi-html)(.*);<br \/>\n    fastcgi_param PATH_INFO $fastcgi_path_info;<br \/>\n    fastcgi_pass unix:\/var\/run\/munin\/fastcgi-munin-html.sock;<br \/>\n    include fastcgi_params;<br \/>\n}<br \/>\n}[\/code]<\/p>\n<p>Rujukan:<\/p>\n<p>https:\/\/www.scalescale.com\/tips\/nginx\/nginx-configuration-for-munin\/<br \/>\nhttp:\/\/serverfault.com\/questions\/670535\/munin-nginx-no-dynazoom-into-graphs<br \/>\nhttps:\/\/www.howtoforge.com\/tutorial\/server-monitoring-with-munin-and-monit-on-ubuntu-14-04\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hasilnya, munin boleh diakses pada www.domain.com (contoh) \/etc\/init.d\/munin-fcgi [code lang=&#8217;plain&#8217;]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=&#8221;Munin FCGI for Graph and HTML&#8221; 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 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[399,364],"class_list":["post-1184","post","type-post","status-publish","format-standard","hentry","category-linux","tag-monitoring","tag-nginx"],"_links":{"self":[{"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/posts\/1184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/comments?post=1184"}],"version-history":[{"count":0,"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/posts\/1184\/revisions"}],"wp:attachment":[{"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/media?parent=1184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/categories?post=1184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/umarzuki.org\/blog\/wp-json\/wp\/v2\/tags?post=1184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}