Package: debhelper
Version: 8.9.13
Severity: wishlist
Tags: patch

Hi,

As described in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=652206,
the Zabbix monitoring agent is now going to read bits of configuration
from a /etc/zabbix/zabbix_agent.confd.d/ directory.  This means that any
package providing a service that could be monitored can ship
configuration snippets defining Zabbix probes defining new monitorable
items, with the commands to gather the matching data.

  I suggest that the configuration snippets should be handled like
logcheck rules or logrotate config files, and therefore that there
should be a dh_installzabbix script; and since it's just a matter of
shipping files, I cut and pasted from dh_installlogrotate, edited the
relevant parts, and please find a patch attached.

>From 91537b375349df829d01fe4a0c1522c6ee8d64e5 Mon Sep 17 00:00:00 2001
From: Roland Mas <[email protected]>
Date: Fri, 16 Dec 2011 11:25:38 +0100
Subject: [PATCH 1/2] Added dh_installzabbix script to help packages ship
 Zabbix monitoring probes

---
 dh_installzabbix |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 61 insertions(+), 0 deletions(-)
 create mode 100755 dh_installzabbix

diff --git a/dh_installzabbix b/dh_installzabbix
new file mode 100755
index 0000000..ee80ca4
--- /dev/null
+++ b/dh_installzabbix
@@ -0,0 +1,61 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_installzabbix - install zabbix agent config file snippets
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_installzabbix> [S<I<debhelper options>>] [B<--name=>I<name>]
+
+=head1 DESCRIPTION
+
+B<dh_installzabbix> is a debhelper program that is responsible for
+installing zabbix config files into F<etc/zabbix/zabbix_agent.conf.d>
+in package build directories.  Files named F<debian/package.zabbix>
+are installed.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--name=>I<name>
+
+Look for files named F<debian/package.name.zabbix> and install them as
+F<etc/zabbix/zabbix_agent.conf.d/name>, instead of using the usual
+files and installing them as the package name.
+
+=back
+
+=cut
+
+init();
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+	my $tmp=tmpdir($package);
+	my $file=pkgfile($package,"zabbix");
+
+	if ($file) {
+		if (! -d "$tmp/etc/zabbix/zabbix_agentd.conf.d") {
+			doit("install","-o",0,"-g",0,"-d","$tmp/etc/zabbix/zabbix_agentd.conf.d");
+		}
+		doit("install","-m",644,$file,"$tmp/etc/zabbix/zabbix_agentd.conf.d/".pkgfilename($package));
+	}
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Joey Hess <[email protected]>
+
+=cut
-- 
1.7.7.3

>From cd1f4e8c865ab26588582ad955f2ecc244abefbc Mon Sep 17 00:00:00 2001
From: Roland Mas <[email protected]>
Date: Fri, 16 Dec 2011 11:37:03 +0100
Subject: [PATCH 2/2] Insert dh_installzabbix in the default sequence

---
 dh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/dh b/dh
index 27733ac..ffc2f85 100755
--- a/dh
+++ b/dh
@@ -374,6 +374,7 @@ my @i = qw{
 	dh_installmodules
 	dh_installlogcheck
 	dh_installlogrotate
+	dh_installzabbix
 	dh_installpam
 	dh_installppp
 	dh_installudev
-- 
1.7.7.3

  Thanks,

Roland.
-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 3.0.0-2-686-pae (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages debhelper depends on:
ii  binutils    2.22-2
ii  dpkg-dev    1.16.1.2
ii  file        5.09-2
ii  html2text   1.3.2a-15
ii  man-db      2.6.0.2-3
ii  perl        5.14.2-6
ii  po-debconf  1.0.16+nmu1

debhelper recommends no packages.

Versions of packages debhelper suggests:
ii  dh-make  0.59

-- no debconf information

-- 
Roland Mas

Just because you're dead doesn't mean they aren't still out to get you.
  -- Virgil, in Ye Gods! (Tom Holt)

Reply via email to