//����JFIF���     "" $(4,$&1'-=-157:::#+?D?8C49:7 7%%77777777777777777777777777777777777777777777777777����"����H !1AQ"2aq�B�#R���3b�$Cr�4Ss�����%�Tt&c����$!1AQ"a#2B�� ?� ��}X����uAo)��8��^�� IƟ�������`v�U�p��9�jY0Ǧ w)��E���허2jU`S���EK����w��5]kS������no���!�]���:?j�c����غV7�/��9N+�{����t����#��8zd/�޲�3���F/��=����ź�3��GN����quV��"��/��4:�{���z�%��ۣ�I�'����D@ %��8���8^�f}VV��)S_2��e��d�^Mx����"����͟?�U��C6�2��Q�%чm��O͓ ��cq���0r��ŖJ���Õ��_S��ݶ��'�|�G.��q�޾D�� U�����]nP�����%�EF���>˲E�"���d�&�'�f2�s6�H��]�4�w�� I�S˶4�VbaQ+9]X��t�N���x:M0J�Nx�ϙ��⟟"{nr���;|{%�vo�z-wc,�*|���k��}�����-m�5��5o����4�W9ؓ���w�߱�Y�zk�� �.�=��/o�ϡȴ^9���ҧʹa�m��t��QԬZ��]4�?����e���g��jr�Q������}�+)Ml��eE�]��M�P���En������!�`IK2R�UEwVIoͷ�c��p�;����l�ś��e7������΄uN �;����rПV�������8�|��e��׹9Y-���V_�G���.)X����Ԣ�Ov�<;��_"ڜ�]����ߙ�Er���݊�'K���{Ku��B��J�}K�I��}�2�4|�"�v)/�ʻo�5�����)�������6-Tj����d7�.C�]�Q&lU�,�Yk1�P�4�~U�K�Z�s|�$kX��6��+������屷CU�q��+N�(������j��l���G�rp�G&UB�3#k�39�q�f���g�7�O�8�K�i���m(AJO�O~����C#e`i���0w�Ħ��ij����$�cW�h���<��d�t������Qߺ���"���NO�tG+Z�Ǫ]b�5%�]��v5��$���)�u|q�Z�柡�����s-rۖ�u$MKڎC��mN��_��V'����/�1���u,�2���1�����p��vlc>қ���eN���n��ֺ�|���b�kl��=�l�ǷN�O���ʣl���z���*]��»v���Ȏ��[�)�j�[�fs[]:s��#m6Qt6���*�Q+�������`�};ß�j[F_��jc��v���`����r�#��w���}�|k<�ڞ��/�r53N���8>��Kh���� q�_��-��_��??��@���e�n�ſE�ܥ�D�YAE�o+ ޟd�}IcY7+t{=ɩ��>�}i�����J�fx�z��VdSz��ᔢ���]Q^C�J�ի��ice���itM�M�5��hڦg'�)�^ ��et#ۯ���"ÿ�fF�->4i���ؤ��2ݷ����6�#�p6�����^-R̫gE�T�j^I���.��k���ӽ�U�p~D9[��:/>��h>���� ���g�J��|�ۿؘ>m�l���9�jMK�� �=�+�*2�i=�0�RiͶۗV���{�����"�u]I�H`��9���J_˹���K��ƼK$�X�-�|=v�e/� �������bjx���w����.�9i�%NqV��J��c�F��Y����K�cT�t�O��,�F�;%��6��7��vYb�8֝qq��0���t�U�t�=���D�����va��wsS���~����~Edzr���^F�-v��{c�++ݔ�|9��Iy � �#�nO�����av��OY��=3690��T���c�����r������i�lwa����˓m�$��?�箵S��6��U��� c(��.���~R���7s�u���M��h�q��cM��On�Ko��c���*ȣȩE����d���'��J� �ܜk��*�_�q�}%�M��/�7c�����.|;���trddbsd���������cJ�ev�8�5̤�i�W�� �Ę� 8C# .�딖�e$��s��k80���^��J众2���)N�m~|Id��j�����_�� O+6���ǻ��#�(�M�Iz�4Qo��:օ��Y�,�:�q]�̌"��lK�}�{F]��ζ���)���h���>�ʶ� ^�u�e�7�8_G#���rq��v�$���wk�k�[���Q ��c��+վ����+ĸZΝ��F��B���]V�zo���iJRke&�Kg�o����m_7W�ef_7,�o�����sJɽE%��lzB��t>m��R�������s�)v8'��P��0ֲt����rOg4�p_2`��GlhY�ڦD��F/ӚK�m��t�m'P�2�k��qU7��6���5fJ���Y:�y؊.ox���%�8�V�_ִ̌ܞjp��q��w��ЮQ�;�i�U�cNo�O��o�ٸc�Y w�*��4soӵk�q�f�$��?�-��jy�~0�{�>�?Da�L��8�X�L��/�ɞ����o+'�8� {ʸx���գj���#Dy���)wk̘����e��۩+%����}���~;ڼ���5�xek|y-%�ڱ-ʜe:��EE���S��cÚ5z|r'��&�I�&���яF��*��F�7�|�[n�RF ��=��(��4�ۖ�@.� �n7@x��x:N��^�8��B<�m�F&�W�=�mt�/�ex����%�Ռm3+2n���݌��o�;LՅf�w��,So��H�C�ȕ��n���li™s&�{&��1��P�<�Ҝ�]>g%u��/���ny6&��d������R�{�?8��U_����Q6��Z߯�-��oh.��N�R��]}� qi6��~H�(����j���7*uF&l&��o8�t���s�]/P�89��:j�W*��$�w׹���Ӌ �F�x�ps��CJ�i.�������7N ���q4�W�U����_}�7����*M��#�qW�iص��n����k'4ݍ��l���*t^�� ��c�<'d�:��~�͗�e�n�FQR������z�9��v��~������d��d�o�TZ��̚����k7��X���(����w�UswO̙fո�ҁ���Օ[�$��IAI>W���W~Ī��EѢ�Noe�u�t�Yߑ-��E�ix�ι��p�x�q{F�ny�f�R�r�j��q�����U᫤��]>�����wPU�8�)Y-�7W�b�q㛋w:�7�����ܣ]�.����j�%K�:����y�4���] %����9�$���I�%��p�����T(�����󨪙V��q�i��Y�ٓ���4y�~5���S/�X��TDZ�M2lȪ��;� ��S��~���K�x�:��(�Mn0�'����;���-{*�qV��&�|W<�rί���7��� ������� �f;�*Qo�r�4�1�*�/�����3��S+֔a�{��R{�s=�l�Y�m�N����9Fn�&��o�'��}Vi��(� ?*q�V���5��ѼC�Ns��M��饏z��ߴ�$�����^������O6�9��@ ,�$y���|���j�E�;g�W/u|M?3+ZՕ��N������86�����յ��w%|���QO����㏏��S��E#�ddsg�l�+Scl�3�~�~C��ԕQ���ľ�?5�_ z���߿t����11�OĶ0�>�oB9E/S����OSk��+�b�&�Yn>���$�����툧�e��g�) �"�!�܉(1 �uB���o�J)��/�t���/��,:�=�7M+1ܺ��#�Cm�S���^Nz� 6[�������u&]+|Dfj:uZ5��-Z�^�Tj����Mtm>���c��ȳ ��N��dT��_,M�#E�x;�pt۴�ͮ�#!���N �iK�l�!�z����Pծ�~$��1����Si��O}� H�I��&g ����Bf����)b��%K�o�̧kum���En�ص��;V�?j>nlt�OM�Vۆ�l�>.W�u��eY��a�w2�+�q���K�,?u��Hiqq�SM�}�~��gu�3����x��bc��W�S���y�/X�c�{%�sZ�]uaU�M;���7�:�����c��b����5�G�9�7'�7�þյW�,�;$ܛ����y�V����j�l�޻�y�7S���;�o���6��g�f��.T�г�[7/�i1��Z^r�E� cUF'�P����1-�?���%���u&����q����{fw�~�27���ޡ ��^w$��?S�w��P[�=R3�Y�7��3� 4��x(K�k�&�r��L�ȫ���MKn�:R�j��c����I?3��Al`�v��ض���[��POĖ�SY�u�j�j6��v��+�-�[x��ҵ��=�~��zNN>�ɲQ�/u�u����f�����o*��e�6�l�����;31붏�.�>�w6=7#7�dFD�c����%�ƶ��T��bd;�2/�=?A�s�r! ~ZS�S~I"���9�y]�Hn�,�Ċ�J7�S��}c��K�"am�Cg3�y��P=�RQ�ɤ�W��}t�;-{F+v�+R���ɔ�ڎ�B?����º������{�SV�묖��k�ۏ�mK~%.��Q;�O�fE�f�_�Y�/�F�-�V���-�M���d�D��)m.Z��Ս��8�Y*��h��[���g�/�6yd���m�Cc[��rdf���ʾ䖗g��d���$^֍�^ʅѻ��L�|<[��݉�����߯�Ri�JU��o���'�;�œN?B� sm�S ��ܹk���س,����m���RE��^�ѣl�J&��.�ċ԰�YO���:����޼��fZ'H�CѯU[��ʩ���1f������f����4S-٥�Y�xT��IGLi��ыr� }L)ed�ׂ�*���l��|�ٚuox�ӿ�nWk�Tb�b���V�m z���T_���'�"x�����5��V�ި������xo1���ج^�F��q6��Sd3����w�s'/ڞ���6�m������?��}�1�O�sR�G�ݝ�+�,�~��ڬ%^��p��1�e�f��5�c���25��v��q~��﹉���ă�������[r�-��e��q]����� ����8+/E���S�j��}?��m����U�E.�x�����Y�K�3"oƔ������^��Y9I��]�I� ޑ"�� &��*4.�J�â�}����ټQb��X��K���J��񽼀�nc�g�`�+�ri���ܭ��_�'��Bֽ�p����%�b�X�'�7cB�}��W�P������m�|���z�H�ָLJ�h��j���~E>i~���Z�$����297���|�_h���yΕ&�s��}���ZϷ *�j�]:����v.H��K<�SP�8�`�Pƣ)r� �,�}�8W�k[Ar�H��gn=о7:����J]T�T�P>�O���O���j J_��K�y���B���Ԥ��r�m�嬷ȫ�r{�ݙ5R�(FR�Ъ�6���q�}KLm�R�'��e��ޖ��z�6���[Y�ތe�����s�Y��YL5T��r�7�s^�r��ؙ����V͸�컬��j5<�W����hڥ>d��?yk'�����b��� S �}�k�r�a�^ߚ�RH�)�[sg.f��L��M����u�=�� v��J�Q]rVkZ����u��o�N���}#G�?y�����jO�%|i��2���f����K��o���Ӱღ�C P_Ϳ6Zr�{���e/m����$i����}9 G��2���')�Y�G����9K�Y>�|����1�ӫ� �+�v+i;hQ�@˿L�ӭ���n��˖ ��7�c�k>���Vr�.D0)�h�C����<�˄��4�"0[eԬݭ����e+l�����2s�3s�s�� o���X��]��1r��]+�VK� vI��;�mZ'��)�R�6�e5=��/�i���@�]��H�^����Z۬��՝�E�����W.�jƆ���f��{8�m�X�MV���~�_̝���������z^VR}T�6���3}�}�k��3��+k���3�:j�1P��h�l�p��i�{�欍BȽ�}6���w7�3G�t�UZv>4eUj$� xz�$���$�D�/����߇�ߟ�I�"uk��̜�������aƪ���*�ke��/F:d�һ_P������E1������ݡ��k�p(��5��ʏ-ɮ����{Y�llԧ�g�!ܝ �g]i�-�um�εŸxOê^=�P�R ##X�e�M��y%�2���L~��󜺶�Hm ����ݙ2t��_�ƶ�z��7��'Z���4T�<��"�AM��-��&xa�C]�a���5.h�uQ۫�$c�M�μ|h;.�J�.�o�߸���sE�-�z�U{d]��;��|��YLS�MvSE�n�eNK�r�1�B[]�Ne��on�Nߪ$4̘�FPr�k��x�ޱ=�0l����r7Q�%�=�$K�Q�;0r*�XK�dGۃ*�]w-��np�ᬶ���t��t��4�>�D�c�[Ou�o3/����)-��W��Ҵ� xs7��1��e�Ԥm�*ٖ웗H''�.C���nmy�]��݊K���r������a[9)Y�#��2�U���6d7���t�f����.[R.��Gd�E>#���O�_�.+-K����`�{����Ko�nR_��Õ����M/)?�:F��,�Xo�1�ƽ�Rmz�8���C�]l��D�� %�(��x�+�d�2��Ah�+����C�CLJ��!���D�65x�����ȼ���v)������Nr����p�*�[Y���ُfL*���PyVΚ��u���W�A�� K��4h�yY��dw��ih���NI�y������#u��b�?4���NDϐ��'�4� :n��F�e(�o��%ve@�@x�l����-k%��Qƭ�RP����&��kεMŪ���-���Ys2�u ]�����T!}�8��*���T�Qn��Z}v �=~�mԧ�yD�M���&����8�K�����>��2�|�Bn�u��gܷ��.wvCs���̼�5F^���ubE�S�7ݢ�M&4�Ź�-~m�Kx1�(����(s��r�!M5�u��y��q)�oy|���a��)ˣ����,�A?w"�T�휳2��F}P�R�-<�2��%`�~�4Z�5�W"�(U����S�kG��p�T�(�~Q�����j>ɰ쏳��Ǔ��S��K�Kx'��s��]�nE�f������'.�i�ݙL>�M�oƹ��k�������7ݭ�[.�г��6�lk<;?)#E��]�xF����U�7�'���>vF%���R��;t:��Җ��s�}N�S�B���W�X���=Y8��ث�}�~G��)S�^^�ƽwR[)/Fm�-ڞ��T����K~�˓��Z���]U�;R��Q�=��M��/"�N�ԝP[��-Y9�t_��8�V�+}P������?U�e{M�/�O�&��W��W�K�v�c#�r���'���KM'��p���[±v�tpRC�/W|7�K�2�����������R��f������m;lj��m�%�Z]�^T�����[�6������}6i�TC� }L[u�x��g7�(�Z}���.��� S�R���I)jҞ��zȶ�쳢�o�Y����R��w$�ŷ"J�ǭw{u'R taF{;�3�h�HB���RP����(�*�Z�Q]�y;�;k٥�nWbG��Kv�-V?��ND�Ҟ�k�d��9����@���z �LJ�}K��c��9�C*�?�V-��*[�*�۸�-�0��.���|󲝳ߗ���Z�K��#��%�_O�FGF�$k�C��$[�����NNJ�7Yn[k~Xzc�+Sʲ������uh�s�w�^��^4+�n�El�b�Ʈ��K�D���,�}YLV��=�i���=|���p|��_�=b5��m�ȵ(~,�em�����#Xƥ��.���s���V��o��Ea��W�X�c�.l��Y�� u��G�m'��;'*�ӆ���}��|˯�U���fQB���v�o}���/"zw� + qv�Mr���Q[��[��Ad�U���2ٽ��CG�gjؖ�S~Ev����%���9���"��>���$�_2�Sߚ%ѽ��7jX���(�t��#21�r{��̬F����]b�(��)?r��[�Rı)W�[O��/�6��]���X�L��9���� v��uLh-�Ȃ9"'7���f���!Փ���䮿B�f}��[la��g�֧��]?P����c#D��9�������E��mf�K7��o*�}��)��+�n�!]qIo�^��FrNVNo�!Eƃ�d�#��OP�?�%ۋ�(m�P��u�����93�ۣ�{��}��2�&�����$�%�c��Z߯�L��ҚY��)�;���U af�Զ�d,���*'�6��_?B:R�~��}�^̬�~m�J+v�C}Ѩe�"MY+�mi���� �:���s��쥸�;�i��J�e��Y��vBd�deK���|��#5��/m��z�����R]F2 J���H��U��U ���)��/S�{���I�����c���$�=: W)>�} ��@��0��#URs�R�����=w"��L{�+���ɞ��)�d������|������*qq�2�>��[�nƨDۋ�-�G���[6��½��J���|��������{��Ѿ��4��M��w��y������G���-�Σ Ze�{ug>�2�|�'zΤ�2%�x�Ց��*<�<�eu���SO�{T�H�l���o"�T��,ۏfD�E+{&�]v����}��Վ�r��I�|�>�Q�̥T��'��)u�L�����kj�n(z�F-J�O�R}w��n�~F�V5�z�q�2���m�'��^�VS��=7Y^�R��df����eO���)>�E�p�X붚�w����*�r�����*����w˿^������kڴ��{��J��;K�۔���������sR�Ŷ�U]p�zn@dx���6[+y�e�H[�_m������_/��I�&�m��v|M����5&&�-G"v۴�^�{v��g�8���Y�(K�_�~�h��0e�� �Ax��f����r�z�ڬk��h�S/V�y�1ϯ��d�W�3�'�͹�}�{���'V-:����MW(V�/ͷ�*�E�7s����Em������E��W�}�b��Ur����'�k,P�{9?B֫� #[u��N�r����B��,�wo�^{f�d�F(5tRf�.2J����-/:����~� t�0�M"�d_/����c^��32�*�q]yLl���^2�[ݥ�Z�c�*v��tm2��13r'�tSuM-Խ#o�/H�F�������+��2�VEpmǦޟS�?�R������s+�t���:��u G8��n,����Ԛ��f,���hY8�S��X�*��rK�f���>����+c��p��r��u����ɬ=D���Mr��X�gϸ:�~���ɲ ~]�'�5��'�k��Elw�=ڞ��AG&�')�G�9R_���̝1K��;nP�g�&������T(ի[^J�ҟ"qo��Ӹ���.��W}3mF�>��'$��<���U����6�-�~?��x?�B����~{����^�xk��pv-v�l����ߣ�e���빹�j���(�ښsuu6��l�H��(�q��o��aY���t���?�x��8}Ie����� �'����@��b��%�T�ݲ����y�g�V.+O���9/W��4Ms�C�����M��u����F��jYz���G.�{�d���s�.��k�(��>���G~��K�?ni-�=R� r�����}�r���� ?�s�̥���%���l��5Ϛ�9I�N6~��۩�R�ĢW��N�ʾ�E�[��|�nb���.H���Y��—קW�k��r�1�ҺշM��N�Dp)�^¸��R���:���w��;�u����1���������� 12�]��T�/��U�iʹ�d��%���2OC����2�K*r���5�S]g�凫5�� U��Q��.ȫ–� �/i91nj��F�k��Q�x�uJ1rn�%���XDžy�?��s˗�վ�uMGƋ�/�m���^�J*��Rs����F�)��)u�F,'l�{=����|�nF�m9:�N%�����u#���t��nXE���-�>e�2Y0�Pũ��������jU��ȨEŭ��|����'��eʹ[��o{��Ց������ms��%CG�g��/}t���|sn�����zr�vm��g�}cÊ94��P��v����g��'<���u�7M�Q�W=fح��ϗd�n����D���|�u�r��-�s����v�,icr�U.ej鷪e�; �+#"�o��w�戾!ȱf�:��S��K�dN>L�}ّ��g�궮Ա������ߢO��^f.��W�����-���sT���]��M���˔��ې��е<^Н�'�Ku�Nn<�FL |Nk��w6_Vl�8��*Kж^ x�s�uW�5���1�-�ᅱ�Fz�ƉT��-k�Y����/9�����w��z�Dޯ/��X�lW)�g�yp�ǚ�j�D�����ɨ~�{ݤ��H�Ci�m�.��[>�rq���E�_Uر��x�/>��|�L6�4%��aj;��fx����ӱ���F���(�K��֓���J��9�՞� � -K>� I�_5En���n��´���&�=O��c%�������o���̟��IJ�ZF$۲��5�I���9Wݚ� �n.��WTu����Ѳ��ӏ[��4�U�/9.���2z��X�5������j���3ĎEsM����q������4�%����9.d�[7�јc9e�N�����a+s�j��E';%��s�#�ɤ`�ףS<��E?�����U�u-_)�j��d���l���/��,��A��}Ω#��q�!�y���*q���r+�V��e��~��}�P���A)No�Kv���Þ�8�[���&3�}��ު=�m�:S��ɥ茍;'PɎ>=�WI쫢.M�v:�����j/��[3���:�rTF_��zt:�.��z%u�d��W%�]xܮVz$�Vŗ�4�9�[^�y.խ�N���~��M�&m�x�+w���G�<��e��캙C�J�Y����*��勱�����o������Q��7$��F�e�Zb�΍�E�[��)J�3j_ �D6d��n�k�y�[s���3z���:���b�K�2�7���.�m��c�JK��-��yG��#�<��o��|Ö�~�� �4���^�O�c�'}�����ap���V&2S��[�X}�����L�3�8F뱩�ص�]q_�E�m�רeٛ�(�u�s����s��sg���[�.�i�,'�h�����p�捗�u;0�x�Kތ_�/�5�Ἵ�#N|�]���O�{O��th��{��f��Kn� ='N�K���%]��ܕ�u�bda�Q�[]U�v�,�v��� ||*����������<�:c���_XƦ���W3�/�o�����֚_uIF��$����Kx�K&~�#H^o̒Ѯ�'�]��pgq�?ژ��-"90��9����-�����Y ��`��ٱck_�Ķ�Z���˶��dz�lk���{���㼷�^���Zw�����K�x}Wg�i��Ųq�>�R�~_4KC[ʻ:v>�0�3߶�v����9x�����-�Mȧ$�c��:l������r�C��Wje����g�%��ֹ�_�Nh�՝���Qɏ���j�^�ϛ�r���^.>��W�h��l��E�5�y���ֵ6�W^�确]*���г����c��&�^��NI��[�����oCDn.�ߑ!�����,m&M_/�'�M�n��$�s�r^��8��|�uSZ���Z1�|L��V<�(���z�q���׮�x����m���ٚZƏ%��.��Ԁ���s^2�𱸒���O#&�,�s��[�mײ9��k���ޖ�C���oS���q&��俙�q�x�P��.��N�] 2�U�ǎ�sM2�����i�N.���f����� �r�[��m��cQ��Z�mF�ُ�E{��������#����[TbҔ*s��f�a�S��r���n�^���8�N<����_�'M��arJ6��� E�����Q���ғ�|�F[S'[��~q~k��m����n[�_�x?B� �f��5��Q����١�X�=�g(�����~[��Cx}�G�O �ĺ�o��'e)����~���dq(Ot`�����s�N=��~���h�����e�u �:���:�m��'�C�jj�>~5���V����柙c�y�QD%u��q�E��c{[l��^U �O�]b����~e�Ŧ�ۑ'��W3���&�' 2��V��.^��D�%��G S�6���wY���NO�$���. �O+�^�ŵG�~haE��s����^=1���*��b�I����C���zFF��4����O�#�,�Wu3허e�k�B���I'tWM��ߩ�OG��3i�������F���z��{rg���e�M�9g� r] ���i��3gk�&u�1r��/��1��k��Vg�R�-ɿu�������F ����.�^���;��<��b�����&+˺�x�9B+e�00�W���7�H�af5SQ���x��Ka?X�����IԔz$�܇ȫ&�,��l�y�kȟ�8��Ʀ�B�q����7���G�����oo!���j2"6:��*�uE6�v�{7�U��S�*r�����Se�5|Ll 11a��o&�%�cAľƣTV������<�k���K��>�3��;�?3��큦b�N��̂�r�4��ovMkڞ�}���[:,IV��G�<};*�-�2"���,�>��K��%�bK2�Ƨ[���w��!)�ˤ���;���d?4%�Ul2������ږe�c4�����#��ō������Iw�^R_/TFX�+�����*���F��M[F��|�a�'��������ߚ2S�I�M�eVGn� �~�&���Y ��Ym(?��ԛ���]�������,=�|с�G�����4y�j�k"Q�^��~���ԗ^�c��,�q���q����rg��^-����:�U�c[E���8�>��>k�|��n��S�.����.��LBI��c���>3�i��|��ZE����Z��X��A���qm� nuOm<;�� ��X~�mrK�=~� Ʊr���SN<��U!F����΋W���S��/|���t?K)zd���} ,��C"��ov���x?b�բ�s3�mX3桭�X����֖�˦��k�Fdd����h��g}��$gg�S�o�5��j��L�*N�����dJi�s��$���� �E�����Q������v=0Hxzy��W��~F�T�_��Ƶ�ccg�,<���l7R�O�?S~״�i�6v��׿�/��k�|�̪�.�IIE���]��4��n�,��I��N�U�LϛN=a9t��������Jp������.�]���62�v�ՙ�'�I�d�i�c;Iбo�R�4�|��;��)-����1�卍���뾉)�5�d�뱉�`U����'�R�]۔���l�6s���@��c���h���H)R�t�,w�>&=_�V���������(��%�����k���q+_�÷�O������'�����[_�[Uڽ�v� F� ���$���Ξ9n����5EN���/4�Yy/%*���}�� .����jΔ`�V_6�VͲo���hzfOg�ޯzpj}y�}�v:3��4�WH��;+x�7�ӻu<��ݦ�"�mJ���/�=>�e�o�D֣c�4��k�X�W��-��[��}٬6�;t[N�a�_•�� _�5���i5˗�s�ٴ�]+e�����;�Joj�㼶ۙy�Lumo��5�&�F�)F�������� {�(s�m�����_M����>g������z��cr�)�����K�U�̠��Ħ=�����VDd�'��h�;-aŤ�9�����K�ٰ�q��Q�ܫ�ަ���azM�p����4�b���k9 ��U��X.ͮ�]�Ke�S���5Uq[�¹X�0��ɦ6]r����o���Fj��ʧ2�׏��6�/��C6�eQ���E5�K��Ӱ�msFnIz&`�z��팡-��ٯ��.i������xy�ك?����c�2��/��/�z6��������M���4W[�]��_"?���Õ[�?���� �����Vf�vӳ�q]���I5(�d��|�Mʝ�z���cC*�m�N�>�B2�g�D���+�����><��e�:G�h %U�kW%zJ8���k�_���ˠ=KF�R�����f��w�{sŖ�^��q�/��{�v����[����Ω��}�g�L�j�T[�t�_ޕg6G~���r��k���k�M�cS�R��K�բ����5��4���?SAû����O��1��o%[>��5�/R�~C�io��N���dN�ʛć���h���>�f����6�H8c�/��<�1xd��[ŦC�E��k.�9"��ej?�w&O6^�ژ��R[v��rQ���.�z����㎩��f6:V�8���}����h�i����2�z��~�� �s�-�w�]+|I9s�_C~>-�S&����9Z�FVL�f�7�-d'���p��ՠp�����l�����J#�mm��؎�s(�?Ʋ?�/A�%_�����s��X�uGN���nR�}_dq>1ʍ�|У��3���]�N�X�YZ��ʷ/&ܛ彖��L�S? 6��]"_�t�5�q��P�5�K�q]�^m�����91�j��W���暹U�����6-5WU������澦M�������0˵��f�2��Ӫ�Ǯ.P~���?� �_nE�J�TcT���ei��)ٳrۣ�%x� ���%g���s��}7���l9'�t�b���~d���X��st�#� r�?��}W���eaq��>=�+��t�����o)7،��E*�v�n�������e_��,�NF�x�c��i�v��z����]t�M˼���?Oԝ2��Z�r�λ�s-�ĺ��Eton��I�I��f�m��/��9^�[�^�E���B�U��jOn�r�6vI��&� l�]%���0"��)2���䒶-+R��*��z�yX���<�> -���X�9G����Uo^�xY�Q8ι��vi�xٔa�t)�hv}ьո�VU�~��t��������K�,�=�_w����L����L�a?T���YIo�]$`N6c��bi��?#7;M�R�t����<�.��~Q�-��m�o�����b�\g���5���췍�������� ڌ��_?�8nf���J�N�/Y�͢n3���?�_�s�ϩ����{H�i�ְ�Po'yS?���?_�j���ߡ�Wi5q? MW�Ȳ)�����8�a]�l����Lˏ-�-b[TX�lΫRy;�o�5�뜾$H�W.m��m?����շG���[Ƀ�� ���se�o5Q�}���Le����%�*�،«~�u�U{��R$t����^����%�!�w��eX��:G(�'6WupTS&����~�8�������=����j��o?2�������_PϖE�[n��f�6�Tٯ;�G��L��W�)NM�[��o*�j�%.g�b����|��䭹n���o���O�X����:�1�R�)UT�j���7�4˓]D���_�bʝk����zN�I.��9|�^G`Ke��Q���{m��O���jX��/sR�������7�e�vd�g�i7�����q�m�}ތW�&��4�=~���|�YY)�?��7����O�j�}xXkF×4c.l����?�����i|�b�[�5�Ή5�j-�[�Y����z���<���茲�Z$�������Ff&o��;g�Erǩ��ݦ̪/q[&[�/��9u�u���z�i;��������P��S^�_/?������]=�ΕqK~�ӛ����5'N��M�����[�m�_Ϲc'[����oӯE�#g���߂�v�v�GNRo϶�o5Ǩ[�ɉto�v��2��~i<7�i�SȜ�N(G���5����+/�����ٛ�����MTܣ�ukj��鷣/$�1˒!�Mxr��ߤ����s1Z�����uM�Q�Ȍ^�]c$C��X�r�j�����#��N/��˦�Ķ��9���]N�zê5�z�i����;�W,v��!ŧ�D�6z��ğ7�uR5��^�MW}��>igl2���U2�nX��o{}_��������w�]&���vt�e�Z��3 �MEEe/ ����2s㗼S�_���bIղ���T�I}�|�[Y��e�/���c]*�̪9u/����Dm�yNxS�D������g�i��� �`�Z?�.R�F�j����۪���'�~�.�[K�Vb�޺���o��濡�t�o?E�#����[��.�^�y���=��q4���F8ڎ����/���GX.�Y��W!��Z�.��ѕt��t:�?gYYy�U����%��U�w~r����i��>���ȦK��h�g,5�/=�>V��?T�rN�4aW��O�,oӕ���7��-����S���R����i�*"�dܽ�p����u��aV�����QÞ��d-�#J���2Nr�:#�``ѧ�W��R��-�F�?��I-��T�� -cO�T�2pr?þ�ז�g�E�I�j���~L9�%�E�MoџU��ؙt8_�eY�ΧW�j�U����}e9y9z/��#��TT-����2��d��L���t3H=���ڼ��cKb'���"�uIٓ'���[�[��߱F~�2]�r�%C�]�^V�����CL��jm���[�cJNr�y�f��}ջ�.[DE�oRՒ��b'>f�Vy���_�c��6�[�K4N�a5>���{ɳ�aw/Uj��.�Զ_K���~���?I�e�J�7�O��Q���x�3�I����gFc���*ج���Ɋǽ-���o��3�Ӭp� �/� ]7V�*���EN�����ܜ[�r/���tO�JΉ���w*ʨ*��J��F�N^.WZe��L�g�U����w��Ki/�M9y8��d�����kOᛊ�H�x�GĶM��*&��#��h��/��U�|�6����D��(�uFyE�5�hYxi�S�EV��m�^D|,ۿC�j�;���<�*��o��uO�kYp�Δ����2{x�-���L�] !k2��ا#I���M���'a7:��M}M1��Y儭�M�n�k�[��/�;����4��U�wk����k�ɫ%����a��ɔo��X�V�V$���m;2Z4i�9:>�����Yů=� ?[��{�t���6,~!���c�`Un��+�dW.g����K��yI�B]��l�+�3�k�ض����(��M�Z�}�>�k����C�~閹l[ů��]VNt�Ƹr몮X�+�U�>�v'��n�v�{y7�s[�г��̭9C�tv���t�%� G�qT��8=�wa���(��������6��Rd柮YWv��^F�d�^�+緉,+=-^��S"�k:N�V�u o�[�_TIѝ�椯�b�F���/G�㿏�dΙ?�T�}�K�������-�T�)W>�s?3M�)V�*����,�;P��,}B u{r��Dex�ڥVFf�w}��47���׋w}]Դ 1d�m��k1��V%/���'T�:���F���ǒ�_TEe[�l���/�l��/�ٯ��c{����Ƀ�[~��`���z�j��⾥r��}V�ܪ{M8�Qv��]$m�U]�8J2�Mngc�xY?�鑞����.9H��jx�S����y.��fS(�|�]��M����gcK�2$(���jR��Q��3��X��O����|<��f�����:J�q�4�&� �fw��|�$��N� )A8�ת99������� mF�NM��*��Dϒ� ��No�I��a9i9�y�?���:�D⻧�߇��7ɧ�����]�������mu��"�-˥5/w̨��_��� �7�DK��[�'�[�2�"��(�%���xzT�*���G�T���"�+<,�yX���.�l����EJr�fo�?��.4�N;l�����>jm�Z�ߣ5���FdB��3�r��,t,./S�]Q{tm���5l��ӕ�����T�~��A� �[��fv7���Iہc��:�� ��ΪN7I]������2(|�o�$��NLW�"��#��~�Dͭ���=v-�Mv{��-lqn{�I3x�n��'��6��.���=�DƟ���ܖަ�~deQV;k�����2�E��i[�b����Ӵ�1_�]����O��h��Zl朠��&�t�3x��k���ei+c'�ZԪ���'�h����K�梿�X����@��cTԫ����#e�m���Iz6e��^i?���8�� ���N��Bc̆�����f����+M��ׇd��C�]��Y���Sd��%��lώ8��-c7��eι/�}��_c�on�/n���o��핍~[WN�R�e�X�Mo��+اn� ����?#Ͷ-A����U�FN1V4�!��y���,��{��1��a����$S�﹑�;�Ǚr����"�__��[o�)�� �x��k�}7E�I/�r��iw�ؙ��7�m�R���}�`��|yr�E�Vdo��/B���# uٳi�NQK�Q�kᑑ^d���@��/=ˑɒ�7�����68fsuo�r9=7�ף��ܹ�ճ��p��M�r��-�$1uy���SOZ���N?đrqզ9F� q��=��.!������T��?ػ b��f{¯���q=�$��^�:�!�E�S�߿���� ���FuO���S,8�e��^��U��וS�^h�F����4���BQƺȪw�-��k�F��39�������@X�0��6� F�v=��Q��^��|�ƞ�5}�2tnmG��_��|�����Λ(��|%]��(�-5�>��Kȁ�N���$�=6����l��q).�����1����2� V6m�$ׇl���Oc�ҫܸ� �K{�;ľ>+���Q�?R��x�-K���eu u���������M����y$��i B}G���*���h�$���Q �-��W[�-&��a�"�[i��}~E�k�$�<�~�c{Mff�S� �e�S.��#�^�lMiy�t�ު]���9��S{u��4� {D���FޅS����ź}��R �]���R$y����<��b��;M�5Z�զ`ߕ7��Pm~���Þ�5�C��c"�:���^��D�٧/��d�ݽ��gQ�q�;X��C^��t��F�����|��_�=�p� �[N/���FG�-�K���*�m����0�h�ǯ��Mq�"�QE�6G�R2��EE/��/֨�}V�� �W��C/3g����8�[�_�#�K�(�sW]����L����eu���L��|�m�-Ml���R�)�ؼ]��|�W��3������x3K�Ϣ�f[W5��cNOvV����������I��N�n�yB�����s���>;r����/P���̙��3n��i�XM�t;����&���!rxw���ZFm�Q"wL�{^۔K&/g�r:�m=���2%�5���������bwE��"��^��e[��$���ɟPi!������U_r����d����S2��d�?=�[!(I�.�r����C� �Q�ZEim�%����}|���Ym�zZ_����ά�<ۡL���QM|��` ybP�����ȏ�}��?�]E�u[`��k�ҫ�g�F��b�~F}Q��8N��P>5���l�ӳ^-�K�%�Q}�$���sx7S�v�n������f�T����Ƹ�|K�zd'_ⰽ�ח�$4���L ��Y?q�y32�t� ��j���2�e�� ������Ȝr���J�{mب�h�ۍ��U�U'p�#8�y'ѝ�=�i���+Tĩo7WYyČ�k��L�5؝�M��=�%��"����N�t�}���eXW�)N.~s��v5pɮ s�SQ[���+-�/�}�kVk�'FEɩ�9S�������E&����T�=��&��緵� -���-��t��f��.9Ѳ4�_##�_�ɱ�T�����F����V���؞~��Y�Td�d���S������&s=䟚F��b�1.���_�5���}����~g���M���'p�#,�U h�s-�-�X�G� w��t�����Թ�Ti��7M:G���Y�K5�'^���W���?��C��>_�G�q��/�S��&d| ��k�_g�O� ӊi�Je��H�U G�_ Ê�g#),�}�-�:��5�>V��1��em�q}��t}�q?m��e�K����U�:��Bq��JeiP�ɗ#$�sI} ��Z生��ƫ�����oo�=�V=pV�cU���g�"%����w��E��m�叡���v��Id����hr���Ȕ����~F]p�58�_�.���,�O�|�'�Ɇ^L��!c��6OWӷ������{x������9�?����F�p�?ceO�u�T�+�Uɵݹ&��gx9���i퓃sx��GI������m}�_3�Ī�r#:�ԣ��?4ב�c[����jö�#��B7K�ʌWNo)�=+c�� �}Yv�P{�lv^�r+��<�i�}���l��k�&ߧY5��Z�ƍ���m�Ŗ���N��Y�9KM�I���d�GOR>�5Vx��x�_���:~=�̌���Q����}CTy+�Wh����鸚f$101뢊�F[#--��Y��i��@����l��)W8��/�E��>�8n��l�j/kt�O��ľ�����,��q*�[s�E��[�]:?�ZeQ����v��Ŕ�ɺ|�j(��Wx����,LW=:�S��?κ��q%8���1c)���jJvO�DLi�W,{96vr�-2��}-��E�H��,����}�%�3k��#l5�g����l~x�_���_W Sڎ �8Y��JQ�vA�=Q���IW��ju��6-��X�9�$�k�WЩ�CI�4�U��W������d��'&O�/C�f���=�P���i�/�#+>���n���$���K�Y�st܅�y4ʷ�D���^~%�~m�yj�,�s_4�Q�}΍��C����ή;S�W�����:�h=�Ff�{����.��B/in�ȇ���o���=�-�T͸���O��Y�2}h�l��K}�������.m7-z�?���,f-�/^����b�Q����W��s/���_͔/3I�n��[�6���M;l� �y�gؼ!W���UË_�)D���9����Y�L�4�����_��>f�}ϵ3h�V5����Oѣ��(�l�8�?L�4蹥���������[��-��Э=��7�V{���&�ʢP�������ʼ���*�3�c���Mz>���u��4�@�[�oM���� g�K����S[jy��"����L��ھz�ɵ�f�x)����GE���`ֿ.=k�J>/iˢ[��j�-�qץQ���C B@�o��� ��V��(��ʯ������G���?B�����ܻ�I���>�=K-��]���.���(�vO�E�.�5�׮=�/���P��f��^&�$��c�aY�����9{��3�މ�%�Y�O�����xZ�~�6�Z�;�������;�ԗ.�NJ�zş/�YϖĜ%ѿO��^���t�Y$��ν��4|e}2�ɶ��U9A��؜h˺�L�r�Im%�J�.�|I�]��k�G��|<��j��P��3,�9Uq�7��i�>�DzU k�4'(��T9߱^!z� -:�mW^������ <= �<�^�2�*;����Se���q(��6ª��s��H����f��5ʸO���{��Il�r~G ����u�JY^k�5X�_���y���;��5�'�59O@�ƣ�̶>��p�����n��COvN��wX���4�o�����U��Uf����]Џe%�MV�9�X��m�9���]�x�'Q�=���82z�)c�/~1���~�L�S���ow�>�ﺍ�ƻ��U�q���������l~�Sqo����羘s�k���}V�j�G7���1�kY��ؽ��]b��4qnM�ӡ��; �w@̇I��L㿗�����[4�3)]�=�v*)EH���'��a�񖳋�ҎT�k������x���uXG���K�& Z��I����R���(M8?�:�i�x�Jp��-�d��mck��pu*%N^-7E����3<��uc�>�����='��ce���E�&�'�;��_��J'��M�w𶥏��Y9�+�d9����+>���!���e��������_Sn|���VX � �-��TZ�u]��Ģ���/�6�ck�r�� /ޗ��/���z��[y.N�:*k�$ �}Yǭ�}GU�m�^-��%d�m�;K��_#c��t�B���[ss�g2�:8r�z���-�VE|���T� w��.�}w9NEP�Gn���oCe�8�/&3�qT�}MJ̙M���ۗ~��哳�,-�WI�_�Bs����h�+~�͛vN����{�Z�����dYK�ݲ�k�����r%�+lo�*r�e�-ه?�:vYqF��fC�s�q�M���XR�ķ{y�q�g�r�x�.�o��Ǔ��x�d���ڗ_Z�C9�W������o��mX|Km��V��_%U�J�ܷr���$��drȳ���L��~Mo�K����yY�L���i�c� J�q�<�1$�U�u�ٯTד374s�<���������ĕ96�춉r9�� ��p��������Gc�9�=�p�^�:)ZJb�&��V�ӝ��Xٽ 0�/���X�& ۳�*_ԙ���Ə.5�J�� ��6<����$��$��6����B0��d�����_��d?h�q���d>X�Ce-� wO�@p�g:�.>$�.Ϣ~L޲��|,{-ɪ2��.u�/Ds-[ُiVIW��K����5�M#F��ܭ3?x�����.)�ۣ�,�w���J)�Ȳڣ-�#��fbdq&�T�ͧ�8�����Q�,�YqQ�)�/�R��­?�k��˔��[��p�_�+�og��z����P��[��6�r��^��o���}�����_��k�T�}J�i��J;���<�ivE������H8�wI�@�MO�P�ʊ�#��+��$�� 404 Not Found
Sh3ll
OdayForums


Server : Apache
System : Linux vpshost1491.publiccloud.com.br 4.4.79-grsec-1.lc.x86_64 #1 SMP Wed Aug 2 14:18:21 -03 2017 x86_64
User : aloic1 ( 10003)
PHP Version : 8.0.14
Disable Function : apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Directory :  /bin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //bin/cmk-agent
#!/bin/bash
# Check_MK Agent for Linux
# +------------------------------------------------------------------+
# |             ____ _               _        __  __ _  __           |
# |            / ___| |__   ___  ___| | __   |  \/  | |/ /           |
# |           | |   | '_ \ / _ \/ __| |/ /   | |\/| | ' /            |
# |           | |___| | | |  __/ (__|   <    | |  | | . \            |
# |            \____|_| |_|\___|\___|_|\_\___|_|  |_|_|\_\           |
# |                                                                  |
# | Copyright Mathias Kettner 2014             mk@mathias-kettner.de |
# +------------------------------------------------------------------+
#
# This file is part of Check_MK.
# The official homepage is at http://mathias-kettner.de/check_mk.
#
# check_mk is free software;  you can redistribute it and/or modify it
# under the  terms of the  GNU General Public License  as published by
# the Free Software Foundation in version 2.  check_mk is  distributed
# in the hope that it will be useful, but WITHOUT ANY WARRANTY;  with-
# out even the implied warranty of  MERCHANTABILITY  or  FITNESS FOR A
# PARTICULAR PURPOSE. See the  GNU General Public License for more de-
# tails. You should have  received  a copy of the  GNU  General Public
# License along with GNU Make; see the file  COPYING.  If  not,  write
# to the Free Software Foundation, Inc., 51 Franklin St,  Fifth Floor,
# Boston, MA 02110-1301 USA.

# Remove locale settings to eliminate localized outputs where possible
export LC_ALL=C
unset LANG

export MK_LIBDIR=${MK_LIBDIR:-/usr/lib/check_mk_agent}
export MK_CONFDIR=${MK_CONFDIR:-/etc/check_mk}
export MK_VARDIR=${MK_VARDIR:-/var/lib/check_mk_agent}

# Provide information about the remote host. That helps when data
# is being sent only once to each remote host.
if [ "$REMOTE_HOST" ] ; then
    export REMOTE=$REMOTE_HOST
elif [ "$SSH_CLIENT" ] ; then
    export REMOTE=${SSH_CLIENT%% *}
fi

# Make sure, locally installed binaries are found
PATH=$PATH:/usr/local/bin

# All executables in PLUGINSDIR will simply be executed and their
# ouput appended to the output of the agent. Plugins define their own
# sections and must output headers with '<<<' and '>>>'
PLUGINSDIR=$MK_LIBDIR/plugins

# All executables in LOCALDIR will by executabled and their
# output inserted into the section <<<local>>>. Please
# refer to online documentation for details about local checks.
LOCALDIR=$MK_LIBDIR/local

# All files in SPOOLDIR will simply appended to the agent
# output if they are not outdated (see below)
SPOOLDIR=$MK_VARDIR/spool

