Skip to content

Commit

Permalink
Ported to Znuny 7.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
NiklasSchmitt committed Jun 22, 2023
1 parent 73ddfb9 commit dfd0132
Show file tree
Hide file tree
Showing 18 changed files with 44 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: registry.znuny.com/znuny/internal/docker-znuny-ci:6.5
image: registry.znuny.com/znuny/internal/docker-znuny-ci:7.0

include:
- project: 'Znuny/Internal/Znuny'
Expand Down
4 changes: 2 additions & 2 deletions Kernel/Config/NagiosCheck.pm.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
# For possible search options see:
# http://otrs.github.io/doc/api/otrs/stable/Perl/Kernel/System/Ticket/TicketSearch.pm.html -> TicketSearch()
# https://github.com/znuny/Znuny/blob/dev/Kernel/System/Ticket/TicketSearch.pm -> TicketSearch()
# Examples see below
# --

Expand Down Expand Up @@ -61,7 +61,7 @@

# Information used by Nagios
# Name of check shown in Nagios Status Information
checkname => 'OTRS Checker',
checkname => 'Znuny Checker',

# Text shown in Status Information if everything is OK
OK_TXT => 'enjoy tickets:',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ package Kernel::System::Console::Command::Maint::SystemMonitoring::NagiosCheck;

use strict;
use warnings;
use utf8;

use parent qw(Kernel::System::Console::BaseCommand);

our @ObjectDependencies = (
'Kernel::System::Main',
'Kernel::System::Ticket',
);

