From 24e71fb9cc4785a70100cb1c0660bb0036f26e93 Mon Sep 17 00:00:00 2001 From: Gabriele Vivinetto Date: Thu, 11 Jul 2019 17:31:23 +0200 Subject: [PATCH] * Initial import --- .gitignore | 1 + README.md | 14 ++++--- etc/sudoers.d/zabbix_backuppc | 2 - src/DEBIAN/conffiles | 1 + src/DEBIAN/control | 10 +++++ src/DEBIAN/postinst | 41 +++++++++++++++++++ src/etc/sudoers.d/zabbix_backuppc | 2 + {usr/local => src/usr}/bin/zabbix-backuppc.pl | 0 .../usr}/bin/zabbix-discover-backuppc.pl | 0 zabbix-templates/zabbix-backuppc-template.xml | 2 +- 10 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 .gitignore delete mode 100644 etc/sudoers.d/zabbix_backuppc create mode 100644 src/DEBIAN/conffiles create mode 100644 src/DEBIAN/control create mode 100755 src/DEBIAN/postinst create mode 100644 src/etc/sudoers.d/zabbix_backuppc rename {usr/local => src/usr}/bin/zabbix-backuppc.pl (100%) rename {usr/local => src/usr}/bin/zabbix-discover-backuppc.pl (100%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c00df13 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.deb diff --git a/README.md b/README.md index 21027ef..86e1431 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,23 @@ This is based on script found in thread https://www.zabbix.com/forum/showthread. Tested with Zabbix 4.0 (http://www.zabbix.com/) and Backuppc v3 (http://backuppc.sourceforge.net/). -## Install +## Debian Package Build + fakeroot dpkg-deb --build src/ . + + +## Manual Install Add a line from 'sudo' file to your sudo config cp etc/sudoers.d/zabbix-backuppc /etc/sudoers.d/zabbix-backuppc -Copy 'zabbix-backuppc.pl' and 'zabbix-discover-backuppc.pl' to '/usr/local/bin' +Copy 'zabbix-backuppc.pl' and 'zabbix-discover-backuppc.pl' to '/usr/bin' - cp usr/local/bin/*.pl /usr/local/bin + cp usr/bin/*.pl /usr/bin Make it executable with backuppc user - chmod +x /usr/local/bin/*.pl + chmod +x /usr/bin/*.pl You need to have in Zabbix agent config @@ -87,7 +91,7 @@ Information about the BackupPc itself. Discovery from individual backups - system.run["sudo -u backuppc /usr/local/bin/zabbix-discover-backuppc.pl"] + system.run["sudo -u backuppc /usr/bin/zabbix-discover-backuppc.pl"] #### Items diff --git a/etc/sudoers.d/zabbix_backuppc b/etc/sudoers.d/zabbix_backuppc deleted file mode 100644 index 8af5173..0000000 --- a/etc/sudoers.d/zabbix_backuppc +++ /dev/null @@ -1,2 +0,0 @@ -zabbix ALL = (ALL) NOPASSWD: /usr/local/bin/zabbix-backuppc.pl,/usr/local/bin/zabbix-discover-backuppc.pl - diff --git a/src/DEBIAN/conffiles b/src/DEBIAN/conffiles new file mode 100644 index 0000000..a3c258c --- /dev/null +++ b/src/DEBIAN/conffiles @@ -0,0 +1 @@ +/etc/sudoers.d/zabbix_backuppc diff --git a/src/DEBIAN/control b/src/DEBIAN/control new file mode 100644 index 0000000..fe4d961 --- /dev/null +++ b/src/DEBIAN/control @@ -0,0 +1,10 @@ +Package: zabbix-backuppc +Version: 1.0.0-2019071103 +Section: net +Priority: optional +Architecture: all +Depends: zabbix-agent (>=4.0), zabbix-sender (>=4.0) +Maintainer: Gabriele Vivinetto +Description: Zabbiz agent scripts to monitor BackupPC + These scripts monitor a BackupPC server + diff --git a/src/DEBIAN/postinst b/src/DEBIAN/postinst new file mode 100755 index 0000000..9d00cf7 --- /dev/null +++ b/src/DEBIAN/postinst @@ -0,0 +1,41 @@ +#!/bin/sh +# postinst script for tcng-config +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + configure) + /bin/sed -i -e 's/# EnableRemoteCommands=0/EnableRemoteCommands=1/' /etc/zabbix/zabbix_agentd.conf + /usr/sbin/service zabbix-agent restart + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/src/etc/sudoers.d/zabbix_backuppc b/src/etc/sudoers.d/zabbix_backuppc new file mode 100644 index 0000000..3480a63 --- /dev/null +++ b/src/etc/sudoers.d/zabbix_backuppc @@ -0,0 +1,2 @@ +zabbix ALL = (ALL) NOPASSWD: /usr/bin/zabbix-backuppc.pl,/usr/bin/zabbix-discover-backuppc.pl + diff --git a/usr/local/bin/zabbix-backuppc.pl b/src/usr/bin/zabbix-backuppc.pl similarity index 100% rename from usr/local/bin/zabbix-backuppc.pl rename to src/usr/bin/zabbix-backuppc.pl diff --git a/usr/local/bin/zabbix-discover-backuppc.pl b/src/usr/bin/zabbix-discover-backuppc.pl similarity index 100% rename from usr/local/bin/zabbix-discover-backuppc.pl rename to src/usr/bin/zabbix-discover-backuppc.pl diff --git a/zabbix-templates/zabbix-backuppc-template.xml b/zabbix-templates/zabbix-backuppc-template.xml index 0c30f8a..990c6d2 100644 --- a/zabbix-templates/zabbix-backuppc-template.xml +++ b/zabbix-templates/zabbix-backuppc-template.xml @@ -2224,7 +2224,7 @@ 7 - system.run["sudo -u backuppc /usr/local/bin/zabbix-backuppc.pl"] + system.run["sudo -u backuppc /usr/bin/zabbix-backuppc.pl"] 300 90d 365d