Commit 2ff5d087 authored by Gavin Brown's avatar Gavin Brown

updated and stuff.

parent f5a92bef
doc:
pod2markdown dsd > README.dsd.md
pod2markdown dsd-cp > README.dsd-cp.md
pod2markdown dsd-db > README.dsd-db.md
install:
install -m 0755 dsd /usr/local/bin
install -m 0755 dsd-cp /usr/local/bin
install -m 0755 dsd-db /usr/local/bin
# NAME
DSD - A Simple DNS Statistics Collecting Daemon
# DESCRIPTION
# USAGE
dsd [OPTIONS]
# OPTIONS
- --config=FILE
Specify config file. Defaults to /etc/dsd/dsd.conf
- --help
Show help.
# CONFIGURATION OPTIONS
[dsd]
; location to where files are written:
directory="/var/lib/dsd"
[cp]
; SSH key to use:
key=/path/to/id_rsa
; username on remote host
user=dsd
; server to copy to
host=hostname
; directory on remote host
directory=/home/dsd/data
# SEE ALSO
- `dsd`, the daemon which runs on a DNS server and generates statistical data.
- `dsd-db`, which processes DSD data files and writes the data to a database.
- `dsd-munin`, a Munin plugin for displaying graphs based on the DSD database.
- [https://www.centralnic.com/](https://www.centralnic.com/)
- [http://www.net-dns.org/](http://www.net-dns.org/)
- [http://dns.measurement-factory.com/tools/dsc/](http://dns.measurement-factory.com/tools/dsc/)
- [http://munin-monitoring.org/](http://munin-monitoring.org/)
# COPYRIGHT
dsd is Copyright 2014 CentralNic Ltd. All rights reserved. This program is free
software; you can redistribute it and/or modify it under the same terms as Perl
itself.
......@@ -27,9 +27,6 @@ DSD - A Simple DNS Statistics Collecting Daemon
# CONFIGURATION OPTIONS
[dsd]
(miscellaneous dsd options)
[db]
; DBI DSN
......
......@@ -2,6 +2,12 @@
DSD - A Simple DNS Statistics Collecting Daemon
# DESCRIPTION
`dsd` is a daemon which runs on a DNS server and uses libpcap, [Net::DNS](https://metacpan.org/pod/Net::DNS) and
[NetPacket](https://metacpan.org/pod/NetPacket) to analyse incoming DNS queries. It will periodically write data
files to disk.
# USAGE
dsd [OPTIONS]
......@@ -25,10 +31,6 @@ DSD - A Simple DNS Statistics Collecting Daemon
Include DNS queries observed in debugging output. Ignored unless --debug is
used.
- --once
Run for one loop then terminate.
- --help
Show help.
......@@ -36,6 +38,7 @@ DSD - A Simple DNS Statistics Collecting Daemon
# CONFIGURATION OPTIONS
[dsd]
; interface to capture packets on
interface=eth0
......@@ -46,16 +49,16 @@ DSD - A Simple DNS Statistics Collecting Daemon
interval=300
; list of zones you're interested in
zones="foo,bar"
zones="foo,bar.com"
; location to where files are written:
directory="/var/lib/dsd"
# SEE ALSO
- `dsd-cp`, which copies DSD data files from the DNS server to a remote
server.
- `dsd-db`, which processes DSD data files and writes the data to a
database.
- `dsd-munin`, a Munin plugin for displaying graphs based on the DSD
database.
- `dsd-cp`, which copies DSD data files from the DNS server to a remote server.
- `dsd-db`, which processes DSD data files and writes the data to a database.
- `dsd-munin`, a Munin plugin for displaying graphs based on the DSD database.
- [https://www.centralnic.com/](https://www.centralnic.com/)
- [http://www.net-dns.org/](http://www.net-dns.org/)
- [http://dns.measurement-factory.com/tools/dsc/](http://dns.measurement-factory.com/tools/dsc/)
......
......@@ -266,6 +266,7 @@ Show help.
=head1 CONFIGURATION OPTIONS
[dsd]
; interface to capture packets on
interface=eth0
......@@ -276,7 +277,10 @@ Show help.
interval=300
; list of zones you're interested in
zones="foo,bar"
zones="foo,bar.com"
; location to where files are written:
directory="/var/lib/dsd"
=head1 SEE ALSO
......
#!/usr/bin/perl
# Copyright 2014 CentralNic Ltd. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
use Config::Simple;
use Getopt::Long;
use POSIX;
use Pod::Usage;
use Sys::Syslog qw(:standard :macros);
use strict;
openlog('dsd-cp', 'ndelay,perror,pid', LOG_DAEMON);
my $file = '/etc/dsd.conf';
my $help;
my $stdin;
GetOptions(
'config=s' => \$file,
'help' => \$help,
);
pod2usage('-verbose' => 99, '-sections' => 'USAGE|OPTIONS') if ($help);
my $config = Config::Simple->new($file)->hashref;
syslog(LOG_DEBUG, "Running with config from $file");
if (!opendir(DIR, $config->{'dsd.directory'})) {
syslog(LOG_CRIT, "Error opening '".$config->{'dsd.directory'}.": $!");
exit(1);
}
my @files = map { $config->{'dsd.directory'} . '/' . $_ } grep { /\.js$/ } readdir(DIR);
closedir(DIR);
foreach my $file (@files) {
if (!system(
'scp',
'-q',
'-o', sprintf('IdentityFile="%s"', $config->{'cp.key'}),
$file,
sprintf(
'%s@%s:%s/',
$config->{'cp.user'},
$config->{'cp.host'},
$config->{'cp.directory'},
),
)) {
syslog(LOG_CRIT, "Error copying $file: $!");
} else {
syslog(LOG_DEBUG, "File $file copied to $config->{'cp.host'}");
unlink($file);
}
}
__END__
=pod
=head1 NAME
DSD - A Simple DNS Statistics Collecting Daemon
=head1 DESCRIPTION
=head1 USAGE
dsd [OPTIONS]
=head1 OPTIONS
=over
=item --config=FILE
Specify config file. Defaults to /etc/dsd/dsd.conf
=item --help
Show help.
=back
=head1 CONFIGURATION OPTIONS
[dsd]
; location to where files are written:
directory="/var/lib/dsd"
[cp]
; SSH key to use:
key=/path/to/id_rsa
; username on remote host
user=dsd
; server to copy to
host=hostname
; directory on remote host
directory=/home/dsd/data
=head1 SEE ALSO
=over
=item C<dsd>, the daemon which runs on a DNS server and generates statistical data.
=item C<dsd-db>, which processes DSD data files and writes the data to a database.
=item C<dsd-munin>, a Munin plugin for displaying graphs based on the DSD database.
=item L<https://www.centralnic.com/>
=item L<http://www.net-dns.org/>
=item L<http://dns.measurement-factory.com/tools/dsc/>
=item L<http://munin-monitoring.org/>
=back
=head1 COPYRIGHT
dsd is Copyright 2014 CentralNic Ltd. All rights reserved. This program is free
software; you can redistribute it and/or modify it under the same terms as Perl
itself.
=cut
\ No newline at end of file
......@@ -108,6 +108,7 @@ sub parse_json {
}
}
}
__END__
=pod
......@@ -145,9 +146,6 @@ Show help.
=head1 CONFIGURATION OPTIONS
[dsd]
(miscellaneous dsd options)
[db]
; DBI DSN
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment