Skip to content

Commit

Permalink
add debian packaging files and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
llavaud committed Dec 31, 2016
1 parent 487ed66 commit 7bab551
Show file tree
Hide file tree
Showing 10 changed files with 914 additions and 3 deletions.
621 changes: 621 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

62 changes: 62 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# kbt

Kibana Backup Tool

This script allow to list and export kibana resources like searchs, visualizations and dashboards.

## Table of contents
* [Installation](#installation)
* [Package (favourite)](#package)
* [Archive](#archive)
* [Usage](#usage)

## Installation

<a name="package"/>
### Package (favourite)

I have setup a **Debian/Ubuntu** apt repository to distribute this package

You can add my personal repository to your **`/etc/apt/sources.list`** by adding the following line:

`deb https://llavaud.github.io/kbt/apt stable main`

You must also retrieve and install my GPG key:

`wget -O - https://llavaud.github.io/kbt/apt/conf/gpg.key | sudo apt-key add -`

And then install the package:

```
sudo apt-get update
sudo apt-get install kbt
```

### Archive

If you dont want to add a new repository on your system you can also retrieve the [latest zip/tar.gz archive](https://github.com/llavaud/kbt/releases/latest)

This script depends on several binary or Perl library, so you need to install the following **Debian/Ubuntu** packages before using it:

```bash
sudo apt-get install libhttp-message-perl libjson-perl libwww-perl
```

Once the packages are installed, you just need to extract the archive

## Usage

```
kbt [OPTIONS] <COMMAND>
OPTIONS
--type TYPE Type of kibana resources {search|visualization|dashboard} (defaults to all)
--output FILE Backup file (defaults to kbt_export.json)
--host IP:PORT Ip address of kibana instance (defaults to localhost:5601)
--index INDEX Kibana index (defaults to .kibana)
--help Print this help
COMMAND
list list resource's id
export export resources
```
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kbt (0.1) stable; urgency=medium

* inital release

-- Laurent Lavaud <[email protected]> Sat, 31 Dec 2016 09:38:37 +0100
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
15 changes: 15 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Source: kbt
Section: utils
Priority: optional
Maintainer: Laurent Lavaud <[email protected]>
Build-Depends: debhelper (>=9)
Standards-Version: 3.9.6
Homepage: https://llavaud.github.io/kbt
Vcs-Git: [email protected]:llavaud/kbt.git
Vcs-Browser: https://github.com/llavaud/kbt

Package: kbt
Architecture: all
Depends: ${perl:Depends}, perl (>=5.10), libhttp-message-perl, libjson-perl, libwww-perl
Description: Kibana Backup Tool
This script allow to list and export kibana resources like searchs, visualizations and dashboards.
24 changes: 24 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: kbt
Source: <https://github.com/llavaud/kbt>

Files: *
Copyright: 2016 Laurent Lavaud <[email protected]>
License: GPL-3.0+

License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
2 changes: 2 additions & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kbt usr/bin
man/kbt.1 usr/share/man/man1
7 changes: 7 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/make -f

# output every command that modifies files on the build system.
#export DH_VERBOSE = 1

%:
dh $@
15 changes: 12 additions & 3 deletions kbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ GetOptions(
'type=s' => \(my $type = 'all'),
) or HelpMessage(1);

# add default port if missing
$host =~ s/^([\d\.]+)(?!\:\d+)$/$1:5601/;

my $cmd = $ARGV[0];
Expand Down Expand Up @@ -98,11 +99,19 @@ sub export {
return 1;
}

=pod
__END__
=encoding utf8
=head1 NAME
kbt - Kibana backup Tool, export kibana data
kbt
=head1 DESCRIPTION
Kibana Backup Tool
This script allow to list and export kibana resources like searchs, visualizations and dashboards.
=head1 SYNOPSIS
Expand All @@ -125,6 +134,6 @@ Laurent Lavaud
=head1 VERSION
0.01
0.1
=cut
165 changes: 165 additions & 0 deletions man/kbt.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.if !\nF .nr F 0
.if \nF>0 \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
.\}
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "KBT 1"
.TH KBT 1 "2016-12-31" "perl v5.24.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
kbt
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
Kibana Backup Tool
.PP
This script allow to list and export kibana resources like searchs, visualizations and dashboards.
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
kbt [\s-1OPTIONS\s0] <\s-1COMMAND\s0>
.PP
.Vb 6
\& OPTIONS
\& \-\-type TYPE Type of kibana resources {search|visualization|dashboard} (defaults to all)
\& \-\-output FILE Backup file (defaults to kbt_export.json)
\& \-\-host IP:PORT Ip address of kibana instance (defaults to localhost:5601)
\& \-\-index INDEX Kibana index (defaults to .kibana)
\& \-\-help Print this help
\&
\& COMMAND
\& list list resource\*(Aqs id
\& export export resources
.Ve
.SH "AUTHOR"
.IX Header "AUTHOR"
Laurent Lavaud
.SH "VERSION"
.IX Header "VERSION"
0.1

0 comments on commit 7bab551

Please sign in to comment.