# close standard input (for security reasons) and stderr when not
# explicitly in debug mode.
# When the nodes agent is executed by a e.g. docker node in a container,
# then don't close stdin, because the agent is piped through it in this
# case.
if [ "$1" = -d ]
then
    set -xv
elif [ -z "$MK_FROM_NODE" ]; then
    exec </dev/null 2>/dev/null
fi

# Detect whether or not the agent is being executed in a container
# environment.
if [ -f /.dockerenv ]; then
    MK_IN_CONTAINER=1
else
    unset MK_IN_CONTAINER
fi

# Prefer (relatively) new /usr/bin/timeout from coreutils against
# our shipped waitmax. waitmax is statically linked and crashes on
# some Ubuntu versions recently.
if type timeout >/dev/null 2>&1 ; then
    function waitmax () {
        timeout "$@"
    }
    export -f waitmax
fi

if [ -f "$MK_CONFDIR/encryption.cfg" ] ; then
    source "$MK_CONFDIR/encryption.cfg"
fi

if [ "$ENCRYPTED" == "yes" ] ; then
    echo -n "00" # protocol version
    exec > >(openssl enc -aes-256-cbc -md md5 -k "$PASSPHRASE" -nosalt)
fi


RTC_PLUGINS=""
if [ -e "$MK_CONFDIR/real_time_checks.cfg" ]; then
    . "$MK_CONFDIR/real_time_checks.cfg"
fi


#
# CHECK SECTIONS
#

function section_mem()
{
    if [ -z "$MK_IN_CONTAINER" ]; then
        echo '<<<mem>>>'
        grep -E -v '^Swap:|^Mem:|total:' < /proc/meminfo
    else
        echo '<<<docker_container_mem>>>'
        cat /sys/fs/cgroup/memory/memory.stat
        echo -n "usage_in_bytes "
        cat /sys/fs/cgroup/memory/memory.usage_in_bytes
        echo -n "limit_in_bytes "
        cat /sys/fs/cgroup/memory/memory.limit_in_bytes
        grep -F 'MemTotal:' /proc/meminfo
    fi
}

function section_cpu()
{
    if [ "$(uname -m)" = "armv7l" ]; then
        CPU_REGEX='^processor'
    else
        CPU_REGEX='^CPU|^processor'
    fi
    NUM_CPUS=$(grep -c -E $CPU_REGEX < /proc/cpuinfo)

    if [ -z "$MK_IN_CONTAINER" ]; then
        echo '<<<cpu>>>'
        echo "$(cat /proc/loadavg) $NUM_CPUS"
    else
        echo '<<<docker_container_cpu>>>'
        grep "^cpu " /proc/stat
        echo "num_cpus $NUM_CPUS"
        cat /sys/fs/cgroup/cpuacct/cpuacct.stat
    fi
}

function section_uptime()
{
    echo '<<<uptime>>>'
    if [ -z "$MK_IN_CONTAINER" ]; then
        cat /proc/uptime
    else
        echo "$(($(date +%s) - $(stat -c %Z /dev/pts)))"
    fi
}

# Print out Partitions / Filesystems. (-P gives non-wrapped POSIXed output)
# Heads up: NFS-mounts are generally supressed to avoid agent hangs.
# If hard NFS mounts are configured or you have too large nfs retry/timeout
# settings, accessing those mounts from the agent would leave you with
# thousands of agent processes and, ultimately, a dead monitored system.
# These should generally be monitored on the NFS server, not on the clients.
function section_df()
{
    if [ -n "$MK_IN_CONTAINER" ]; then
        return
    fi

    echo '<<<df>>>'
    # The exclusion list is getting a bit of a problem. -l should hide any remote FS but seems
    # to be all but working.
    local excludefs="-x smbfs -x cifs -x iso9660 -x udf -x nfsv4 -x nfs -x mvfs -x zfs -x prl_fs"
    df -PTlk "$excludefs" | sed 1d

    # df inodes information
    echo '<<<df>>>'
    echo '[df_inodes_start]'
    df -PTli "$excludefs" | sed 1d
    echo '[df_inodes_end]'
}

function run_mrpe() {
    local descr=$1
    shift
    local cmdline=$*

    echo '<<<mrpe>>>'

    PLUGIN=${cmdline%% *}
    OUTPUT=$(eval "$cmdline")

    echo -n "(${PLUGIN##*/}) $descr $? $OUTPUT" | tr \\n \\1
    echo
}

export -f run_mrpe

# Runs a command asynchronous by use of a cache file. Usage:
# run_cached [-s] NAME MAXAGE
#   -s creates the section header <<<$NAME>>>
#   -m mrpe-mode: stores exit code with the cache
#   -ma mrpe-mode with age: stores exit code with the cache and adds the cache age
#   NAME is the name of the section (also used as cache file name)
#   MAXAGE is the maximum cache livetime in seconds
function run_cached () {
    local NOW
    NOW=$(date +%s)
    local section=
    local mrpe=0
    local append_age=0
    # TODO: this function is unable to handle mulitple args at once
    #       for example: -s -m won't work, it is read as single token "-s -m"
    if [ "$1" = -s ] ; then local section="echo '<<<$2:cached($NOW,$3)>>>' ; " ; shift ; fi
    if [ "$1" = -m ] ; then local mrpe=1 ; shift ; fi
    if [ "$1" = "-ma" ] ; then local mrpe=1 ; local append_age=1 ; shift ; fi
    local NAME=$1
    local MAXAGE=$2
    shift 2
    local CMDLINE=$section$*

    if [ ! -d "$MK_VARDIR/cache" ]; then mkdir -p "$MK_VARDIR/cache" ; fi
    if [ "$mrpe" = 1 ] ; then
        CACHEFILE="$MK_VARDIR/cache/mrpe_$NAME.cache"
    else
        CACHEFILE="$MK_VARDIR/cache/$NAME.cache"
    fi

    # Check if the creation of the cache takes suspiciously long and kill the
    # process if the age (access time) of $CACHEFILE.new is twice the MAXAGE.
    # Output the evantually already cached section anyways and start the cache
    # update again.
    if [ -e "$CACHEFILE.new" ] ; then
        local CF_ATIME
        CF_ATIME=$(stat -c %X "$CACHEFILE.new")
        if [ $((NOW - CF_ATIME)) -ge $((MAXAGE * 2)) ] ; then
            # Kill the process still accessing that file in case
            # it is still running. This avoids overlapping processes!
            fuser -k -9 "$CACHEFILE.new" >/dev/null 2>&1
            rm -f "$CACHEFILE.new"
        fi
    fi


    # Check if cache file exists and is recent enough
    if [ -s "$CACHEFILE" ] ; then
        local MTIME
        MTIME=$(stat -c %Y "$CACHEFILE")
        local AGE
        AGE=$((NOW - MTIME))
        if [ "$AGE" -le "$MAXAGE" ] ; then local USE_CACHEFILE=1 ; fi
        # Output the file in any case, even if it is
        # outdated. The new file will not yet be available
        if [ $append_age -eq 1 ] ; then
            # insert the cached-string before the pipe (first -e)
            # or, if no pipe found (-e t) append it (third -e),
            # but only once and on the second line (2!b) (first line is section header,
            # all further lines are long output)
            sed -e "2s/|/ (Cached: ${AGE}\/${MAXAGE}s)|/" -e t -e "2s/$/ (Cached: ${AGE}\/${MAXAGE}s)/" < "$CACHEFILE"
        else
            cat "$CACHEFILE"
        fi
    fi

    # Cache file outdated and new job not yet running? Start it
    if [ -z "$USE_CACHEFILE" ] && [ ! -e "$CACHEFILE.new" ] ; then
        # When the command fails, the output is throws away ignored
        if [ $mrpe -eq 1 ] ; then
            echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; run_mrpe $NAME \"$CMDLINE\" && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup /bin/bash >/dev/null 2>&1 &
        else
            echo "set -o noclobber ; exec > \"$CACHEFILE.new\" || exit 1 ; $CMDLINE && mv \"$CACHEFILE.new\" \"$CACHEFILE\" || rm -f \"$CACHEFILE\" \"$CACHEFILE.new\"" | nohup /bin/bash >/dev/null 2>&1 &
        fi
    fi
}

# Make run_cached available for subshells (plugins, local checks, etc.)
export -f run_cached

# Implements Real-Time Check feature of the Check_MK agent which can send
# some section data in 1 second resolution. Useful for fast notifications and
# detailed graphing (if you configure your RRDs to this resolution).
function run_real_time_checks()
{
    PIDFILE=$MK_VARDIR/real_time_checks.pid
    echo $$ > "$PIDFILE"


    if [ "$PASSPHRASE" != "" ] ; then
        # new mechanism to set the passphrase has priority
        RTC_SECRET=$PASSPHRASE
    fi

    if [ "$ENCRYPTED_RT" != "no" ] ; then
        PROTOCOL=00
    else
        PROTOCOL=99
    fi


    while true; do
        # terminate when pidfile is gone or other Real-Time Check process started or configured timeout
        if [ ! -e "$PIDFILE" ] || [ "$(<"$PIDFILE")" -ne $$ ] || [ "$RTC_TIMEOUT" -eq 0 ]; then
            exit 1
        fi

        for SECTION in $RTC_SECTIONS; do
            # Be aware of maximum packet size. Maybe we need to check the size of the section
            # output and do some kind of nicer error handling.
            # 2 bytes: protocol version, 10 bytes: timestamp, rest: encrypted data
            # dd is used to concatenate the output of all commands to a single write/block => udp packet
            { echo -n $PROTOCOL ;
              date +%s | tr -d '\n' ;
              if [ "$ENCRYPTED_RT" != "no" ] ; then
                  export RTC_SECRET=$RTC_SECRET ; section_"$SECTION" | openssl enc -aes-256-cbc -md md5 -pass env:RTC_SECRET -nosalt ;
              else
                  section_"$SECTION" ;
              fi
            } | dd bs=9999 iflag=fullblock 2>/dev/null >"/dev/udp/${REMOTE}/${RTC_PORT}"
        done


        # Plugins
        if cd "$PLUGINSDIR" ; then
            for PLUGIN in $RTC_PLUGINS; do
                if [ ! -f $PLUGIN ] ; then
                    continue
                fi

                # Be aware of maximum packet size. Maybe we need to check the size of the section
                # output and do some kind of nicer error handling.
                # 2 bytes: protocol version, 10 bytes: timestamp, rest: encrypted data
                # dd is used to concatenate the output of all commands to a single write/block => udp packet
                { echo -n $PROTOCOL ;
                  date +%s | tr -d '\n' ;
                  if [ "$ENCRYPTED_RT" != "no" ] ; then
                      export RTC_SECRET=$RTC_SECRET ; ./$PLUGIN | openssl enc -aes-256-cbc -md md5 -pass env:RTC_SECRET -nosalt ;
                  else
                      ./"$PLUGIN";
                  fi
                } | dd bs=9999 iflag=fullblock 2>/dev/null >"/dev/udp/${REMOTE}/${RTC_PORT}"
            done
        fi

        sleep 1
        RTC_TIMEOUT=$((RTC_TIMEOUT-1))
    done
}

echo '<<<check_mk>>>'
echo Version: 1.5.0
echo "AgentOS: linux"
echo "Hostname: $HOSTNAME"
echo "AgentDirectory: $MK_CONFDIR"
echo "DataDirectory: $MK_VARDIR"
echo "SpoolDirectory: $SPOOLDIR"
echo "PluginsDirectory: $PLUGINSDIR"
echo "LocalDirectory: $LOCALDIR"

