Possibility to base64 encode the regex passed to zabbix agent

tags/zabbix-agent-addons-0.2.20-1
Daniel Berteaud 11 years ago
parent 34ef6daf64
commit 1015709880
  1. 2
      zabbix_conf/backuppc.conf
  2. 8
      zabbix_scripts/disco_backuppc_sudo

@ -5,7 +5,7 @@
# Other available macros:
# {#BPCPERIOD}: Max age (in day) the oldest backup should be
# {#BPCHOST}: name of the backup host
UserParameter=backuppc.host.discovery[*],/usr/bin/sudo /var/lib/zabbix/bin/disco_backuppc_sudo --regex=$1
UserParameter=backuppc.host.discovery[*],/usr/bin/sudo /var/lib/zabbix/bin/disco_backuppc_sudo --base64 --regex=$1
# Item prototypes
# key: backuppc.host.info[{#BPCHOST},item]

@ -6,13 +6,19 @@ use BackupPC::CGI::Lib;
use POSIX;
use JSON;
use Getopt::Long;
use MIME::Base64 qw( decode_base64 );
my $regex = '.*';
my $base64 = 0;
GetOptions(
"regex=s" => \$regex
"regex=s" => \$regex,
"base64" => \$base64
);
$regex = decode_base64($regex) if ($base64);
$regex = qr($regex);
# We need to switch to backuppc UID/GID
my $uid = getuid();
my $gid = getgid();

Loading…
Cancel
Save