sub Configure {
my ( $Self, %Param ) = @_;

$Self->Description('OTRS Nagios checker.');
$Self->Description('Znuny Nagios checker.');
$Self->AddOption(
Name => 'config-file',
Description => "Path to configuration file.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ package Kernel::System::Console::Command::Maint::SystemMonitoring::NagiosCheckTi

use strict;
use warnings;
use utf8;

use parent qw(Kernel::System::Console::BaseCommand);

our @ObjectDependencies = (
'Kernel::System::Main',
'Kernel::System::Ticket',
);

sub Configure {
my ( $Self, %Param ) = @_;

$Self->Description('OTRS Nagios checker.');
$Self->Description('Znuny Nagios checker.');
$Self->AddOption(
Name => 'config-file',
Description => "Path to configuration file.",
Expand Down Expand Up @@ -72,8 +72,10 @@ sub Run {
# read configuration
my %Config = %{ $Self->{Config} || {} };

my $TicketObject = $Kernel::OM->Get('Kernel::System::Ticket');

# search tickets
my $TicketCount = $Kernel::OM->Get('Kernel::System::Ticket')->TicketSearch(
my $TicketCount = $TicketObject->TicketSearch(
%{ $Config{Search} },
Limit => 100_000,
Result => 'COUNT',
Expand Down
1 change: 1 addition & 0 deletions Kernel/System/PostMaster/Filter/SystemMonitoring.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ package Kernel::System::PostMaster::Filter::SystemMonitoring;

use strict;
use warnings;
use utf8;

use Kernel::System::VariableCheck qw(:all);

Expand Down
1 change: 1 addition & 0 deletions Kernel/System/Ticket/Event/Icinga2Acknowledge.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package Kernel::System::Ticket::Event::Icinga2Acknowledge;
use strict;
use warnings;
use Kernel::System::VariableCheck qw(:all);
use utf8;

our @ObjectDependencies = (
'Kernel::Config',
Expand Down
1 change: 1 addition & 0 deletions Kernel/System/Ticket/Event/NagiosAcknowledge.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package Kernel::System::Ticket::Event::NagiosAcknowledge;

use strict;
use warnings;
use utf8;

our @ObjectDependencies = (
'Kernel::Config',
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
![Znuny logo](https://znuny.com/assets/images/logo_small.png)

![Build status](https://badge.proxy.znuny.com/SystemMonitoring/rel-6_5)
![Build status](https://badge.proxy.znuny.com/SystemMonitoring/rel-7_0)

SystemMonitoring
================
This package contains a postmaster filter which provides a primary email interface to system monitoring applications. For Icinga and Nagios, deeper integration is included. Automatic linking between tickets and CIs is available for users of the [ITSM Configuration Management add-on](https://doc.znuny.org/manual/itsmfeatures/index.html). Based on the system monitoring notification, the incident stage of a CI is also changed.

**Prerequisites**

- Znuny 6.5
- Znuny 7.0

**Installation**

Install the add-on via the package manager from the repository "Freebie Features". If you like to download the add-on find the version for your Znuny version at https://download.znuny.org/releases/packages/. This file can be installed by uploading it to the package manger or by using bin/otrs.Console.pl.
Install the add-on via the package manager from the repository "Freebie Features". If you like to download the add-on find the version for your Znuny version at https://download.znuny.org/releases/packages/. This file can be installed by uploading it to the package manger or by using bin/znuny.Console.pl.

**Configuration**

Expand Down
26 changes: 1 addition & 25 deletions SystemMonitoring.sopm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<otrs_package version="1.1">
<Name>SystemMonitoring</Name>
<Version>6.5.1</Version>
<Framework>6.5.x</Framework>
<Framework>7.0.x</Framework>
<Vendor>Znuny</Vendor>
<URL>https://www.znuny.org/</URL>
<License>GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007</License>
Expand Down Expand Up @@ -95,8 +95,6 @@
You are about to install the package SystemMonitoring.<br>
<br>
<br>
((enjoy))<br>
<br>
]]></IntroInstall>
<IntroInstall Type="pre" Title="Installation Information" Lang="de"><![CDATA[
Expand All @@ -108,8 +106,6 @@
Sie sind im Begriff das Paket SystemMonitoring zu installieren.<br>
<br>
<br>
((enjoy))<br>
<br>
]]></IntroInstall>
<IntroInstall Type="pre" Title="Install Information" Lang="es"><![CDATA[
Expand All @@ -121,8 +117,6 @@
Ud. está a punto de instalar el paquete de Monitorización del Sistema.<br>
<br>
<br>
((enjoy))<br>
<br>
]]></IntroInstall>
<IntroInstall Type="pre" Title="Telepítési információk" Lang="hu"><![CDATA[
Expand All @@ -134,8 +128,6 @@
Ön a SystemMonitoring csomag telepítésére készül.<br>
<br>
<br>
((enjoy))<br>
<br>
]]></IntroInstall>
<IntroInstall Type="post" Title="Installation Information" Lang="en"><![CDATA[
Expand All @@ -147,8 +139,6 @@
For configuration instructions please refer to the enclosed PDF documentation.
<br>
<br>
((enjoy))<br>
<br>
]]></IntroInstall>
<IntroInstall Type="post" Title="Installation Information" Lang="de"><![CDATA[
Expand All @@ -160,8 +150,6 @@
Eine Anleitung zur Konfiguration des SystemMonitoring Moduls findet sich in der Datei PDF.
<br>
<br>
((enjoy))<br>
<br>
]]></IntroInstall>
<IntroInstall Type="post" Title="Installation Information" Lang="es"><![CDATA[
Expand All @@ -173,8 +161,6 @@
Instrucciones sobre cómo configurar el módulo de monitorización del sistema se proporcionan en el archivo PDF .
<br>
<br>
((enjoy))<br>
<br>
]]></IntroInstall>
<IntroInstall Type="post" Title="Telepítési információk" Lang="hu"><![CDATA[
Expand All @@ -186,8 +172,6 @@
A beállítási utasításokért nézze meg a mellékelt PDF-dokumentumot.
<br>
<br>
((enjoy))<br>
<br>
]]></IntroInstall>
<IntroUpgrade Type="pre" Title="Upgrade Information" Lang="en"><![CDATA[
Expand All @@ -199,8 +183,6 @@
You are about to upgrade the package SystemMonitoring.<br>
<br>
<br>
((enjoy))<br>
<br>
]]></IntroUpgrade>
<IntroUpgrade Type="pre" Title="Upgrade Information" Lang="de"><![CDATA[
Expand All @@ -212,8 +194,6 @@
Sie sind im Begriff das Paket SystemMonitoring zu aktualisieren.<br>
<br>
<br>
((enjoy))<br>
<br>
]]></IntroUpgrade>
<IntroUpgrade Type="pre" Title="Upgrade Information" Lang="es"><![CDATA[
Expand All @@ -225,8 +205,6 @@
Ud. está a punto de actualizar el paquete de Monitorización del Sistema.<br>
<br>
<br>
((enjoy))<br>
<br>
]]></IntroUpgrade>
<IntroUpgrade Type="pre" Title="Frissítési információk" Lang="hu"><![CDATA[
Expand All @@ -238,8 +216,6 @@
Ön a SystemMonitoring csomag frissítésére készül.<br>
<br>
<br>
((enjoy))<br>
<br>
]]></IntroUpgrade>

Expand Down
16 changes: 8 additions & 8 deletions doc/en/SystemMonitoring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,20 @@ Mail matches 'FromAddress'?
(please note that you need to be in the "admin" group).
</para>
<para>
<ulink url="http://localhost/otrs/index.pl?Action=AdminPackageManager">
http://localhost/otrs/index.pl?Action=AdminPackageManager
<ulink url="http://localhost/znuny/index.pl?Action=AdminPackageManager">
http://localhost/znuny/index.pl?Action=AdminPackageManager
</ulink>
</para>
</section>
<section>
<title>Command Line</title>
<para>
Whenever you cannot use the Admin Interface for whatever reason, you may use the
following command line tool ("bin/otrs.Console.pl Admin::Package::Install") instead.
following command line tool ("bin/znuny.Console.pl Admin::Package::Install") instead.
</para>
<para>
<screen>
shell> bin/otrs.Console.pl Admin::Package::Install /path/to/$Name-$Version.opm
shell> bin/znuny.Console.pl Admin::Package::Install /path/to/$Name-$Version.opm
</screen>
</para>
</section>
Expand Down Expand Up @@ -376,9 +376,9 @@ shell> bin/otrs.Console.pl Admin::Package::Install /path/to/$Name-$Version.opm
</para>
<para>
<screen>
shell> perl bin/otrs.Console.pl Dev::UnitTest::Run --test Console/Command/Maint/SystemMonitoring/NagiosCheck
shell> perl bin/otrs.Console.pl Dev::UnitTest::Run --test Console/Command/Maint/SystemMonitoring/NagiosCheckTicketCount
shell> perl bin/otrs.Console.pl Dev::UnitTest::Run --test SystemMonitoring
shell> perl bin/znuny.Console.pl Dev::UnitTest::Run --test Console/Command/Maint/SystemMonitoring/NagiosCheck
shell> perl bin/znuny.Console.pl Dev::UnitTest::Run --test Console/Command/Maint/SystemMonitoring/NagiosCheckTicketCount
shell> perl bin/znuny.Console.pl Dev::UnitTest::Run --test SystemMonitoring
</screen>
</para>
<para>
Expand All @@ -389,7 +389,7 @@ shell> perl bin/otrs.Console.pl Dev::UnitTest::Run --test SystemMonitoring
</para>
<para>
<screen>
shell> perl bin/otrs.Console.pl Dev::UnitTest::Run
shell> perl bin/znuny.Console.pl Dev::UnitTest::Run
</screen>
</para>
</section>
Expand Down
16 changes: 8 additions & 8 deletions doc/hu/SystemMonitoring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,21 @@ A levél illeszkedik a „FromAddress” értékre?
(ne feledje, hogy az „admin” csoportban kell lennie).
</para>
<para>
<ulink url="http://localhost/otrs/index.pl?Action=AdminPackageManager">
http://localhost/otrs/index.pl?Action=AdminPackageManager
<ulink url="http://localhost/znuny/index.pl?Action=AdminPackageManager">
http://localhost/znuny/index.pl?Action=AdminPackageManager
</ulink>
</para>
</section>
<section>
<title>Parancssor</title>
<para>
Ha esetleg valamilyen okból nem tudja használni az adminisztrátori felületet, akkor
használhatja a következő parancssori eszközt helyette („bin/otrs.Console.pl
használhatja a következő parancssori eszközt helyette („bin/znuny.Console.pl
Admin::Package::Install”).
</para>
<para>
<screen>
shell> bin/otrs.Console.pl Admin::Package::Install /elérési/út/$Name-$Version.opm
shell> bin/znuny.Console.pl Admin::Package::Install /elérési/út/$Name-$Version.opm
</screen>
</para>
</section>
Expand Down Expand Up @@ -381,9 +381,9 @@ felületen. A következő beállítási lehetőségek érhetők el:</para>
</para>
<para>
<screen>
shell> perl bin/otrs.Console.pl Dev::UnitTest::Run --test Console/Command/Maint/SystemMonitoring/NagiosCheck
shell> perl bin/otrs.Console.pl Dev::UnitTest::Run --test Console/Command/Maint/SystemMonitoring/NagiosCheckTicketCount
shell> perl bin/otrs.Console.pl Dev::UnitTest::Run --test SystemMonitoring
shell> perl bin/znuny.Console.pl Dev::UnitTest::Run --test Console/Command/Maint/SystemMonitoring/NagiosCheck
shell> perl bin/znuny.Console.pl Dev::UnitTest::Run --test Console/Command/Maint/SystemMonitoring/NagiosCheckTicketCount
shell> perl bin/znuny.Console.pl Dev::UnitTest::Run --test SystemMonitoring
</screen>
</para>
<para>
Expand All @@ -395,7 +395,7 @@ shell> perl bin/otrs.Console.pl Dev::UnitTest::Run --test SystemMonitoring
</para>
<para>
<screen>
shell> perl bin/otrs.Console.pl Dev::UnitTest::Run
shell> perl bin/znuny.Console.pl Dev::UnitTest::Run
</screen>
</para>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ use vars (qw($Self));

my $CommandObject = $Kernel::OM->Get('Kernel::System::Console::Command::Maint::SystemMonitoring::NagiosCheck');

my $ConfigFile = $Kernel::OM->Get('Kernel::Config')->Get('Home') . '/scripts/test/sample/NagiosCheckTesting.pm';
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');

my $ConfigFile = $ConfigObject->Get('Home') . '/scripts/test/sample/NagiosCheckTesting.pm';

my $ExitCode = $CommandObject->Execute( '--config-file', $ConfigFile, '--as-checker', '--verbose', );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ use vars (qw($Self));
my $CommandObject
= $Kernel::OM->Get('Kernel::System::Console::Command::Maint::SystemMonitoring::NagiosCheckTicketCount');

my $ConfigFile = $Kernel::OM->Get('Kernel::Config')->Get('Home') . '/scripts/test/sample/NagiosCheckTesting.pm';
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');

my $ConfigFile = $ConfigObject->Get('Home') . '/scripts/test/sample/NagiosCheckTesting.pm';

my $ExitCode = $CommandObject->Execute( '--config-file', $ConfigFile, '--as-checker', );

Expand Down
1 change: 1 addition & 0 deletions scripts/test/SystemMonitoring.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use strict;
use warnings;
use utf8;

use vars qw($Self);

Expand Down
2 changes: 1 addition & 1 deletion scripts/test/sample/NagiosCheckTesting.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# Information used by Nagios
# Name of check shown in Nagios Status Information
checkname => 'OTRS Checker',
checkname => 'Znuny Checker',

# Text shown in Status Information if everything is OK
OK_TXT => 'enjoy tickets:',
Expand Down
2 changes: 1 addition & 1 deletion scripts/test/sample/SystemMonitoring1.box
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Return-Path: <[email protected]>
To: otrs@example.com
To: znuny@example.com
Subject: ** PROBLEM alert 1 - delphin host is DOWN **
Message-Id: <[email protected]>
Date: Sun, 18 Mar 2007 00:15:46 +0100 (CET)
Expand Down
2 changes: 1 addition & 1 deletion scripts/test/sample/SystemMonitoring2.box
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Return-Path: <[email protected]>
To: otrs@example.com
To: znuny@example.com
Subject: ** RECOVERY alert 2 - delphin host is UP **
Message-Id: <[email protected]>
Date: Sun, 18 Mar 2007 00:19:46 +0100 (CET)
Expand Down
1 change: 1 addition & 0 deletions var/packagesetup/SystemMonitoring.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package var::packagesetup::SystemMonitoring;

use strict;
use warnings;
use utf8;

our @ObjectDependencies = (
'Kernel::Config',
Expand Down

0 comments on commit dfd0132

Please sign in to comment.