# If we are called via xinetd, try to find only_from configuration
if [ -n "$REMOTE_HOST" ]
then
    echo -n 'OnlyFrom: '
    sed -n '/^service[[:space:]]*check_mk/,/}/s/^[[:space:]]*only_from[[:space:]]*=[[:space:]]*\(.*\)/\1/p' /etc/xinetd.d/* | head -n1; echo
fi

section_df

# Filesystem usage for ZFS
if type zfs > /dev/null 2>&1 ; then
    echo '<<<zfsget>>>'
    zfs get -Hp name,quota,used,avail,mountpoint,type -t filesystem,volume || \
       zfs get -Hp name,quota,used,avail,mountpoint,type
    echo '[df]'
    df -PTlk -t zfs | sed 1d
fi

# Check NFS mounts by accessing them with stat -f (System
# call statfs()). If this lasts more then 2 seconds we
# consider it as hanging. We need waitmax.
if type waitmax >/dev/null
then
    STAT_VERSION=$(stat --version | head -1 | cut -d" " -f4)
    STAT_BROKE="5.3.0"

    echo '<<<nfsmounts>>>'
    sed -n '/ nfs4\? /s/[^ ]* \([^ ]*\) .*/\1/p' < /proc/mounts |
        sed 's/\\040/ /g' | egrep -v '(\.ckpt|kubelet)' | 
        while read MP
    do
        if [ "$STAT_VERSION" != "$STAT_BROKE" ]; then
            waitmax -s 9 5 stat -f -c "$MP ok %b %f %a %s" "$MP" || \
                echo "$MP hanging 0 0 0 0"
        else
            waitmax -s 9 5 stat -f -c "$MP ok %b %f %a %s" "$MP" && \
                printf '\n'|| echo "$MP hanging 0 0 0 0"
        fi
    done

    echo '<<<cifsmounts>>>'
    sed -n '/ cifs\? /s/[^ ]* \([^ ]*\) .*/\1/p' < /proc/mounts |
        sed 's/\\040/ /g' |
        while read MP
    do
        if [ ! -r "$MP" ]; then
            echo "$MP Permission denied"
        elif [ "$STAT_VERSION" != "$STAT_BROKE" ]; then
            waitmax -s 9 2 stat -f -c "$MP ok %b %f %a %s" "$MP" || \
                echo "$MP hanging 0 0 0 0"
        else
            waitmax -s 9 2 stat -f -c "$MP ok %b %f %a %s" "$MP" && \
                printf '\n'|| echo "$MP hanging 0 0 0 0"
        fi
    done
fi

# Check mount options. Filesystems may switch to 'ro' in case
# of a read error.
echo '<<<mounts>>>'
grep ^/dev < /proc/mounts

# processes including username, without kernel processes
echo '<<<ps>>>'
ps ax -o user:32,vsz,rss,cputime,etime,pid,command --columns 10000 | sed -e 1d -e 's/ *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) *\([^ ]*\) */(\1,\2,\3,\4\/\5,\6) /'

# Memory usage
section_mem

# Load and number of processes
section_cpu

# Uptime
section_uptime

# New variant: Information about speed and state in one section
if type ip > /dev/null
then
    echo '<<<lnx_if>>>'
    echo "[start_iplink]"
    ip link
    echo "[end_iplink]"
fi

echo '<<<lnx_if:sep(58)>>>'
sed 1,2d /proc/net/dev
if type ethtool > /dev/null
then
    sed -e 1,2d /proc/net/dev | cut -d':' -f1 | sort | while read eth; do
        echo "[$eth]"
        ethtool "$eth" | grep -E '(Speed|Duplex|Link detected|Auto-negotiation):'
        echo -e "\tAddress: $(cat "/sys/class/net/$eth/address")\n"
    done
fi


# Current state of bonding interfaces
if [ -e /proc/net/bonding ] ; then
    echo '<<<lnx_bonding:sep(58)>>>'
    pushd /proc/net/bonding > /dev/null
    head -v -n 1000 ./*
    popd > /dev/null
fi

# Same for Open vSwitch bonding
if type ovs-appctl > /dev/null ; then
    BONDS=$(ovs-appctl bond/list)
    COL=$(echo "$BONDS" | awk '{for(i=1;i<=NF;i++) {if($i == "bond") printf("%d", i)} exit 0}')
    echo '<<<ovs_bonding:sep(58)>>>'
    for bond in $(echo "$BONDS" | sed -e 1d | cut -f"${COL}") ; do
        echo "[$bond]"
        ovs-appctl bond/show "$bond"
    done
fi


# Number of TCP connections in the various states
echo '<<<tcp_conn_stats>>>'
if type ss > /dev/null ; then
    ss -ant |grep -v ^State | awk ' /:/ { c[$1]++; } END { for (x in c) { print x, c[x]; } }' |sed -e 's/^ESTAB/01/g;s/^SYN-SENT/02/g;s/^SYN-RECV/03/g;s/^FIN-WAIT-1/04/g;s/^FIN-WAIT-2/05/g;s/^TIME-WAIT/06/g;s/^CLOSED/07/g;s/^CLOSE-WAIT/08/g;s/^LAST-ACK/09/g;s/^LISTEN/0A/g;s/^CLOSING/0B/g;'
elif type waitmax >/dev/null ; then
    THIS=$(waitmax -s 1 10 cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk ' /:/ { c[$4]++; } END { for (x in c) { print x, c[x]; } }')
    if [ $? == 0 ] ; then
        echo "$THIS"
    fi
fi

# Linux Multipathing
if type multipath >/dev/null ; then
    if [ -f /etc/multipath.conf ] ; then
        echo '<<<multipath>>>'
        multipath -l
    fi
fi

# Performancecounter Platten
if [ -z "$MK_IN_CONTAINER" ]; then
    echo '<<<diskstat>>>'
    date +%s
    grep -E ' (x?[shv]d[a-z]*[0-9]*|cciss/c[0-9]+d[0-9]+|emcpower[a-z]+|dm-[0-9]+|VxVM.*|mmcblk.*|dasd[a-z]*|bcache[0-9]+|nvme[0-9]+n[0-9]+) ' < /proc/diskstats
    if type dmsetup >/dev/null ; then
        echo '[dmsetup_info]'
        dmsetup info -c --noheadings --separator ' ' -o name,devno,vg_name,lv_name
    fi
    if [ -d /dev/vx/dsk ] ; then
        echo '[vx_dsk]'
        stat -c "%t %T %n" /dev/vx/dsk/*/*
    fi
else
    echo '<<<docker_container_diskstat>>>'
    echo "[time]"
    date +%s
    for F in io_service_bytes io_serviced; do
        echo "[$F]"
        cat "/sys/fs/cgroup/blkio/blkio.throttle.$F"
    done
    echo "[names]"
    for F in /sys/block/*; do
        echo -n "${F##*/} " ;
        cat "$F/dev";
    done
fi


# Performancecounter Kernel
if [ -z "$MK_IN_CONTAINER" ]; then
    echo '<<<kernel>>>'
    date +%s
    cat /proc/vmstat /proc/stat
fi

# Hardware sensors via IPMI (need ipmitool)
if type ipmitool > /dev/null
then
    run_cached -s "ipmi:sep(124)" 300 "waitmax 300 ipmitool sensor list | grep -v 'command failed' | egrep -v '^[^ ]+ na ' | grep -v ' discrete '"
    # readable discrete sensor states
    run_cached -s "ipmi_discrete:sep(124)" 300 "waitmax 300 ipmitool sdr elist compact"
fi


# IPMI data via ipmi-sensors (of freeipmi). Please make sure, that if you
# have installed freeipmi that IPMI is really support by your hardware.
if type ipmi-sensors >/dev/null
then
    echo '<<<ipmi_sensors>>>'
    # Newer ipmi-sensors version have new output format; Legacy format can be used
    if ipmi-sensors --help | grep -q legacy-output; then
        IPMI_FORMAT="--legacy-output"
    else
        IPMI_FORMAT=""
    fi
    if ipmi-sensors --help | grep -q " \-\-groups"; then
        IPMI_GROUP_OPT="-g"
    else
        IPMI_GROUP_OPT="-t"
    fi

    # At least with ipmi-sensors 0.7.16 this group is Power_Unit instead of "Power Unit"
    run_cached -s ipmi_sensors 300 "for class in Temperature Power_Unit Fan
    do
        ipmi-sensors $IPMI_FORMAT --sdr-cache-directory /var/cache $IPMI_GROUP_OPT \"\$class\" | sed -e 's/ /_/g' -e 's/:_\?/ /g' -e 's@ \([^(]*\)_(\([^)]*\))@ \2_\1@'
        # In case of a timeout immediately leave loop.
        if [ $? = 255 ] ; then break ; fi
    done"
fi

# RAID status of Linux software RAID
echo '<<<md>>>'
cat /proc/mdstat

# RAID status of Linux RAID via device mapper
if type dmraid >/dev/null && DMSTATUS=$(waitmax 3 dmraid -r)
then
    echo '<<<dmraid>>>'

    # Output name and status
    waitmax 20 dmraid -s | grep -e ^name -e ^status

    # Output disk names of the RAID disks
    DISKS=$(echo "$DMSTATUS" | cut -f1 -d":")

    for disk in $DISKS ; do
        device=$(cat /sys/block/"$(basename "$disk")"/device/model )
        status=$(echo "$DMSTATUS" | grep "^${disk}")
        echo "${status} Model: ${device}"
    done
fi

# RAID status of LSI controllers via cfggen
if type cfggen > /dev/null ; then
   echo '<<<lsi>>>'
   cfggen 0 DISPLAY | egrep '(Target ID|State|Volume ID|Status of volume)[[:space:]]*:' | sed -e 's/ *//g' -e 's/:/ /'
fi

# RAID status of LSI MegaRAID controller via MegaCli. You can download that tool from:
# http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.16_MegaCLI.zip
if type MegaCli >/dev/null ; then
    MegaCli_bin="MegaCli"
elif type MegaCli64 >/dev/null ; then
    MegaCli_bin="MegaCli64"
elif type megacli >/dev/null ; then
    MegaCli_bin="megacli"
elif type storcli >/dev/null ; then
    MegaCli_bin="storcli"
elif type storcli64 >/dev/null ; then
    MegaCli_bin="storcli64"
else
    MegaCli_bin="unknown"
fi

if [ "$MegaCli_bin" != "unknown" ]; then
    echo '<<<megaraid_pdisks>>>'
    for part in $($MegaCli_bin -EncInfo -aALL -NoLog < /dev/null \
        | sed -rn 's/:/ /g; s/[[:space:]]+/ /g; s/^ //; s/ $//; s/Number of enclosures on adapter ([0-9]+).*/adapter \1/g; /^(Enclosure|Device ID|adapter) [0-9]+$/ p'); do
        [ "$part" = adapter ] && echo ""
        [ "$part" = 'Enclosure' ] && echo -ne "\ndev2enc"
        echo -n " $part"
    done
    echo
    $MegaCli_bin -PDList -aALL -NoLog < /dev/null | egrep 'Enclosure|Raw Size|Slot Number|Device Id|Firmware state|Inquiry|Adapter'
    echo '<<<megaraid_ldisks>>>'
    $MegaCli_bin -LDInfo -Lall -aALL -NoLog < /dev/null | egrep 'Size|State|Number|Adapter|Virtual'
    echo '<<<megaraid_bbu>>>'
    $MegaCli_bin -AdpBbuCmd -GetBbuStatus -aALL -NoLog < /dev/null | grep -v Exit
fi

# RAID status of 3WARE disk controller (by Radoslaw Bak)
if type tw_cli > /dev/null ; then
    for C in $(tw_cli show | awk 'NR < 4 { next } { print $1 }'); do
        echo '<<<3ware_info>>>'
        tw_cli "/$C" show all | egrep 'Model =|Firmware|Serial'
        echo '<<<3ware_disks>>>'
        tw_cli "/$C" show drivestatus | egrep 'p[0-9]' | sed "s/^/$C\//"
        echo '<<<3ware_units>>>'
        tw_cli "/$C" show unitstatus | egrep 'u[0-9]' | sed "s/^/$C\//"
    done
