[{"data":1,"prerenderedAt":446},["ShallowReactive",2],{"Categories":3,"NavIndexCategoriesCountFooter":203,"content-\u002F2009\u002F03\u002F26\u002Fglassfish-and-too-many-open-files-monitoring-with-munin\u002F":204},[4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,68,70,71,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202],{"category":5},"System Administration",{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},"Software Development",{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":27},{"category":27},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":5},{"category":27},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":27},{"category":27},{"category":67},"Drones & RC",{"category":69},"DIY Projects",{"category":67},{"category":72},"Photography",{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":69},{"category":67},{"category":69},{"category":69},{"category":67},{"category":67},{"category":72},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":5},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":5},{"category":67},{"category":67},{"category":72},{"category":72},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":67},{"category":72},{"category":67},{"category":138},"3D Printing - Laser Cutting - CNC",{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":138},{"category":5},{"category":138},{"category":27},{"category":27},{"category":138},{"category":138},{"category":72},{"category":158},"Photography,3D Printing - Laser Cutting - CNC",{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":5},{"category":67},{"category":5},{"category":5},{"category":27},{"category":27},{"category":27},{"category":27},{"category":27},{"category":69},{"category":27},{"category":27},{"category":27},{"category":27},{"category":181},"Home Assistant",{"category":181},{"category":72},{"category":27},{"category":27},{"category":72},{"category":138},{"category":5},{"category":72},{"category":72},{"category":138},{"category":27},{"category":181},{"category":181},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},{"category":72},191,{"id":205,"title":206,"body":207,"category":5,"date":432,"description":433,"embedImage":434,"extension":435,"image":434,"intro":434,"meta":436,"navigation":437,"path":438,"seo":439,"series":434,"sitemap":440,"stem":441,"tags":442,"__hash__":445},"content\u002F2009\u002F03\u002F26\u002Fglassfish-and-too-many-open-files-monitoring-with-munin.md","Glassfish and Too many open files - monitoring with munin",{"type":208,"value":209,"toc":430},"minimark",[210,225,234,237,248,251,254,397,400,417,420,423,426],[211,212,213,214,224],"p",{},"One of the systems that can be used for monitoring trends on a system is ",[215,216,223],"a",{"href":217,"rel":218,"target":222},"http:\u002F\u002Fmunin-monitoring.org\u002F",[219,220,221],"nofollow","noopener","noreferer","_blank","munin",". It turns out that adding a graph to munin is reasonably simple.",[211,226,227,228,233],{},"There is a good guide on the ",[215,229,232],{"href":230,"rel":231,"target":222},"http:\u002F\u002Fmunin-monitoring.org\u002Fwiki\u002FHowToWritePlugins",[219,220,221],"munin site",".",[211,235,236],{},"So - I need a plugin that will return the number of open files.",[238,239,244],"pre",{"className":240,"code":242,"language":243},[241],"language-text","lsof -u glassfish | wc -l\n","text",[245,246,242],"code",{"__ignoreMap":247},"",[211,249,250],{},"This is a rough guide - it includes files, pipes, tcp connections etc etc - so it may give a slightly larger count - but the aim here is to see trends - are we stable or do we have a file leak?",[211,252,253],{},"So - here's the plugin code I ended up using:",[238,255,259],{"className":256,"code":257,"language":258,"meta":247,"style":247},"language-shell shiki shiki-themes github-dark","#!\u002Fbin\u002Fsh\ncase $1 in\n    config)\n        cat \u003C\u003C'EOM'\ngraph_title Open file count for glassfish\ngraph_vlabel filecount\nfilecount.label filecount\ngraph_args --base 1000 -l 0\ngraph_category Processes\nEOM\n        exit 0;;\nesac\necho -n \"filecount.value \"\nlsof -u glassfish | wc -l\n","shell",[245,260,261,270,284,294,308,314,320,326,332,338,344,358,364,376],{"__ignoreMap":247},[262,263,266],"span",{"class":264,"line":265},"line",1,[262,267,269],{"class":268},"sAwPA","#!\u002Fbin\u002Fsh\n",[262,271,273,277,281],{"class":264,"line":272},2,[262,274,276],{"class":275},"snl16","case",[262,278,280],{"class":279},"s9osk"," $1",[262,282,283],{"class":275}," in\n",[262,285,287,291],{"class":264,"line":286},3,[262,288,290],{"class":289},"sns5M","    config",[262,292,293],{"class":275},")\n",[262,295,297,301,304],{"class":264,"line":296},4,[262,298,300],{"class":299},"svObZ","        cat",[262,302,303],{"class":275}," \u003C\u003C",[262,305,307],{"class":306},"sU2Wk","'EOM'\n",[262,309,311],{"class":264,"line":310},5,[262,312,313],{"class":306},"graph_title Open file count for glassfish\n",[262,315,317],{"class":264,"line":316},6,[262,318,319],{"class":306},"graph_vlabel filecount\n",[262,321,323],{"class":264,"line":322},7,[262,324,325],{"class":306},"filecount.label filecount\n",[262,327,329],{"class":264,"line":328},8,[262,330,331],{"class":306},"graph_args --base 1000 -l 0\n",[262,333,335],{"class":264,"line":334},9,[262,336,337],{"class":306},"graph_category Processes\n",[262,339,341],{"class":264,"line":340},10,[262,342,343],{"class":306},"EOM\n",[262,345,347,351,354],{"class":264,"line":346},11,[262,348,350],{"class":349},"sDLfK","        exit",[262,352,353],{"class":349}," 0",[262,355,357],{"class":356},"s95oV",";;\n",[262,359,361],{"class":264,"line":360},12,[262,362,363],{"class":275},"esac\n",[262,365,367,370,373],{"class":264,"line":366},13,[262,368,369],{"class":349},"echo",[262,371,372],{"class":349}," -n",[262,374,375],{"class":306}," \"filecount.value \"\n",[262,377,379,382,385,388,391,394],{"class":264,"line":378},14,[262,380,381],{"class":299},"lsof",[262,383,384],{"class":349}," -u",[262,386,387],{"class":306}," glassfish",[262,389,390],{"class":275}," |",[262,392,393],{"class":299}," wc",[262,395,396],{"class":349}," -l\n",[211,398,399],{},"This got added as \u002Fetc\u002Fmunin\u002Fplugins\u002Fglassfish_filecount. I also had to specify in \u002Fetc\u002Fmunin\u002Fplugin-conf.d\u002Fmunin-node (paths are from a debian install):",[238,401,405],{"className":402,"code":403,"language":404,"meta":247,"style":247},"language-ìni shiki shiki-themes github-dark","[glassfish_filecount]\nuser root\n","ìni",[245,406,407,412],{"__ignoreMap":247},[262,408,409],{"class":264,"line":265},[262,410,411],{},"[glassfish_filecount]\n",[262,413,414],{"class":264,"line":272},[262,415,416],{},"user root\n",[211,418,419],{},"to avoid errors from lsof.",[211,421,422],{},"The output shows that the trend is stable, that the limit increase should be enough and that there isn't a file leak.",[211,424,425],{},"It also shows that the lsof count includes more than the ulimit enforces (since lsof contains many different types) - since we see the graph going higher than 2048 which is the ulimit for open files. However - since it is showing the trend I needed to see I decided that it would do.",[427,428,429],"style",{},"html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}html pre.shiki code .sns5M, html code.shiki .sns5M{--shiki-default:#DBEDFF}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":247,"searchDepth":272,"depth":272,"links":431},[],"2009-03-26 09:39:43 +0100","One of the systems that can be used for monitoring trends on a system is munin. It turns out that adding a graph to munin is reasonably simple.",null,"md",{},true,"\u002F2009\u002F03\u002F26\u002Fglassfish-and-too-many-open-files-monitoring-with-munin",{"title":206,"description":433},{"loc":438},"2009\u002F03\u002F26\u002Fglassfish-and-too-many-open-files-monitoring-with-munin",[223,443,444],"glassfish","monitoring","MZ7nSbTyAFMSLkxgVwmGGOXBKZN659lKFb575tSe3fk",1775293014968]