Skip to content

Commit

Permalink
GENERAL CHANGES!
Browse files Browse the repository at this point in the history
  • Loading branch information
orkunkaraduman committed Jul 22, 2017
1 parent 194e2ff commit 6ee0932
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 95 deletions.
9 changes: 6 additions & 3 deletions .gitignore
Expand Up @@ -3,6 +3,9 @@
*~
*.tar
*.tar.*
*.cache
*.swap
*.swp

*.project
*.includepath
Expand All @@ -15,6 +18,6 @@
MYMETA.json
MYMETA.yml
Makefile
_build/**
blib/**
pm_to_blib/**
_build
blib
pm_to_blib
11 changes: 7 additions & 4 deletions MANIFEST.SKIP
Expand Up @@ -5,6 +5,9 @@
~$
\.tar$
\.tar\..*$
\.cache$
\.swap$
\.swp$

\.project$
\.includepath$
Expand All @@ -17,8 +20,8 @@
^MYMETA\.json$
^MYMETA\.yml$
^Makefile$
^_build\/
^blib\/
^pm_to_blib\/
^_build\/?
^blib\/?
^pm_to_blib\/?

^dev\/
^dev\/?
34 changes: 15 additions & 19 deletions Makefile.PL
Expand Up @@ -8,35 +8,31 @@ WriteMakefile(
VERSION_FROM => 'lib/Zabbix/Check.pm',
MIN_PERL_VERSION => '5.014',
PREREQ_PM => {
'Switch' => 0,
'FindBin' => 0,
'Cwd' => 0,
'File::Basename' => 0,
'File::Slurp' => 0,
'JSON' => 0,
'Net::NTP' => 0,
'Lazy::Utils' => '1.04',
'Cwd' => '3.62',
'JSON' => '2.90',
'Net::NTP' => '1.5',
'Lazy::Utils' => '1.21',
},
EXE_FILES => [qw(
)],
AUTHOR => 'Orkun Karaduman <orkunkaraduman@gmail.com>',
ABSTRACT => 'System and service checks for Zabbix',
LICENSE => 'gpl_3',
META_MERGE => {
'meta-spec' => {
version => 2
'meta-spec' => {
version => 2
},
resources => {
homepage => 'https://metacpan.org/release/Zabbix-Check',
license => 'https://www.gnu.org/licenses/gpl-3.0.html',
repository => {
type => 'git',
url => 'git://git@github.com:orkunkaraduman/Zabbix-Check.git',
web => 'https://github.com/orkunkaraduman/Zabbix-Check',
resources => {
homepage => 'https://metacpan.org/release/Zabbix-Check/tree/master',
license => 'https://www.gnu.org/licenses/gpl-3.0.html',
repository => {
type => 'git',
url => 'git://git@github.com:orkunkaraduman/Zabbix-Check.git',
web => 'https://github.com/orkunkaraduman/Zabbix-Check',
},
bugtracker => {
web => 'https://github.com/orkunkaraduman/Zabbix-Check/issues',
mailto => 'bug-Zabbix-Check@rt.cpan.org',
web => 'https://github.com/orkunkaraduman/Zabbix-Check/issues',
mailto => 'bug-Zabbix-Check@rt.cpan.org',
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions conf/zabbix_agentd.conf
@@ -1,3 +1,5 @@
UserParameter=cpan.zabbix.check.installed,/bin/bash -c "/usr/bin/perl -MZabbix::Check 2>/dev/null; if [ \$? -eq 0 ]; then echo 1; else echo 0; fi"

UserParameter=cpan.zabbix.check.version,/usr/bin/perl -MZabbix::Check -e_version

UserParameter=cpan.zabbix.check.disk.discovery,/usr/bin/perl -MZabbix::Check::Disk -e_discovery
Expand Down
31 changes: 13 additions & 18 deletions dev/dist.pl
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#!/usr/bin/env perl
=head1 NAME
dist.pl - distribution generator
Expand All @@ -14,41 +14,36 @@ =head1 SYNOPSIS
=cut
use strict;
use warnings;
no warnings qw(qw utf8);
use v5.14;
use utf8;
use open qw(:std :locale);
use Config;
use open qw(:utf8 :std);
use open IO => ':bytes';
use FindBin;
use Cwd;
use Pod::Markdown;
use Pod::Text;


my $module = "Zabbix::Check";
my $modulePath = "lib/" . $module =~ s/\:\:/\//gr . ".pm";
my $base = "${FindBin::Bin}/..";
cwd($base);
my $main_pkg = "Zabbix::Check";
my $pod_path = "lib/" . $main_pkg =~ s/\:\:/\//gr . ".pm";
#my $pod_path = "doc/README.pod";

cwd("${FindBin::Bin}/..");
system("perl Makefile.PL");
system("pod2markdown --html-encode-chars 1 $modulePath > README.md");
system("pod2text $modulePath > README");
system("pod2markdown --html-encode-chars 1 $pod_path > README.md");
system("pod2text $pod_path > README");
system("rm MANIFEST; make manifest");
system("make dist");

exit 0;
__END__
=head1 REPOSITORY
B<GitHub> L<https://github.com/orkunkaraduman/Zabbix-Check>
B<CPAN> L<https://metacpan.org/release/Zabbix-Check>
=head1 AUTHOR
Orkun Karaduman <orkunkaraduman@gmail.com>
Orkun Karaduman (ORKUN) <orkun@cpan.org>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2016 Orkun Karaduman <orkunkaraduman@gmail.com>
Copyright (C) 2017 Orkun Karaduman <orkunkaraduman@gmail.com>
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
Expand Down
13 changes: 3 additions & 10 deletions dev/test.pl
@@ -1,4 +1,4 @@
#! /usr/bin/perl
#!/usr/bin/env perl
=head1 NAME
test.pl - for internal tests
Expand All @@ -14,11 +14,10 @@ =head1 SYNOPSIS
=cut
use strict;
use warnings;
no warnings qw(qw utf8);
use v5.14;
use utf8;
use open qw(:std :locale);
use Config;
use open IO => ':bytes';
use FindBin;
use Data::Dumper;

Expand All @@ -33,19 +32,13 @@ =head1 SYNOPSIS

exit 0;
__END__
=head1 REPOSITORY
B<GitHub> L<https://github.com/orkunkaraduman/Zabbix-Check>
B<CPAN> L<https://metacpan.org/release/Zabbix-Check>
=head1 AUTHOR
Orkun Karaduman <orkunkaraduman@gmail.com>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2016 Orkun Karaduman <orkunkaraduman@gmail.com>
Copyright (C) 2017 Orkun Karaduman <orkunkaraduman@gmail.com>
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
Expand Down
61 changes: 35 additions & 26 deletions lib/Zabbix/Check.pm
Expand Up @@ -11,11 +11,35 @@ version 1.11
System and service checks for Zabbix
UserParameter=cpan.zabbix.check.installed,/bin/bash -c "/usr/bin/perl -MZabbix::Check 2>/dev/null; if [ \$? -eq 0 ]; then echo 1; else echo 0; fi"
UserParameter=cpan.zabbix.check.version,/usr/bin/perl -MZabbix::Check -e_version
=head3 version
UserParameter=cpan.zabbix.check.disk.discovery,/usr/bin/perl -MZabbix::Check::Disk -e_discovery
UserParameter=cpan.zabbix.check.disk.bps[*],/usr/bin/perl -MZabbix::Check::Disk -e_bps -- $1 $2
UserParameter=cpan.zabbix.check.disk.iops[*],/usr/bin/perl -MZabbix::Check::Disk -e_iops -- $1 $2
UserParameter=cpan.zabbix.check.disk.ioutil[*],/usr/bin/perl -MZabbix::Check::Disk -e_ioutil -- $1
UserParameter=cpan.zabbix.check.supervisor.installed,/usr/bin/perl -MZabbix::Check::Supervisor -e_installed
UserParameter=cpan.zabbix.check.supervisor.running,/usr/bin/perl -MZabbix::Check::Supervisor -e_running
UserParameter=cpan.zabbix.check.supervisor.worker_discovery,/usr/bin/perl -MZabbix::Check::Supervisor -e_worker_discovery
UserParameter=cpan.zabbix.check.supervisor.worker_status[*],/usr/bin/perl -MZabbix::Check::Supervisor -e_worker_status -- $1
UserParameter=cpan.zabbix.check.rabbitmq.installed,/usr/bin/perl -MZabbix::Check::RabbitMQ -e_installed
UserParameter=cpan.zabbix.check.rabbitmq.running,/usr/bin/perl -MZabbix::Check::RabbitMQ -e_running
UserParameter=cpan.zabbix.check.rabbitmq.vhost_discovery[*],/usr/bin/perl -MZabbix::Check::RabbitMQ -e_vhost_discovery -- $1
UserParameter=cpan.zabbix.check.rabbitmq.queue_discovery[*],/usr/bin/perl -MZabbix::Check::RabbitMQ -e_queue_discovery -- $1
UserParameter=cpan.zabbix.check.rabbitmq.queue_status[*],/usr/bin/perl -MZabbix::Check::RabbitMQ -e_queue_status -- $1 $2 $3
UserParameter=cpan.zabbix.check.systemd.installed,/usr/bin/perl -MZabbix::Check::Systemd -e_installed
UserParameter=cpan.zabbix.check.systemd.system_status,/usr/bin/perl -MZabbix::Check::Systemd -e_system_status
UserParameter=cpan.zabbix.check.systemd.service_discovery[*],/usr/bin/perl -MZabbix::Check::Systemd -e_service_discovery -- $1
UserParameter=cpan.zabbix.check.systemd.service_status[*],/usr/bin/perl -MZabbix::Check::Systemd -e_service_status -- $1
UserParameter=cpan.zabbix.check.time.epoch,/usr/bin/perl -MZabbix::Check::Time -e_epoch
UserParameter=cpan.zabbix.check.time.zone,/usr/bin/perl -MZabbix::Check::Time -e_zone
UserParameter=cpan.zabbix.check.time.ntp_offset[*],/usr/bin/perl -MZabbix::Check::Time -e_ntp_offset -- $1 $2
gets Zabbix::Check version
=head2 Disk
Expand Down Expand Up @@ -194,15 +218,15 @@ BEGIN
require Exporter;
our $VERSION = '1.11';
our @ISA = qw(Exporter);
our @EXPORT = qw(zbxEncode zbxDecode printDiscovery _version);
our @EXPORT = qw(zbx_encode zbx_decode print_discovery _version);
our @EXPORT_OK = qw();
}


our @zbxSpecials = qw(\ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @);


sub zbxEncode
sub zbx_encode
{
my $result = "";
my ($str) = @_;
Expand All @@ -221,7 +245,7 @@ sub zbxEncode
return $result;
}

sub zbxDecode
sub zbx_decode
{
my $result = "";
my ($str) = @_;
Expand All @@ -244,19 +268,19 @@ sub zbxDecode
return $result;
}

sub printDiscovery
sub print_discovery
{
my @items = @_;
my $discovery = {
data => [
map({
my $item = $_;
my $item = $_;
my %newitem = map({
my $key = $_;
my $val = $item->{$key};
my $newkey = zbxEncode($key);
my $newkey = zbx_encode($key);
$newkey = uc("{#$newkey}");
my $newval = zbxEncode($val);
my $newval = zbx_encode($val);
$newkey => $newval;
} keys(%$item));
\%newitem;
Expand All @@ -280,6 +304,7 @@ sub _version
my $osname = $Config{osname};
warn "OS '$osname' is not supported" unless $osname eq 'linux';


1;
__END__
=head1 INSTALLATION
Expand All @@ -303,26 +328,10 @@ This module requires these other modules and libraries:
=item *
Switch
=item *
FindBin
=item *
Cwd
=item *
File::Basename
=item *
File::Slurp
=item *
JSON
=item *
Expand All @@ -347,7 +356,7 @@ Orkun Karaduman <orkunkaraduman@gmail.com>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2016 Orkun Karaduman <orkunkaraduman@gmail.com>
Copyright (C) 2017 Orkun Karaduman <orkunkaraduman@gmail.com>
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
Expand Down
15 changes: 15 additions & 0 deletions t/00-load.t
@@ -0,0 +1,15 @@
use strict;
use warnings;

use Test::More;


BEGIN { use_ok('Zabbix::Check') }
BEGIN { use_ok('Zabbix::Check::Disk') }
BEGIN { use_ok('Zabbix::Check::Supervisor') }
BEGIN { use_ok('Zabbix::Check::RabbitMQ') }
BEGIN { use_ok('Zabbix::Check::Systemd') }
BEGIN { use_ok('Zabbix::Check::Time') }


done_testing;
15 changes: 0 additions & 15 deletions t/Zabbix-Check.t

This file was deleted.

0 comments on commit 6ee0932

Please sign in to comment.