fi

# RAID controllers from areca (Taiwan)
# cli64 can be found at ftp://ftp.areca.com.tw/RaidCards/AP_Drivers/Linux/CLI/
if type cli64 >/dev/null ; then
    run_cached -s arc_raid_status 300 "cli64 rsf info | tail -n +3 | head -n -2"
fi

# VirtualBox Guests. Section must always been output. Otherwise the
# check would not be executed in case no guest additions are installed.
# And that is something the check wants to detect
echo '<<<vbox_guest>>>'
if type VBoxControl >/dev/null 2>&1 && lsmod | grep vboxguest >/dev/null 2>&1; then
    VBoxControl -nologo guestproperty enumerate | cut -d, -f1,2
    [ "${PIPESTATUS[0]}" = 0 ] || echo "ERROR"
fi

# OpenVPN Clients. Currently we assume that the configuration # is in
# /etc/openvpn. We might find a safer way to find the configuration later.
if [ -e /etc/openvpn/openvpn-status.log ] ; then
    echo '<<<openvpn_clients:sep(44)>>>'
    sed -n -e '/CLIENT LIST/,/ROUTING TABLE/p' < /etc/openvpn/openvpn-status.log  | sed -e 1,3d -e '$d'
fi

# Time synchronization with NTP
if type ntpq > /dev/null 2>&1 ; then
   # remove heading, make first column space separated
   run_cached -s ntp 30 "waitmax 5 ntpq -np | sed -e 1,2d -e 's/^\(.\)/\1 /' -e 's/^ /%/' || true"
fi

# Time synchronization with Chrony
if type chronyc > /dev/null 2>&1 ; then
    # Force successful exit code. Otherwise section will be missing if daemon not running
    #
    # The "| cat" has been added for some kind of regression in RedHat 7.5. The
    # SELinux rules shipped with that release were denying the chronyc call
    # without cat.
    run_cached -s chrony 30 "waitmax 5 chronyc -n tracking | cat || true"
fi

if type nvidia-settings >/dev/null && [ -S /tmp/.X11-unix/X0 ]
then
    echo '<<<nvidia>>>'
    for var in GPUErrors GPUCoreTemp
    do
        DISPLAY=:0 waitmax 2 nvidia-settings -t -q $var | sed "s/^/$var: /"
    done
fi

if [ -z "$MK_IN_CONTAINER" ] && [ -e /proc/drbd ]; then
  echo '<<<drbd>>>'
  cat /proc/drbd
fi

# Heartbeat monitoring
# Different handling for heartbeat clusters with and without CRM
# for the resource state
if [ -S /var/run/heartbeat/crm/cib_ro -o -S /var/run/crm/cib_ro ] || pgrep crmd > /dev/null 2>&1; then
  echo '<<<heartbeat_crm>>>'
  TZ=UTC crm_mon -1 -r | grep -v ^$ | sed 's/^ //; /^\sResource Group:/,$ s/^\s//; s/^\s/_/g'
fi
if type cl_status > /dev/null 2>&1; then
  echo '<<<heartbeat_rscstatus>>>'
  cl_status rscstatus

  echo '<<<heartbeat_nodes>>>'
  for NODE in $(cl_status listnodes); do
    if [ "$NODE" != "$(echo "$HOSTNAME" | tr '[:upper:]' '[:lower:]')" ]; then
      STATUS=$(cl_status nodestatus "$NODE")
      echo -n "$NODE $STATUS"
      for LINK in $(cl_status listhblinks "$NODE" 2>/dev/null); do
        echo -n " $LINK $(cl_status hblinkstatus "$NODE" "$LINK")"
      done
      echo
    fi
  done
fi

# Postfix mailqueue monitoring
# Determine the number of mails and their size in several postfix mail queues
function read_postfix_queue_dirs {
    postfix_queue_dir=$1
    if [ -n "$postfix_queue_dir" ]; then
        echo '<<<postfix_mailq>>>'
        if [ ! -z "$2" ]; then
            echo "[[[${2}]]]"
        fi
        for queue in deferred active
        do
            count=$(find "${postfix_queue_dir}/$queue" -type f | wc -l)
            size=$(du -s "${postfix_queue_dir}/$queue" | awk '{print $1 }')
            if [ -z "$size" ]; then
                size=0
            fi
            if [ -z "$count" ]; then
                echo "Mail queue is empty"
            else
                echo "QUEUE_${queue} $size $count"
            fi
        done
    fi
}

# Postfix mailqueue monitoring
# Determine the number of mails and their size in several postfix mail queues
if type postconf >/dev/null ; then
    # Check if multi_instance_directories exists in main.cf and is not empty
    # always takes the last entry, multiple entries possible
    multi_instances_dirs=$(postconf -c /etc/postfix 2>/dev/null | grep ^multi_instance_directories | sed 's/.*=[[:space:]]*//g')
    if [ ! -z "$multi_instances_dirs" ]; then
        for queue_dir in $multi_instances_dirs
        do
            if [ -n "$queue_dir" ]; then
                postfix_queue_dir=$(postconf -c "$queue_dir" 2>/dev/null | grep ^queue_directory | sed 's/.*=[[:space:]]*//g')
                read_postfix_queue_dirs "$postfix_queue_dir" "$queue_dir"
            fi
        done

    else
        postfix_queue_dir=$(postconf -h queue_directory 2>/dev/null)
        read_postfix_queue_dirs "$postfix_queue_dir"
    fi

elif [ -x /usr/sbin/ssmtp ] ; then
    echo '<<<postfix_mailq>>>'
    mailq 2>&1 | sed 's/^[^:]*: \(.*\)/\1/' | tail -n 6

fi

# Postfix status monitoring. Can handle multiple instances.
if type postfix >/dev/null ; then
    echo "<<<postfix_mailq_status:sep(58)>>>"
    for i in /var/spool/postfix*/; do
        if [ -e "$i/pid/master.pid" ]; then
            if [ -r "$i/pid/master.pid" ]; then
                postfix_pid=$(sed 's/ //g' < "$i/pid/master.pid") # handle possible spaces in output
                if readlink -- "/proc/${postfix_pid}/exe" | grep -q ".*postfix/\(s\?bin/\)\?master.*"; then
                    echo "$i:the Postfix mail system is running:PID:$postfix_pid" | sed 's/\/var\/spool\///g'
                else
                    echo "$i:PID file exists but instance is not running!" | sed 's/\/var\/spool\///g'
                fi
            else
                echo "$i:PID file exists but is not readable"
            fi
        else
            echo "$i:the Postfix mail system is not running" | sed 's/\/var\/spool\///g'
        fi
    done
fi

# Check status of qmail mailqueue
if type qmail-qstat >/dev/null
then
   echo "<<<qmail_stats>>>"
   qmail-qstat
fi

# Nullmailer queue monitoring
if type nullmailer-send >/dev/null && [ -d /var/spool/nullmailer/queue ]
then
    echo '<<<nullmailer_mailq>>>'
    COUNT=$(find /var/spool/nullmailer/queue -type f | wc -l)
    SIZE=$(du -s /var/spool/nullmailer/queue | awk '{print $1 }')
    echo "$SIZE $COUNT"
fi

# Check status of OMD sites and Check_MK Notification spooler
if type omd >/dev/null
then
    run_cached -s omd_status 60 "omd status --bare --auto || true"
    echo '<<<mknotifyd:sep(0)>>>'
    for statefile in /omd/sites/*/var/log/mknotifyd.state ; do
	if [ -e "$statefile" ] ; then
	    site=${statefile%/var/log*}
	    site=${site#/omd/sites/}
	    echo "[$site]"
	    grep -v '^#' < "$statefile"
        fi
    done

    echo '<<<omd_apache:sep(124)>>>'
    for statsfile in /omd/sites/*/var/log/apache/stats; do
	if [ -e "$statsfile" ] ; then
	    site=${statsfile%/var/log*}
	    site=${site#/omd/sites/}
	    echo "[$site]"
            cat "$statsfile"
            > "$statsfile"
            # prevent next section to fail caused by a missing newline at the end of the statsfile
            echo
        fi
    done
fi


# Welcome the ZFS check on Linux
# We do not endorse running ZFS on linux if your vendor doesnt support it ;)
# check zpool status
if type zpool >/dev/null; then
   echo "<<<zpool_status>>>"
   zpool status -x
fi


# Veritas Cluster Server
# Software is always installed in /opt/VRTSvcs.
# Secure mode must be off to allow root to execute commands
if [ -x /opt/VRTSvcs/bin/haclus ]
then
    echo "<<<veritas_vcs>>>"
    vcshost=$(hostname | cut -d. -f1)
    waitmax -s 9 2 /opt/VRTSvcs/bin/haclus -display -localclus | grep -e ClusterName -e ClusState
    waitmax -s 9 2 /opt/VRTSvcs/bin/hasys -display -attribute SysState
    waitmax -s 9 2 /opt/VRTSvcs/bin/hagrp -display -sys "$vcshost" -attribute State -localclus
    waitmax -s 9 2 /opt/VRTSvcs/bin/hares -display -sys "$vcshost" -attribute State -localclus
    waitmax -s 9 2 /opt/VRTSvcs/bin/hagrp -display -attribute TFrozen -attribute Frozen
fi


# Fileinfo-Check: put patterns for files into /etc/check_mk/fileinfo.cfg
function replace_datevariable()
{
    # Replace the date variable of the input, e.g. $DATE:%Y%m%d$, by
    # the current date. If there's no match just return the input.
    local file_name="$1"
    # shellcheck disable=SC2016
    local pattern='(\$DATE:(.*)\$)'

    if [[ ! $file_name =~ $pattern ]]; then
        echo "$file_name"
    else
        date_variable="${BASH_REMATCH[1]}"
        format_string="${BASH_REMATCH[2]}"
        echo "${file_name/$date_variable/$(date +"$format_string")}"
    fi
}

if [ -r "$MK_CONFDIR/fileinfo.cfg" ] ; then
    echo '<<<fileinfo:sep(124)>>>'
    date +%s

    OLD_IFS=$IFS
    IFS='
'
    while read -r pattern; do
        case $pattern in
            /*) pattern=$(replace_datevariable "$pattern")
                for file in $pattern; do
                    stat -c "%n|%s|%Y" "$file" 2> /dev/null || echo "$file|missing|$(date +%s)"
                done ;;
        esac
    done < "$MK_CONFDIR/fileinfo.cfg"
    IFS=$OLD_IFS
fi

# Get stats about OMD monitoring cores running on this machine.
# Since cd is a shell builtin the check does not affect the performance
# on non-OMD machines.
if cd /omd/sites
then
    echo '<<<livestatus_status:sep(59)>>>'
    for site in *
    do
        if [ -S "/omd/sites/$site/tmp/run/live" ] ; then
            echo "[$site]"
            echo -e "GET status" | \
                waitmax 3 "/omd/sites/$site/bin/unixcat" "/omd/sites/$site/tmp/run/live"
        fi
    done
    echo '<<<mkeventd_status:sep(0)>>>'
    for site in *
    do
        if [ -S "/omd/sites/$site/tmp/run/mkeventd/status" ] ; then
            echo "[\"$site\"]"
            echo -e "GET status\nOutputFormat: json" \
                | waitmax 3 "/omd/sites/$site/bin/unixcat" "/omd/sites/$site/tmp/run/mkeventd/status"
        fi
    done
fi

# Collect states of configured Check_MK site backup jobs
if ls /omd/sites/*/var/check_mk/backup/*.state >/dev/null 2>&1; then
    echo "<<<mkbackup>>>"
    for F in /omd/sites/*/var/check_mk/backup/*.state; do
        SITE=${F#/*/*/*}
        SITE=${SITE%%/*}

        JOB_IDENT=${F%.state}
        JOB_IDENT=${JOB_IDENT##*/}

        if [ "$JOB_IDENT" != "restore" ]; then
            echo "[[[site:$SITE:$JOB_IDENT]]]"
            cat "$F"
            echo
        fi
    done
fi

# Collect states of configured CMA backup jobs
if type mkbackup >/dev/null && ls /var/lib/mkbackup/*.state >/dev/null 2>&1; then
    echo "<<<mkbackup>>>"
    for F in /var/lib/mkbackup/*.state; do
        JOB_IDENT=${F%.state}
        JOB_IDENT=${JOB_IDENT##*/}

        if [ "$JOB_IDENT" != "restore" ]; then
            echo "[[[system:$JOB_IDENT]]]"
            cat "$F"
            echo
        fi
    done
fi

# Get statistics about monitored jobs. Below the job directory there
# is a sub directory per user that ran a job. That directory must be
# owned by the user so that a symlink or hardlink attack for reading
# arbitrary files can be avoided.
if pushd "$MK_VARDIR/job" >/dev/null; then
    echo '<<<job>>>'
    for username in *
    do
        if [ -d "$username" ] && cd "$username" ; then
            if [ $EUID -eq 0 ]; then
                su "$username" -c "head -n -0 -v *"
            else
                head -n -0 -v ./*
            fi
            cd ..
        fi
    done
    popd > /dev/null
fi

# Gather thermal information provided e.g. by acpi
# At the moment only supporting thermal sensors
if [ -z "$MK_IN_CONTAINER" ] && ls /sys/class/thermal/thermal_zone* >/dev/null 2>&1; then
    echo '<<<lnx_thermal>>>'
    for F in /sys/class/thermal/thermal_zone*; do
        echo -n "${F##*/} "
        if [ ! -e "$F/mode" ] ; then echo -n "- " ; fi
        cat "$F"/{mode,type,temp,trip_point_*} | tr \\n " "
        echo
    done
fi

# Libelle Business Shadow
if type trd >/dev/null; then
   echo "<<<libelle_business_shadow:sep(58)>>>"
   trd -s
fi

# HTTP Accelerator Statistics
if type varnishstat >/dev/null; then
   echo "<<<varnish>>>"
   varnishstat -1
fi

# Proxmox Cluster
if type pvecm > /dev/null 2>&1 ; then
    echo "<<<pvecm_status:sep(58)>>>"
    pvecm status
    echo "<<<pvecm_nodes>>>"
    pvecm nodes
fi

# Iterate all running containers and report piggyback data for them
if type docker > /dev/null 2>&1 && [ -z "$MK_IS_PIGGYBACKED" ]; then
    NODE_NAME=$(docker info --format "{{json .Name}}")

    echo "<<<docker_node_info>>>"
    docker info --format "{{json .}}" 2>&1

    echo "<<<docker_node_disk_usage:sep(44)>>>"
    docker system df --format "{{json .}}"

    echo "<<<docker_node_images>>>"
    echo "[[[images]]]"
    docker images --format "{{json .}}"

    echo "[[[image_labels]]]"
    IMAGE_IDS=$(docker images --format '{{.ID}}')
    docker image inspect --format "[ {{json .Id}}, {{json .Config.Labels}} ]" "$IMAGE_IDS"

    echo "[[[containers]]]"
    docker container ls --all --format "{{json .}}"

    echo "<<<docker_node_network:sep(0)>>>"
    NETWORK_IDS=$(docker network ls -f 'driver=bridge' --format='{{.ID}}')
    docker network inspect "$NETWORK_IDS"

    # For the container status, we want information about *all* containers
    for CONTAINER_ID in $(docker container ls -q --all); do
        echo "<<<<${CONTAINER_ID}>>>>"
        docker inspect "$CONTAINER_ID" \
            --format='{{println "<<<docker_container_status>>>"}}{{json .State}}{{println}}{{println "<<<docker_container_node_name>>>"}}{{println '"$NODE_NAME"'}}{{println "<<<docker_container_labels>>>"}}{{json .Config.Labels}}{{println}}{{println "<<<docker_container_network>>>"}}{{json .NetworkSettings}}{{println}}'
        echo "<<<<>>>>"
    done

    for CONTAINER_ID in $(docker container ls -q); do
        echo "<<<<$CONTAINER_ID>>>>"

        # Is there a regular agent available in the container? Use it!
        #
        # Otherwise execute the agent of the node in the context of the container.
        # Using this approach we should always get at least basic information from
        # the container.
        # Once it comes to plugins and custom configuration the user needs to use
        # a little more complex setup. Have a look at the documentation.
        AGENT_PATH=$(docker container exec "$CONTAINER_ID" bash -c "type check_mk_agent" 2>/dev/null)
        if [ -n "$AGENT_PATH" ]; then
            docker container exec --env MK_IS_PIGGYBACKED=1 --env "REMOTE=$REMOTE" "$CONTAINER_ID" check_mk_agent
        elif docker container exec "$CONTAINER_ID" which bash >/dev/null 2>&1; then
            docker container exec --env MK_IS_PIGGYBACKED=1 --env MK_FROM_NODE=1 --env "REMOTE=$REMOTE" -i "$CONTAINER_ID" bash < "$0"
        fi

        echo "<<<<>>>>"
    done
fi

# Start new liveupdate process in background on each agent execution. Starting
# a new live update process will terminate the old one automatically after
# max. 1 sec.
if [ -e "$MK_CONFDIR/real_time_checks.cfg" ]; then
    if [ -z "$REMOTE" ]; then
        echo "ERROR: \$REMOTE not specified. Not starting Real-Time Checks." >&2
    elif ! type openssl >/dev/null; then
        echo "ERROR: openssl command is missing. Not starting Real-Time Checks." >&2
    else
        run_real_time_checks >/dev/null &
    fi
fi

# MK's Remote Plugin Executor
if [ -e "$MK_CONFDIR/mrpe.cfg" ]
then
    grep -Ev '^[[:space:]]*($|#)' "$MK_CONFDIR/mrpe.cfg" | \
    while read descr cmdline
    do
        interval=
        args="-m"
        # NOTE: Due to an escaping-related bug in some old bash versions
        # (3.2.x), we have to use an intermediate variable for the pattern.
        pattern='\(([^\)]*)\)[[:space:]](.*)'
        if [[ $cmdline =~ $pattern ]]
        then
            parameters=${BASH_REMATCH[1]}
            cmdline=${BASH_REMATCH[2]}

            # split multiple parameter assignments
            for par in $(echo "$parameters" | tr ":" "\n")
            do
                # split each assignment
                key=$(echo "$par" | cut -d= -f1)
                value=$(echo "$par" | cut -d= -f2)

                if [ "$key" = "interval" ] ; then
                    interval=$value
                elif [ "$key" = "appendage" ] ; then
                    args="-ma"
                fi
            done
        fi

        if [ -z "$interval" ]
        then
            run_mrpe "$descr" "$cmdline"
        else
            run_cached "$args" "$descr" "$interval" "$cmdline"
        fi
    done
fi

# MK's runas Executor
if [ -e "$MK_CONFDIR/runas.cfg" ]
then
    grep -Ev '^[[:space:]]*($|#)' "$MK_CONFDIR/runas.cfg" | \
    while read type user include
    do
        if [ -d "$include" -o \( "$type" == "mrpe" -a -f "$include" \) ] ; then
            PREFIX=""
            if [ "$user" != "-" ] ; then
                PREFIX="su $user -c "
            fi

            # mrpe includes
            if [ "$type" == "mrpe" ] ; then
                grep -Ev '^[[:space:]]*($|#)' "$include" | \
                while read descr cmdline
                do
                    interval=
                    # NOTE: Due to an escaping-related bug in some old bash
                    # versions (3.2.x), we have to use an intermediate variable
                    # for the pattern.
                    pattern='\(([^\)]*)\)[[:space:]](.*)'
                    if [[ $cmdline =~ $pattern ]]
                    then
                        parameters=${BASH_REMATCH[1]}
                        cmdline=${BASH_REMATCH[2]}

                        # split multiple parameter assignments
                        for par in $(echo "$parameters" | tr ":" "\n")
                        do
                            # split each assignment
                            IFS='=' read key value <<< $par
                            if [ "$key" = "interval" ]
                            then
                                interval=$value
                            # no other parameters supported currently
                            fi
                        done
                    fi

                    if [ -n "$PREFIX" ] ; then
                        cmdline="$PREFIX\'$cmdline\'"
                    fi
                    if [ -z "$interval" ]
                    then
                        run_mrpe "$descr" "$cmdline"
                    else
                        run_cached -m "$descr" "$interval" "$cmdline"
                    fi
                done

            # local and plugin includes
            elif [ "$type" == "local" -o "$type" == "plugin" ] ; then
                if [ "$type" == "local" ] ; then
                    echo "<<<local>>>"
                fi

                find "$include" -executable -type f | \
                while read filename
                do
                    if [ -n "$PREFIX" ] ; then
                        cmdline="$PREFIX\"$filename\""
                    else
                        cmdline=$filename
                    fi

                    $cmdline
                done
            fi
        fi
    done
fi

function is_valid_plugin () {
    # NOTE: Due to an escaping-related bug in some old bash versions
    # (3.2.x), we have to use an intermediate variable for the pattern.
    pattern='\.dpkg-(new|old|temp)$'
    #TODO Maybe we should change this mechanism
    # shellcheck disable=SC2015
    [[ -f "$1" && -x "$1" && ! "$1" =~ $pattern ]] && true || false
}

# Local checks
echo '<<<local>>>'
if cd "$LOCALDIR" ; then
    for skript in ./*; do
        if is_valid_plugin "$skript"; then
            ./"$skript"
        fi
    done
    # Call some plugins only every X'th second
    for skript in [1-9]*/* ; do
        if is_valid_plugin "$skript"; then
            run_cached "local_${skript//\//\\}" "${skript%/*}" "$skript"
        fi
    done
fi

# Plugins
if cd "$PLUGINSDIR"; then
    for skript in ./*; do
        if is_valid_plugin "$skript"; then
            ./"$skript"
        fi
    done
    # Call some plugins only every Xth second
    for skript in [1-9]*/* ; do
        if is_valid_plugin "$skript"; then
            run_cached "plugins_${skript//\//\\}" "${skript%/*}" "$skript"
        fi
    done
fi

# Agent output snippets created by cronjobs, etc.
if [ -d "$SPOOLDIR" ]
then
    pushd "$SPOOLDIR" > /dev/null
    now=$(date +%s)

    for file in *
    do
        test "$file" = "*" && break
        # output every file in this directory. If the file is prefixed
        # with a number, then that number is the maximum age of the
        # file in seconds. If the file is older than that, it is ignored.
        maxage=""
        part="$file"

        # Each away all digits from the front of the filename and
        # collect them in the variable maxage.
        while [ "${part/#[0-9]/}" != "$part" ]
        do
            maxage=$maxage${part:0:1}
            part=${part:1}
        done

        # If there is at least one digit, than we honor that.
        if [ "$maxage" ] ; then
            mtime=$(stat -c %Y "$file")
            if [ $((now - mtime)) -gt "$maxage" ] ; then
                continue
            fi
        fi

        # Output the file
        cat "$file"
    done
    popd > /dev/null
fi

ZeroDay Forums Mini