{"id":2189,"date":"2011-07-29T01:06:00","date_gmt":"2011-07-28T16:06:00","guid":{"rendered":"http:\/\/tsaitoh.net\/wp\/2011\/07\/29\/usbrhnagios\/"},"modified":"2011-07-29T01:06:00","modified_gmt":"2011-07-28T16:06:00","slug":"usbrhnagios","status":"publish","type":"post","link":"https:\/\/tsaitoh.net\/wp\/2011\/07\/29\/usbrhnagios\/","title":{"rendered":"USBRH\u3092nagios\u3067\u8b66\u544a\u30e1\u30fc\u30eb"},"content":{"rendered":"<p> munin\u3092\u4f7f\u3063\u3066\u3001USBRH\u3067\u5ba4\u5185\u6e29\u5ea6\u306e\u8b66\u544a\u3092\u3055\u305b\u3066\u3044\u305f\u3051\u3069\u3001 \u8b66\u544a\u72b6\u614b\u306b\u306a\u3063\u305f\u6642\u306e\u9023\u7d9a\u30e1\u30fc\u30eb\u304c\u3046\u3056\u3044\u306e\u3067\u3001 \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u9593\u306b\u5165\u308c\u305f\u3051\u3069\u3001\u52d5\u304d\u304c\u304a\u304b\u3057\u3044\u306e\u3067\u3001 \u76e3\u8996\u3092 nagios3 \u306b\u3055\u305b\u3066\u307f\u3088\u3046\u3068\u5b9f\u9a13\u3002 <\/p>\n<blockquote><p> nagios\u3067\u3042\u308c\u3070\u3001\u7ba1\u7406\u753b\u9762\u3067\u8b66\u544a\u30e1\u30fc\u30eb\u306e\u9001\u4fe1\u306a\u3069\u3092\u3001Web\u3067\u6b62\u3081\u305f\u308a\u3067\u304d\u308b!! <\/p><\/blockquote>\n<p> nagios3 \u3067\u30c1\u30a7\u30c3\u30af\u3059\u308b\u306b\u306f\u3001check_XXXX \u3068\u3044\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5fc5\u8981\u3060\u3051\u3069\u3001 USBRH \u3067\u306f\u3001\u81ea\u4f5c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002\u666e\u901a\u306a\u3089perl\u3092\u4f7f\u3046\u3093\u3060\u3051\u3069\u3001 \u7c21\u5358\u306a\u51e6\u7406\u3067\u3001\u5de8\u5927\u306aPerl\u30a4\u30f3\u30bf\u30d7\u30ea\u30bf\u3092\u5b9f\u884c\u3059\u308b\u306e\u306f\u907f\u3051\u305f\u3044\u3002 \u4ee5\u524d\u304b\u3089\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u6a5f\u80fd\u306e\u7121\u3044\u300c\u7d44\u307f\u8fbc\u307f\u5c02\u7528Perl\u300d\u304c\u7121\u3044\u304b\u3068\u3001 \u7269\u8272\u3057\u3066\u3044\u305f\u3051\u3069\u3001<a href=\"http:\/\/www.lua.org\/manual\/5.1\/\">Lua \u3068\u3044\u3046\u30d7\u30ed\u30b0\u30e9\u30e0\u8a00\u8a9e<\/a>\u3092\u898b\u3064\u3051\u305f\u3002 \u3068\u3044\u3046\u308f\u3051\u3067\u3001\u521d\u3081\u3066\u306e Lua \u3067\u3001check_usbrh \u3092\u4f5c\u3063\u3066\u307f\u305f\u3002 <\/p>\n<pre><small><strong>(( Lua\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb ))<\/strong>\n# aptitude install lua50\n<strong>(( \/etc\/nagios3\/my-plugins\/check_usbrh ))<\/strong>\n#!\/usr\/bin\/lua\n-- arg[1] warning\n-- arg[2] critical\nif table.getn(arg) &lt; 2 then\nprint( &quot;UNKNOWN&quot; )\nos.exit( 3 )\nelse\nwarning  = tonumber( arg[1] )\ncritical = tonumber( arg[2] )\nend\nfh = assert(io.popen(&quot;\/usr\/local\/bin\/usbrh&quot;,&quot;r&quot;))\ntemp = tonumber( fh:read(&quot;*n&quot;) )\nhum  = tonumber( fh:read(&quot;*n&quot;) )\nfh:close()\nif temp &gt;= critical then\nprint( string.format( &quot;USBRH CRITICAL - %4.2f,%4.2f%%&quot; ,\ntemp , hum ) )\nos.exit( 2 )\nelseif temp &gt;= warning then\nprint( string.format( &quot;USBRH WARNING - %4.2f,%4.2f%%&quot; ,\ntemp , hum ) )\nos.exit( 1 )\nelse\nprint( string.format( &quot;USBRH OK - %4.2f,%4.2f%%&quot; ,\ntemp , hum ) )\nos.exit( 0 )\nend\n<strong>(( \/etc\/nagios-plugins\/config\/usbrh.cfg ))<\/strong>\n# &apos;check_usbrh&apos; command definition\ndefine command{\ncommand_name    check_usbrh\ncommand_line    \/etc\/nagios3\/my-plugins\/check_usbrh\n&apos;$ARG1$&apos; &apos;$ARG2$&apos;\n}\n<strong>(( \/etc\/nagios3\/conf.d\/localhost_nagios2.cfg ))<\/strong>\n# USBRH\ndefine service{\nuse    generic-service\nhost_name  localhost\nservice_description   USBRH\ncheck_command  check_usbrh!32!35\n}\n<\/small><\/pre>\n<p> Lua \u3001\u3053\u308a\u3083\u3001\u307b\u3093\u3068\u306b\u8efd\u305d\u3046\u306a\u8a00\u8a9e\u3002\u6570\u5024\u304c\u7d61\u3093\u3060\u3089\u3001awk \u3068\u304b\u4f7f\u3063\u305f\u308a\u3057\u3066\u305f\u3051\u3069\u3001 \u3053\u308c\u306a\u3089sh\u5909\u308f\u308a\u306b\u3082\u4f7f\u3048\u305d\u3046\u3002 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>munin\u3092\u4f7f\u3063\u3066\u3001USBRH\u3067\u5ba4\u5185\u6e29\u5ea6\u306e\u8b66\u544a\u3092\u3055\u305b\u3066\u3044\u305f\u3051\u3069\u3001 \u8b66\u544a\u72b6\u614b\u306b\u306a\u3063\u305f\u6642\u306e\u9023\u7d9a\u30e1\u30fc\u30eb\u304c\u3046\u3056\u3044\u306e\u3067\u3001 \u30b9\u30af\u30ea\u30d7\u30c8\u3092\u9593\u306b\u5165\u308c\u305f\u3051\u3069\u3001\u52d5\u304d\u304c\u304a\u304b\u3057\u3044\u306e\u3067\u3001 \u76e3\u8996\u3092 nagios3 \u306b\u3055\u305b\u3066\u307f\u3088\u3046\u3068\u5b9f\u9a13\u3002 nagio [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,29],"tags":[],"class_list":["post-2189","post","type-post","status-publish","format-standard","hentry","category-debian","category-network"],"_links":{"self":[{"href":"https:\/\/tsaitoh.net\/wp\/wp-json\/wp\/v2\/posts\/2189","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tsaitoh.net\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tsaitoh.net\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tsaitoh.net\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tsaitoh.net\/wp\/wp-json\/wp\/v2\/comments?post=2189"}],"version-history":[{"count":0,"href":"https:\/\/tsaitoh.net\/wp\/wp-json\/wp\/v2\/posts\/2189\/revisions"}],"wp:attachment":[{"href":"https:\/\/tsaitoh.net\/wp\/wp-json\/wp\/v2\/media?parent=2189"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tsaitoh.net\/wp\/wp-json\/wp\/v2\/categories?post=2189"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tsaitoh.net\/wp\/wp-json\/wp\/v2\/tags?post=2189"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}