From 5b3ad999a4ee37b4cf3bfc3f1115cf7c16ea9635 Mon Sep 17 00:00:00 2001 From: Paolo Asperti Date: Tue, 14 Sep 2021 15:54:13 +0200 Subject: [PATCH] initial import --- .drone.yml | 22 ++++++ Dockerfile | 12 ++++ LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++ config.json | 32 +++++++++ icon.png | Bin 0 -> 632 bytes logo.png | Bin 0 -> 3766 bytes run.sh | 22 ++++++ 7 files changed, 289 insertions(+) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 config.json create mode 100644 icon.png create mode 100644 logo.png create mode 100644 run.sh diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..4fe7358 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,22 @@ +kind: pipeline +type: docker +name: default + +steps: + - name: build_and_publish + image: plugins/docker:linux-amd64 + settings: + password: + from_secret: docker_password + registry: docker.asperti.com + repo: docker.asperti.com/paspo/hassio-zabbix-agent2 + tags: + - latest + - 0.1.2 + username: + from_secret: docker_username + +trigger: + event: + - tag + - push diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..859c079 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +ARG BUILD_FROM=hassioaddons/base:8.0.6 +FROM $BUILD_FROM + +ENV LANG C.UTF-8 + +# Copy scripts for add-on +COPY run.sh / + +RUN apk add -U jq zabbix-agent2=5.0.14-r1 sudo && \ + chmod a+x /run.sh + +CMD [ "/run.sh" ] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8dada3e --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/config.json b/config.json new file mode 100644 index 0000000..0bf1ba7 --- /dev/null +++ b/config.json @@ -0,0 +1,32 @@ +{ + "name": "Zabbix Agent 2", + "url": "https://git.asperti.com/paspo/hassio-addons", + "image": "docker.asperti.com/paspo/hassio-zabbix-agent2", + "version": "0.1.2", + "slug": "zabbix-agent2", + "description": "Zabbix Agent 2 for hass.io", + "startup": "services", + "boot": "auto", + "audio": false, + "gpio": false, + "arch": [ + "aarch64", + "amd64", + "armhf", + "i386" + ], + "ports": { + "10050/tcp": 10050 + }, + "map": [ + "share" + ], + "options": { + "server": "zabbix-server", + "hostname": "hassio" + }, + "schema": { + "server": "str", + "hostname": "str" + } +} diff --git a/icon.png b/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..0d145010b49a0a5dfb987813c65c280c3edc5a80 GIT binary patch literal 632 zcmeAS@N?(olHy`uVBq!ia0vp^TR@nD8Ax&oe*=;XEa{HEjtmUzPnffIy#(?Vl0AZa z85pY67#JE_7#My5g&JNkFq9fFFuY1&V6d9Oz#v{QXIG#NP{KICC&cv%1H+sC{xAFY z|NsC0`}y;K-oL+NVDP-4;9)?(eFum4^XFd|5csry{i}wCCkY9^?%%(upzxk+_Y+@Rc(43uJXU@M1*;pFZUhuY0w0fnpMa8r2za07N z3Tr~1`IoPnVbc;^zUsy=(V3s)WuFx7v6$EPR+oQaa`k?o8D_V3x8=MC8q@P_UE)uU zw>R#+>VH%Ip}YCpx{WeR_r~8{nKTWk`r);?T57j{U!1E|wtTPmiEroXx#xC+b>!Z- zr~Nke@W#DQf1KL5S2BL-<@OEMSM5Wp`|bA4%6KodX|KC{yyQ0X$E%h4-k$yB$$R=+ zS&Uua+p|Bk=0E+^dCKP3kFIa)4!+9Zo#x+VvCaInx~b0X+l4<}Vr6>Pf3nn@zriZ% zvBlfHrOUf4p|Z1|PL}F>`*ugop;sA#$Day^xo68P16c!6AOqIE?R%=+@5jYOZF`!p vTo9dqQxP7PE&oD4Rz8fiGvt8;xXe-h7x4}c{ufMq4ifNm^>bP0l+XkK@Mt3E literal 0 HcmV?d00001 diff --git a/logo.png b/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..2f2bc497012e103846a86c0fa2a89b3e5d883e4a GIT binary patch literal 3766 zcmV;n4oUHeP)004R> z004l5008;`004mK004C`008P>0026e000+ooVrmw0008_P)t-s)BphCP*CcCfZ|kC z+bk^OSXkB!4C#M==yrDIX=&tKT;Weo+%YlL1_tSSd*^O$PSgSd*cBDm4-fC4p#T5>@TjQoqN4op@YV?l*ccf8`ug|M($xh8^SHSB;^OkM zvgdDa*cKM#U|{EPaN8#*{`dFiadGjgs_vbg{r2|cU0wX_?Cq76*&iSN`}^~?wctod z=yi44B_-ljRr=%O=4fd2zrX$U_0gwP}NA}Ch|Nj2k zBO~|G(byLk+bJpj`1tXwtL~hf+%7KagoOCl*Vq~w<5yScczD(h4(yPS`sC#O^z``H z*!th!{`vX%)6@Cd+W!3f-a9+=z`*?L>+`v};7Lj0Oib#6g6VyI*ANia3k%;uLgi#+ z_|(+qYisVCo8e1K|NZ^f5fS57R`tQb@vN-nXJ`4@+1eo?-aI_=udnBFa_M}0{qytL zARztm@$Q+K<5^kP6cp762=~p+>3VwA1O)fa&h)*#;6_H-9vEXIIo&ok>x+x`(9rX`y5wG7-$X?2n3(XSq~&F0?wXq2H#hs}=-C|| z=y`e83JTvtL+XQr`r+aG=H}TP9Pgo_^S8I)MMd_>$>n2X=4@>5qodt4H0_d-_s`Go zpP%DeTI+^}*&7?y4GrgWbKEjA-#|d>g@y2@rufy>^0c)1-QC(ICj9U3>VbjaN=oaB ziu~^G^~1yKhllHliQP3d+bb*OVq)x$j{4x>^t-$8rKRIrTi!iA-abC;k&*Sr#{1>v z+$}BIBqZ;ip6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`I*u)jV4OnBu(mxORE)5u;1c)}TzI7>?_}hrVo9iN z@G^3U;i@t@tgFZAg_Z&AWUk@Q?y49mQSf+zl>ZLEDAN_AR(8CZOwUA za(l3@-bANc`-I<9qVNw~!}vwS$+1fW4OUPy5Y)L+~CLke)Z7#j% zN zhi{Z`f?MgY!BrsqWU|?=U&Zrk?2g5O;y;Bd7!M@bzM~Y9tF#^-$C7}M+$QY78cV5k zJ~^wdG9Ij~brANHj6vl+c;5apX~4!oNRC*BOB#oj$W?Z@YJvL~?GlhX{iPL@lBP%w z>*~F%LgQ+&e-jbgH9T)Ob#PWMAVw_9g4v(1WaQ#dT$+0BFCRcQJ;jm+Y zAm?T#E;(#!K4AB#aCSGRLU?hL4J|V#Ba)%V=vz+2hBr6xK{)G+xx5B?tApWp?sZ^% zF_%|R<|y08j$tE@+zx0K{Y%(|{!cx1u{?`(L+&FudV@#|pZvfig2Jky;lJq2N4{zp z430|4Y^!szVhV@ML6eWP1Z`u`6e)Om6Ge(IXH+-&Z?`k_@%}%t?(OXH{_mxgQY}j zqd{s7`z7S+uf?*m5tH-JX~kL!VUxq}*n~Y%?C+%t=09AJ%fOdlM>)ClTF{=5lgs{O z+amU^BoVpeCnJ69wN6uzu;K&6F>qx-1c_R55?)r9ULL7Z-a6p5=4mnP;AP=9y=ndFGjC go_Xe(XWtV0KRFm-`;p;TK>z>%07*qoM6N<$g7saCGynhq literal 0 HcmV?d00001 diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..b9a7b14 --- /dev/null +++ b/run.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +CONFIG_PATH=/data/options.json +CUSTOM_CFG_PATH=/share/zabbix-agent2 + +SERVER=$(jq --raw-output ".server" $CONFIG_PATH) +HOSTNAME=$(jq --raw-output ".hostname" $CONFIG_PATH) + +if [ ! -d "$CUSTOM_CFG_PATH" ] ; then + mkdir -p "$CUSTOM_CFG_PATH" +fi + +echo " +Server=$SERVER +ServerActive=$SERVER +Hostname=$HOSTNAME +LogType=console +Include=${CUSTOM_CFG_PATH}/*.conf +" > /etc/zabbix/zabbix_agent2.conf + +sudo -u zabbix zabbix_agent2 -f