This commit is contained in:
2024-10-14 00:08:40 +02:00
parent dbfba56f66
commit 1462d52e13
4572 changed files with 2658864 additions and 0 deletions

View File

@@ -0,0 +1,64 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::OutdatedTables;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
'Kernel::System::Package',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
my %ExistingTables = map { lc($_) => 1 } $Kernel::OM->Get('Kernel::System::DB')->ListTables();
my @OutdatedTables;
# This table was removed with OTRS 6 (if empty).
if ( $ExistingTables{gi_object_lock_state} ) {
my $SolManConnectorInstalled;
for my $Package ( $Kernel::OM->Get('Kernel::System::Package')->RepositoryList() ) {
if ( $Package->{Name}->{Content} eq 'OTRSGenericInterfaceConnectorSAPSolMan' ) {
$SolManConnectorInstalled = 1;
}
}
push @OutdatedTables, 'gi_object_lock_state' if !$SolManConnectorInstalled;
}
if ( !@OutdatedTables ) {
$Self->AddResultOk(
Label => Translatable('Outdated Tables'),
Value => '',
);
}
else {
$Self->AddResultWarning(
Label => Translatable('Outdated Tables'),
Value => join( ', ', @OutdatedTables ),
Message => Translatable("Outdated tables were found in the database. These can be removed if empty."),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,84 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::TablePresence;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::DB',
'Kernel::System::Main',
'Kernel::System::XML',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# table check
my $File = $Kernel::OM->Get('Kernel::Config')->Get('Home') . '/scripts/database/otrs-schema.xml';
if ( !-f $File ) {
$Self->AddResultProblem(
Label => Translatable('Table Presence'),
Value => '',
Message => Translatable("Internal Error: Could not open file."),
);
}
my $ContentRef = $Kernel::OM->Get('Kernel::System::Main')->FileRead(
Location => $File,
Mode => 'utf8',
);
if ( !ref $ContentRef && !${$ContentRef} ) {
$Self->AddResultProblem(
Label => Translatable('Table Check'),
Value => '',
Message => Translatable("Internal Error: Could not read file."),
);
}
my @XMLHash = $Kernel::OM->Get('Kernel::System::XML')->XMLParse2XMLHash( String => ${$ContentRef} );
my %ExistingTables = map { lc($_) => 1 } $Kernel::OM->Get('Kernel::System::DB')->ListTables();
my @MissingTables;
TABLE:
for my $Table ( @{ $XMLHash[1]->{database}->[1]->{Table} } ) {
next TABLE if !$Table;
if ( !$ExistingTables{ lc( $Table->{Name} ) } ) {
push( @MissingTables, $Table->{Name} );
}
}
if ( !@MissingTables ) {
$Self->AddResultOk(
Label => Translatable('Table Presence'),
Value => '',
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Table Presence'),
Value => join( ', ', @MissingTables ),
Message => Translatable("Tables found which are not present in the database."),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,64 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::mssql::Size;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'mssql' ) {
return $Self->GetResults();
}
$DBObject->Prepare(
SQL => 'exec sp_spaceused',
Limit => 1,
);
while ( my @Row = $DBObject->FetchrowArray() ) {
# $Row[0] database_name
# $Row[1] database_size
# $Row[2] unallocated space
if ( $Row[1] ) {
$Self->AddResultInformation(
Label => Translatable('Database Size'),
Value => $Row[1],
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Database Size'),
Value => $Row[1],
Message => Translatable('Could not determine database size.')
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,56 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::mssql::Version;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'mssql' ) {
return $Self->GetResults();
}
# version check
my $Version = $DBObject->Version();
if ($Version) {
$Self->AddResultInformation(
Label => Translatable('Database Version'),
Value => $Version,
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Database Version'),
Value => $Version,
Message => Translatable("Could not determine database version."),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,111 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::mysql::Charset;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'mysql' ) {
return $Self->GetResults();
}
$DBObject->Prepare( SQL => "show variables like 'character_set_client'" );
while ( my @Row = $DBObject->FetchrowArray() ) {
if ( $Row[1] =~ /utf8/i ) {
$Self->AddResultOk(
Identifier => 'ClientEncoding',
Label => Translatable('Client Connection Charset'),
Value => $Row[1],
);
}
else {
$Self->AddResultProblem(
Identifier => 'ClientEncoding',
Label => Translatable('Client Connection Charset'),
Value => $Row[1],
Message => Translatable('Setting character_set_client needs to be utf8.'),
);
}
}
$DBObject->Prepare( SQL => "show variables like 'character_set_database'" );
while ( my @Row = $DBObject->FetchrowArray() ) {
if ( $Row[1] =~ /utf8mb4/i ) {
$Self->AddResultProblem(
Identifier => 'ServerEncoding',
Label => Translatable('Server Database Charset'),
Value => $Row[1],
Message =>
"This character set is not yet supported, please see https://bugs.otrs.org/show_bug.cgi?id=12361. Please convert your database to the character set 'utf8'.",
);
}
elsif ( $Row[1] =~ /utf8/i ) {
$Self->AddResultOk(
Identifier => 'ServerEncoding',
Label => Translatable('Server Database Charset'),
Value => $Row[1],
);
}
else {
$Self->AddResultProblem(
Identifier => 'ServerEncoding',
Label => Translatable('Server Database Charset'),
Value => $Row[1],
Message => Translatable("The setting character_set_database needs to be 'utf8'."),
);
}
}
my @TablesWithInvalidCharset;
# Views have engine == null, ignore those.
$DBObject->Prepare( SQL => 'show table status where engine is not null' );
while ( my @Row = $DBObject->FetchrowArray() ) {
if ( $Row[14] =~ /^utf8mb4/i || $Row[14] !~ /^utf8/i ) {
push @TablesWithInvalidCharset, $Row[0];
}
}
if (@TablesWithInvalidCharset) {
$Self->AddResultProblem(
Identifier => 'TableEncoding',
Label => Translatable('Table Charset'),
Value => join( ', ', @TablesWithInvalidCharset ),
Message => Translatable("There were tables found which do not have 'utf8' as charset."),
);
}
else {
$Self->AddResultOk(
Identifier => 'TableEncoding',
Label => Translatable('Table Charset'),
Value => '',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,82 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::mysql::InnoDBLogFileSize;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'mysql' ) {
return $Self->GetResults();
}
# Default storage engine variable has changed its name in MySQL 5.5.3, we need to support both of them for now.
# <= 5.5.2 storage_engine
# >= 5.5.3 default_storage_engine
my $DefaultStorageEngine = '';
$DBObject->Prepare( SQL => "show variables like 'storage_engine'" );
while ( my @Row = $DBObject->FetchrowArray() ) {
$DefaultStorageEngine = $Row[1];
}
if ( !$DefaultStorageEngine ) {
$DBObject->Prepare( SQL => "show variables like 'default_storage_engine'" );
while ( my @Row = $DBObject->FetchrowArray() ) {
$DefaultStorageEngine = $Row[1];
}
}
if ( lc $DefaultStorageEngine ne 'innodb' ) {
return $Self->GetResults();
}
$DBObject->Prepare( SQL => "show variables like 'innodb_log_file_size'" );
while ( my @Row = $DBObject->FetchrowArray() ) {
if (
!$Row[1]
|| $Row[1] < 1024 * 1024 * 256
)
{
$Self->AddResultProblem(
Label => Translatable('InnoDB Log File Size'),
Value => $Row[1] / 1024 / 1024 . ' MB',
Message =>
Translatable("The setting innodb_log_file_size must be at least 256 MB."),
);
}
else {
$Self->AddResultOk(
Label => Translatable('InnoDB Log File Size'),
Value => $Row[1] / 1024 / 1024 . ' MB',
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,82 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::mysql::InvalidDefaultValues;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'mysql' ) {
return $Self->GetResults();
}
my $DatabaseName = $Kernel::OM->Get('Kernel::Config')->Get('Database');
# Check for datetime fields with invalid default values
# (default values with a date of "0000-00-00 00:00:00").
$DBObject->Prepare(
SQL => '
SELECT TABLE_NAME, COLUMN_NAME, COLUMN_DEFAULT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema = ?
AND DATA_TYPE = "datetime"
AND COLUMN_DEFAULT = "0000-00-00 00:00:00"
',
Bind => [ \$DatabaseName ],
);
# Collect all tables, their columns and default values like described above.
my $ErrorMessage;
while ( my @Row = $DBObject->FetchrowArray() ) {
my $Table = $Row[0];
my $Column = $Row[1];
my $Default = $Row[2];
$ErrorMessage .= "$Table ($Column) '$Default'\n";
}
if ($ErrorMessage) {
$Self->AddResultProblem(
Identifier => 'TablesWithInvalidDefaultValues',
Label => Translatable('Invalid Default Values'),
Value => $ErrorMessage,
Message => Translatable(
'Tables with invalid default values were found. In order to fix it automatically, please run: bin/otrs.Console.pl Maint::Database::Check --repair'
),
);
}
else {
$Self->AddResultOk(
Identifier => 'TablesWithInvalidDefaultValues',
Label => Translatable('Invalid Default Values'),
Value => '',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,62 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::mysql::MaxAllowedPacket;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'mysql' ) {
return $Self->GetResults();
}
$DBObject->Prepare( SQL => "show variables like 'max_allowed_packet'" );
while ( my @Row = $DBObject->FetchrowArray() ) {
if (
!$Row[1]
|| $Row[1] < 1024 * 1024 * 64
)
{
$Self->AddResultProblem(
Label => Translatable('Maximum Query Size'),
Value => $Row[1] / 1024 / 1024 . ' MB',
Message =>
Translatable("The setting 'max_allowed_packet' must be higher than 64 MB."),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Maximum Query Size'),
Value => $Row[1] / 1024 / 1024 . ' MB',
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,67 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::mysql::Performance;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'mysql' ) {
return $Self->GetResults();
}
$DBObject->Prepare( SQL => "show variables like 'query_cache_size'" );
while ( my @Row = $DBObject->FetchrowArray() ) {
if (
!$Row[1]
|| $Row[1] < 1024 * 1024 * 10
|| $Row[1] > 1024 * 1024 * 600
)
{
$Self->AddResultWarning(
Identifier => 'QueryCacheSize',
Label => Translatable('Query Cache Size'),
Value => $Row[1],
Message =>
Translatable(
"The setting 'query_cache_size' should be used (higher than 10 MB but not more than 512 MB)."
),
);
}
else {
$Self->AddResultOk(
Identifier => 'QueryCacheSize',
Label => Translatable('Query Cache Size'),
Value => $Row[1],
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,75 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::mysql::Size;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'mysql' ) {
return $Self->GetResults();
}
my $DBName;
$DBObject->Prepare(
SQL => "SELECT DATABASE()",
Limit => 1,
);
while ( my @Row = $DBObject->FetchrowArray() ) {
if ( $Row[0] ) {
$DBName = $Row[0];
}
}
$DBObject->Prepare(
SQL => "SELECT ROUND((SUM(data_length + index_length) / 1024 / 1024 / 1024),3) "
. "FROM information_schema.TABLES WHERE table_schema = ? GROUP BY table_schema",
Bind => [ \$DBName ],
Limit => 1,
);
while ( my @Row = $DBObject->FetchrowArray() ) {
if ( $Row[0] ) {
$Self->AddResultInformation(
Label => Translatable('Database Size'),
Value => "$Row[0] GB",
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Database Size'),
Value => $Row[0],
Message => Translatable('Could not determine database size.')
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,88 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::mysql::StorageEngine;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'mysql' ) {
return $Self->GetResults();
}
# Default storage engine variable has changed its name in MySQL 5.5.3, we need to support both of them for now.
# <= 5.5.2 storage_engine
# >= 5.5.3 default_storage_engine
my $DefaultStorageEngine;
$DBObject->Prepare( SQL => "show variables like 'storage_engine'" );
while ( my @Row = $DBObject->FetchrowArray() ) {
$DefaultStorageEngine = $Row[1];
}
if ( !$DefaultStorageEngine ) {
$DBObject->Prepare( SQL => "show variables like 'default_storage_engine'" );
while ( my @Row = $DBObject->FetchrowArray() ) {
$DefaultStorageEngine = $Row[1];
}
}
if ($DefaultStorageEngine) {
$Self->AddResultOk(
Identifier => 'DefaultStorageEngine',
Label => Translatable('Default Storage Engine'),
Value => $DefaultStorageEngine,
);
}
$DBObject->Prepare(
SQL => "show table status where engine != ?",
Bind => [ \$DefaultStorageEngine ],
);
my @TablesWithDifferentStorageEngine;
while ( my @Row = $DBObject->FetchrowArray() ) {
push @TablesWithDifferentStorageEngine, $Row[0];
}
if (@TablesWithDifferentStorageEngine) {
$Self->AddResultProblem(
Identifier => 'TablesWithDifferentStorageEngine',
Label => Translatable('Table Storage Engine'),
Value => join( ', ', @TablesWithDifferentStorageEngine ),
Message => Translatable('Tables with a different storage engine than the default engine were found.')
);
}
else {
$Self->AddResultOk(
Identifier => 'TablesWithDifferentStorageEngine',
Label => Translatable('Table Storage Engine'),
Value => '',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,65 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::mysql::Version;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'mysql' ) {
return $Self->GetResults();
}
# version check
my $Version = $DBObject->Version();
if ( $Version =~ /^(MySQL|MariaDB) (\d{1,3})\.(\d{1,3}).*/ ) {
if ( $2 >= 5 ) {
$Self->AddResultOk(
Label => Translatable('Database Version'),
Value => $Version,
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Database Version'),
Value => $Version,
Message => Translatable("MySQL 5.x or higher is required."),
);
}
}
else {
$Self->AddResultProblem(
Label => Translatable('Database Version'),
Value => $Version,
Message => Translatable("Could not determine database version."),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,100 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::oracle::NLS;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'oracle' ) {
return $Self->GetResults();
}
if ( $ENV{NLS_LANG} && $ENV{NLS_LANG} =~ m/al32utf-?8/i ) {
$Self->AddResultOk(
Identifier => 'NLS_LANG',
Label => Translatable('NLS_LANG Setting'),
Value => $ENV{NLS_LANG},
);
}
else {
$Self->AddResultProblem(
Identifier => 'NLS_LANG',
Label => Translatable('NLS_LANG Setting'),
Value => $ENV{NLS_LANG},
Message => Translatable('NLS_LANG must be set to al32utf8 (e.g. GERMAN_GERMANY.AL32UTF8).'),
);
}
if ( $ENV{NLS_DATE_FORMAT} && $ENV{NLS_DATE_FORMAT} eq "YYYY-MM-DD HH24:MI:SS" ) {
$Self->AddResultOk(
Identifier => 'NLS_DATE_FORMAT',
Label => Translatable('NLS_DATE_FORMAT Setting'),
Value => $ENV{NLS_DATE_FORMAT},
);
}
else {
$Self->AddResultProblem(
Identifier => 'NLS_DATE_FORMAT',
Label => Translatable('NLS_DATE_FORMAT Setting'),
Value => $ENV{NLS_DATE_FORMAT},
Message => Translatable("NLS_DATE_FORMAT must be set to 'YYYY-MM-DD HH24:MI:SS'."),
);
}
my $CreateTime;
$DBObject->Prepare(
SQL => "SELECT create_time FROM valid",
Limit => 1
);
while ( my @Row = $DBObject->FetchrowArray() ) {
$CreateTime = $Row[0];
}
if (
$CreateTime
&& $CreateTime =~ /^\d\d\d\d-(\d|\d\d)-(\d|\d\d)\s(\d|\d\d):(\d|\d\d):(\d|\d\d)/
)
{
$Self->AddResultOk(
Identifier => 'NLS_DATE_FORMAT_SELECT',
Label => Translatable('NLS_DATE_FORMAT Setting SQL Check'),
Value => $ENV{NLS_DATE_FORMAT}, # use environment variable to avoid different values
);
}
else {
$Self->AddResultProblem(
Identifier => 'NLS_DATE_FORMAT_SELECT',
Label => Translatable('NLS_DATE_FORMAT Setting SQL Check'),
Value => $CreateTime,
Message => Translatable("NLS_DATE_FORMAT must be set to 'YYYY-MM-DD HH24:MI:SS'."),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,135 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::oracle::PrimaryKeySequencesAndTriggers;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'oracle' ) {
return $Self->GetResults();
}
# Get all table names.
my @Tables = $DBObject->ListTables();
my %SequenceNameFromTableName;
for my $TableName (@Tables) {
my $Sequence = $DBObject->{Backend}->_SequenceName(
TableName => $TableName,
);
# Convert to lower case.
$Sequence = lc $Sequence;
$SequenceNameFromTableName{$Sequence} = 1;
}
# Get all sequence names.
$DBObject->Prepare(
SQL => 'SELECT sequence_name FROM user_sequences',
);
my @SequenceNames;
while ( my @Row = $DBObject->FetchrowArray() ) {
# Convert to lower case.
push @SequenceNames, lc $Row[0];
}
my @WrongSequenceNames;
SEQUENCE:
for my $SequenceName (@SequenceNames) {
next SEQUENCE if $SequenceNameFromTableName{$SequenceName};
# Remember wrong sequence name.
push @WrongSequenceNames, $SequenceName;
}
# Get all trigger names.
$DBObject->Prepare(
SQL => 'SELECT trigger_name FROM user_triggers',
);
my @TriggerNames;
while ( my @Row = $DBObject->FetchrowArray() ) {
# Convert to lower case.
push @TriggerNames, lc $Row[0];
}
my @WrongTriggerNames;
TRIGGER:
for my $TriggerName (@TriggerNames) {
my $SequenceName = $TriggerName;
# Remove the last part of the sequence name.
$SequenceName =~ s{ _t \z }{}xms;
next TRIGGER if $SequenceNameFromTableName{$SequenceName};
# Remember wrong trigger name.
push @WrongTriggerNames, $TriggerName;
}
my $Error;
if (@WrongSequenceNames) {
$Error .= "Seqences:\n";
$Error .= join "\n", @WrongSequenceNames;
$Error .= "\n\n";
}
if (@WrongTriggerNames) {
$Error .= "Triggers:\n";
$Error .= join "\n", @WrongTriggerNames;
$Error .= "\n\n";
}
if ($Error) {
$Self->AddResultProblem(
Identifier => 'PrimaryKeySequencesAndTriggers',
Label => Translatable('Primary Key Sequences and Triggers'),
Value => $Error,
Message => Translatable(
'The following sequences and/or triggers with possible wrong names have been found. Please rename them manually.'
),
);
}
else {
$Self->AddResultOk(
Identifier => 'PrimaryKeySequencesAndTriggers',
Label => Translatable('Primary Key Sequences and Triggers'),
Value => '',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,56 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::oracle::Version;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') ne 'oracle' ) {
return $Self->GetResults();
}
# version check
my $Version = $DBObject->Version();
if ($Version) {
$Self->AddResultInformation(
Label => Translatable('Database Version'),
Value => $Version,
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Database Version'),
Value => $Version,
Message => Translatable("Could not determine database version."),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,77 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::postgresql::Charset;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') !~ m{^postgresql} ) {
return $Self->GetResults();
}
$DBObject->Prepare( SQL => 'show client_encoding' );
while ( my @Row = $DBObject->FetchrowArray() ) {
if ( $Row[0] =~ /(UNICODE|utf-?8)/i ) {
$Self->AddResultOk(
Identifier => 'ClientEncoding',
Label => Translatable('Client Connection Charset'),
Value => $Row[0],
);
}
else {
$Self->AddResultProblem(
Identifier => 'ClientEncoding',
Label => Translatable('Client Connection Charset'),
Value => $Row[0],
Message => Translatable('Setting client_encoding needs to be UNICODE or UTF8.'),
);
}
}
$DBObject->Prepare( SQL => 'show server_encoding' );
while ( my @Row = $DBObject->FetchrowArray() ) {
if ( $Row[0] =~ /(UNICODE|utf-?8)/i ) {
$Self->AddResultOk(
Identifier => 'ServerEncoding',
Label => Translatable('Server Database Charset'),
Value => $Row[0],
);
}
else {
$Self->AddResultProblem(
Identifier => 'ServerEncoding',
Label => Translatable('Server Database Charset'),
Value => $Row[0],
Message => Translatable('Setting server_encoding needs to be UNICODE or UTF8.'),
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,56 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::postgresql::DateStyle;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') !~ m{^postgresql} ) {
return $Self->GetResults();
}
$DBObject->Prepare( SQL => 'show DateStyle' );
while ( my @Row = $DBObject->FetchrowArray() ) {
if ( $Row[0] =~ /^ISO/i ) {
$Self->AddResultOk(
Label => Translatable('Date Format'),
Value => $Row[0],
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Date Format'),
Value => $Row[0],
Message => Translatable('Setting DateStyle needs to be ISO.'),
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,101 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::postgresql::PrimaryKeySequences;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') !~ m{^postgresql} ) {
return $Self->GetResults();
}
# Get all table names.
my @Tables = $DBObject->ListTables();
my %SequenceNameFromTableName;
for my $TableName (@Tables) {
my $Sequence = $DBObject->{Backend}->_SequenceName(
TableName => $TableName,
);
# Special handling for a table with no id column but with a object_id column.
if ( $TableName eq 'dynamic_field_obj_id_name' ) {
$Sequence = 'dynamic_field_obj_id_name_object_id_seq';
}
# Convert to lower case.
$Sequence = lc $Sequence;
$SequenceNameFromTableName{$Sequence} = 1;
}
# Get all sequence names.
$DBObject->Prepare(
SQL => "SELECT relname FROM pg_class WHERE relkind = 'S'",
);
my @SequenceNames;
while ( my @Row = $DBObject->FetchrowArray() ) {
push @SequenceNames, lc $Row[0];
}
my @WrongSequenceNames;
SEQUENCE:
for my $SequenceName (@SequenceNames) {
next SEQUENCE if $SequenceNameFromTableName{$SequenceName};
# Remember wrong sequence name.
push @WrongSequenceNames, $SequenceName;
}
if (@WrongSequenceNames) {
my $Error = join "\n", @WrongSequenceNames;
$Error .= "\n";
$Self->AddResultProblem(
Identifier => 'PrimaryKeySequences',
Label => Translatable('Primary Key Sequences'),
Value => $Error,
Message => Translatable(
'The following sequences with possible wrong names have been found. Please rename them manually.'
),
);
}
else {
$Self->AddResultOk(
Identifier => 'PrimaryKeySequences',
Label => Translatable('Primary Key Sequences'),
Value => '',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,61 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::postgresql::Size;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') !~ m{^postgresql} ) {
return $Self->GetResults();
}
# version check
$DBObject->Prepare(
SQL => "SELECT pg_size_pretty(pg_database_size(current_database()))",
LIMIT => 1,
);
while ( my @Row = $DBObject->FetchrowArray() ) {
if ( $Row[0] ) {
$Self->AddResultInformation(
Label => Translatable('Database Size'),
Value => $Row[0],
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Database Size'),
Value => $Row[0],
Message => Translatable('Could not determine database size.')
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,64 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Database::postgresql::Version;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('Database');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $DBObject->GetDatabaseFunction('Type') !~ m{^postgresql} ) {
return $Self->GetResults();
}
my $Version = $DBObject->Version();
my ( $VersionMajor, $VersionMinor ) = $Version =~ m/^PostgreSQL \s+ (\d{1,3}) \. (\d{1,3})/ismx;
if ($VersionMajor) {
if ( sprintf( '%03d%03d', $VersionMajor, $VersionMinor ) >= 9_002 ) {
$Self->AddResultOk(
Label => Translatable('Database Version'),
Value => $Version,
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Database Version'),
Value => $Version,
Message => Translatable('PostgreSQL 9.2 or higher is required.')
);
}
}
else {
$Self->AddResultProblem(
Label => Translatable('Database Version'),
Value => $Version,
Message => Translatable('Could not determine database version.')
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,48 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OS::DiskPartitionOTRS;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('Operating System');
}
sub Run {
my $Self = shift;
# Check if used OS is a linux system
if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
return $Self->GetResults();
}
# find OTRS partition
my $Home = $Kernel::OM->Get('Kernel::Config')->Get('Home');
my $OTRSPartition = `df -P $Home | tail -1 | cut -d' ' -f 1`;
chomp $OTRSPartition;
$Self->AddResultInformation(
Label => Translatable('OTRS Disk Partition'),
Value => $OTRSPartition,
);
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,99 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OS::DiskSpace;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('Operating System');
}
sub Run {
my $Self = shift;
# This plugin is temporary disabled
# A new logic is required to calculate the space
# TODO: fix
return $Self->GetResults();
# # Check if used OS is a linux system
# if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
# return $Self->GetResults();
# }
#
# # find OTRS partition
# my $Home = $Kernel::OM->Get('Kernel::Config')->Get('Home');
#
# my $OTRSPartition = `df -P $Home | tail -1 | cut -d' ' -f 1`;
# chomp $OTRSPartition;
#
# my $Commandline = "df -lx tmpfs -x iso9660 -x udf -x squashfs";
#
# # current MacOS and FreeBSD does not support the -x flag for df
# if ( $^O =~ /(darwin|freebsd)/i ) {
# $Commandline = "df -l";
# }
#
# my $In;
# if ( open( $In, "-|", "$Commandline" ) ) {
#
# my ( @ProblemPartitions, $StatusProblem );
#
# # TODO change from percent to megabytes used.
# while (<$In>) {
# if ( $_ =~ /^$OTRSPartition\s.*/ && $_ =~ /^(.+?)\s.*\s(\d+)%.+?$/ ) {
# my ( $Partition, $UsedPercent ) = $_ =~ /^(.+?)\s.*?\s(\d+)%.+?$/;
# if ( $UsedPercent > 90 ) {
# push @ProblemPartitions, "$Partition \[$UsedPercent%\]";
# $StatusProblem = 1;
# }
# elsif ( $UsedPercent > 80 ) {
# push @ProblemPartitions, "$Partition \[$UsedPercent%\]";
# }
# }
# }
# close($In);
# if (@ProblemPartitions) {
# if ($StatusProblem) {
# $Self->AddResultProblem(
# Label => Translatable('Disk Usage'),
# Value => join( ', ', @ProblemPartitions ),
# Message => Translatable('The partition where OTRS is located is almost full.'),
# );
# }
# else {
# $Self->AddResultWarning(
# Label => Translatable('Disk Usage'),
# Value => join( ', ', @ProblemPartitions ),
# Message => Translatable('The partition where OTRS is located is almost full.'),
# );
# }
# }
# else {
# $Self->AddResultOk(
# Label => Translatable('Disk Usage'),
# Value => '',
# Message => Translatable('The partition where OTRS is located has no disk space problems.'),
# );
# }
# }
#
# return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,111 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OS::DiskSpacePartitions;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = ();
sub GetDisplayPath {
return Translatable('Operating System') . '/' . Translatable('Disk Partitions Usage');
}
sub Run {
my $Self = shift;
# Check if used OS is a Linux system
if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
return $Self->GetResults();
}
my $Commandline = "df -lHx tmpfs -x iso9660 -x udf -x squashfs";
# current MacOS and FreeBSD does not support the -x flag for df
if ( $^O =~ /(darwin|freebsd)/i ) {
$Commandline = "df -lH";
}
# run the command an store the result on an array
my @Lines;
if ( open( my $In, "-|", "$Commandline" ) ) {
@Lines = <$In>;
close($In);
}
# clean results, in some systems when partition is too long it splits the line in two, it is
# needed to have all partition information in just one line for example
# From:
# /dev/mapper/system-tmp
# 2064208 85644 1873708 5% /tmp
# To:
# /dev/mapper/system-tmp 2064208 85644 1873708 5% /tmp
my @CleanLines;
my $PreviousLine;
LINE:
for my $Line (@Lines) {
chomp $Line;
# if line does not have percent number (then it should only contain the partition)
if ( $Line !~ m{\d+%} ) {
# remember the line
$PreviousLine = $Line;
next LINE;
}
# if line starts with just spaces and have a percent number
elsif ( $Line =~ m{\A \s+ (?: \d+ | \s+)+ \d+ % .+? \z}msx ) {
# concatenate previous line and store it
push @CleanLines, $PreviousLine . $Line;
$PreviousLine = '';
next LINE;
}
# otherwise store the line as it is
push @CleanLines, $Line;
$PreviousLine = '';
}
my %SeenPartitions;
LINE:
for my $Line (@CleanLines) {
# remove leading white spaces in line
$Line =~ s{\A\s+}{};
if ( $Line =~ m{\A .+? \s .* \s \d+ % .+? \z}msx ) {
my ( $Partition, $Size, $UsedPercent, $MountPoint )
= $Line =~ m{\A (.+?) \s+ ([\d\.KGMT]*) \s+ .*? \s+ (\d+)%.+? (\/.*) \z}msx;
$MountPoint //= '';
$Partition = "$MountPoint ($Partition)";
next LINE if $SeenPartitions{$Partition}++;
$Self->AddResultInformation(
Identifier => $Partition,
Label => $Partition,
Value => $Size . ' (Used: ' . $UsedPercent . '%)',
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,49 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OS::Distribution;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::Environment',
);
sub GetDisplayPath {
return Translatable('Operating System');
}
sub Run {
my $Self = shift;
my %OSInfo = $Kernel::OM->Get('Kernel::System::Environment')->OSInfoGet();
# if OSname starts with Unknown, test was not successful
if ( $OSInfo{OSName} =~ /\A Unknown /xms ) {
$Self->AddResultProblem(
Label => Translatable('Distribution'),
Value => $OSInfo{OSName},
Message => Translatable('Could not determine distribution.')
);
}
else {
$Self->AddResultInformation(
Label => Translatable('Distribution'),
Value => $OSInfo{OSName},
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,61 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OS::KernelVersion;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = ();
sub GetDisplayPath {
return Translatable('Operating System');
}
sub Run {
my $Self = shift;
# Check if used OS is a linux system
if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
return $Self->GetResults();
}
my $KernelVersion = "";
my $KernelInfo;
if ( open( $KernelInfo, "-|", "uname -a" ) ) {
while (<$KernelInfo>) {
$KernelVersion .= $_;
}
close($KernelInfo);
if ($KernelVersion) {
$KernelVersion =~ s/^\s+|\s+$//g;
}
}
if ($KernelVersion) {
$Self->AddResultInformation(
Label => Translatable('Kernel Version'),
Value => $KernelVersion,
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Kernel Version'),
Value => $KernelVersion,
Value => Translatable('Could not determine kernel version.'),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,74 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OS::Load;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = ();
sub GetDisplayPath {
return Translatable('Operating System');
}
sub Run {
my $Self = shift;
# Check if used OS is a linux system
if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
return $Self->GetResults();
}
my @Loads;
# If used OS is a linux system
if ( $^O =~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
# linux systems
if ( -e "/proc/loadavg" ) {
my $LoadFile;
open( $LoadFile, '<', "/proc/loadavg" ); ## no critic
while (<$LoadFile>) {
@Loads = split( " ", $_ );
}
close($LoadFile);
}
# mac os
elsif ( $^O =~ /darwin/i ) {
if ( open( my $In, "-|", "sysctl vm.loadavg" ) ) { ## no critic
while (<$In>) {
if ( my ($Loads) = $_ =~ /vm\.loadavg: \s* \{ \s* (.*) \s* \}/smx ) {
@Loads = split ' ', $Loads;
}
}
close $In;
}
}
if (@Loads) {
$Self->AddResultInformation(
Label => Translatable('System Load'),
Value => $Loads[2],
Message =>
Translatable(
'The system load should be at maximum the number of CPUs the system has (e.g. a load of 8 or less on a system with 8 CPUs is OK).'
),
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,60 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OS::PerlModules;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('Operating System');
}
sub Run {
my $Self = shift;
my $Home = $Kernel::OM->Get('Kernel::Config')->Get('Home');
my $Output;
open( my $FH, "-|", "perl $Home/bin/otrs.CheckModules.pl nocolors --all" );
while (<$FH>) {
$Output .= $_;
}
close($FH);
if (
$Output =~ m{Not \s installed! \s \(required}ismx
|| $Output =~ m{failed!}ismx
)
{
$Self->AddResultProblem(
Label => Translatable('Perl Modules'),
Value => $Output,
Message => Translatable('Not all required Perl modules are correctly installed.'),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Perl Modules'),
Value => $Output,
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,61 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OS::PerlModulesAudit;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::Console::Command::Dev::Code::CPANAudit',
'Kernel::System::Log',
);
sub GetDisplayPath {
return Translatable('Operating System');
}
sub Run {
my $Self = shift;
my $CommandObject = $Kernel::OM->Get('Kernel::System::Console::Command::Dev::Code::CPANAudit');
my ( $CommandOutput, $ExitCode );
{
local *STDOUT;
open STDOUT, '>:utf8', \$CommandOutput; ## no critic
$ExitCode = $CommandObject->Execute();
}
if ( $ExitCode != 0 ) {
$Self->AddResultWarning(
Label => Translatable('Perl Modules Audit'),
Value => $CommandOutput,
Message => Translatable(
'CPAN::Audit reported that one or more installed Perl modules have known vulnerabilities. Please note that there might be false positives for distributions patching Perl modules without changing their version number.'
),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Perl Modules Audit'),
Value => '',
Message =>
Translatable('CPAN::Audit did not report any known vulnerabilities in the installed Perl modules.'),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,40 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OS::PerlVersion;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::Main',
);
sub GetDisplayPath {
return Translatable('Operating System');
}
sub Run {
my $Self = shift;
my $Version = sprintf "%vd", $^V;
my $OS = $^O;
$Self->AddResultInformation(
Label => Translatable('Perl Version'),
Value => "$Version ($OS)",
);
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,116 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OS::Swap;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = ();
sub GetDisplayPath {
return Translatable('Operating System');
}
sub Run {
my $Self = shift;
# Check if used OS is a linux system
if ( $^O !~ /(linux|unix|netbsd|freebsd|darwin)/i ) {
return $Self->GetResults();
}
my $MemInfoFile;
my ( $MemTotal, $MemFree, $SwapTotal, $SwapFree );
# If used OS is a linux system
if ( -e "/proc/meminfo" && open( $MemInfoFile, '<', "/proc/meminfo" ) ) { ## no critic
while (<$MemInfoFile>) {
my $TmpLine = $_;
if ( $TmpLine =~ /MemTotal/ ) {
$TmpLine =~ s/^.*?(\d+).*$/$1/;
$MemTotal = int($TmpLine);
}
elsif ( $TmpLine =~ /MemFree/ ) {
$TmpLine =~ s/^.*?(\d+).*$/$1/;
$MemFree = int($TmpLine);
}
elsif ( $TmpLine =~ /SwapTotal/ ) {
$TmpLine =~ s/^.*?(\d+).*$/$1/;
$SwapTotal = int($TmpLine);
}
elsif ( $TmpLine =~ /SwapFree/ ) {
$TmpLine =~ s/^.*?(\d+).*$/$1/;
$SwapFree = int($TmpLine);
}
}
close($MemInfoFile);
}
if ($MemTotal) {
if ( !$SwapTotal ) {
$Self->AddResultProblem(
Identifier => 'SwapFree',
Label => Translatable('Free Swap Space (%)'),
Value => 0,
Message => Translatable('No swap enabled.'),
);
$Self->AddResultProblem(
Identifier => 'SwapUsed',
Label => Translatable('Used Swap Space (MB)'),
Value => 0,
Message => Translatable('No swap enabled.'),
);
}
else {
my $SwapFreeRelative = int( $SwapFree / $SwapTotal * 100 );
if ( $SwapFreeRelative < 60 ) {
$Self->AddResultProblem(
Identifier => 'SwapFree',
Label => Translatable('Free Swap Space (%)'),
Value => $SwapFreeRelative,
Message => Translatable('There should be more than 60% free swap space.'),
);
}
else {
$Self->AddResultOk(
Identifier => 'SwapFree',
Label => Translatable('Free Swap Space (%)'),
Value => $SwapFreeRelative,
);
}
my $SwapUsed = ( $SwapTotal - $SwapFree ) / 1024;
if ( $SwapUsed > 200 ) {
$Self->AddResultProblem(
Identifier => 'SwapUsed',
Label => Translatable('Used Swap Space (MB)'),
Value => $SwapUsed,
Message => Translatable('There should be no more than 200 MB swap space used.'),
);
}
else {
$Self->AddResultOk(
Identifier => 'SwapUsed',
Label => Translatable('Used Swap Space (MB)'),
Value => $SwapUsed,
);
}
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,48 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::ArticleSearchIndexStatus;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::Ticket::Article',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('Article Search Index Status');
}
sub Run {
my $Self = shift;
my %Status = $Kernel::OM->Get('Kernel::System::Ticket::Article')->ArticleSearchIndexStatus();
my $Percentage;
if ( $Status{ArticlesIndexed} == 0 || $Status{ArticlesTotal} == 0 ) {
$Percentage = 0;
}
else {
$Percentage = $Status{ArticlesIndexed} / $Status{ArticlesTotal} * 100;
}
$Self->AddResultInformation(
Label => Translatable('Indexed Articles'),
Value => sprintf( '%.1f %% (%d/%d)', $Percentage, $Status{ArticlesIndexed}, $Status{ArticlesTotal} ),
);
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,54 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::ArticlesPerCommunicationChannel;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::CommunicationChannel',
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('Articles Per Communication Channel');
}
sub Run {
my $Self = shift;
my @Channels = $Kernel::OM->Get('Kernel::System::CommunicationChannel')->ChannelList();
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
for my $Channel (@Channels) {
$DBObject->Prepare(
SQL => 'SELECT count(*) FROM article WHERE communication_channel_id = ?',
Bind => [ \$Channel->{ChannelID} ],
);
my $Count;
while ( my @Row = $DBObject->FetchrowArray() ) {
$Count = $Row[0];
}
$Self->AddResultInformation(
Identifier => $Channel->{ChannelName},
Label => $Channel->{DisplayName},
Value => $Count,
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,79 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::CommunicationLog;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::CommunicationLog',
'Kernel::System::CommunicationLog::DB',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('Communication Log');
}
sub Run {
my $Self = shift;
my $CommunicationLogDBObj = $Kernel::OM->Get('Kernel::System::CommunicationLog::DB');
my @CommunicationList = @{ $CommunicationLogDBObj->CommunicationList() || [] };
my %CommunicationData = (
All => 0,
Successful => 0,
Processing => 0,
Failed => 0,
Incoming => 0,
Outgoing => 0,
);
for my $Communication (@CommunicationList) {
$CommunicationData{All}++;
$CommunicationData{ $Communication->{Status} }++;
$CommunicationData{ $Communication->{Direction} }++;
}
my $CommunicationAverageSeconds = $CommunicationLogDBObj->CommunicationList( Result => 'AVERAGE' );
$Self->AddResultInformation(
Identifier => 'Incoming',
Label => Translatable('Incoming communications'),
Value => $CommunicationData{Incoming},
);
$Self->AddResultInformation(
Identifier => 'Outgoing',
Label => Translatable('Outgoing communications'),
Value => $CommunicationData{Outgoing},
);
$Self->AddResultInformation(
Identifier => 'Failed',
Label => Translatable('Failed communications'),
Value => $CommunicationData{Failed}
);
my $Mask = "%.0f";
if ( $CommunicationAverageSeconds < 10 ) {
$Mask = "%.1f";
}
$Self->AddResultInformation(
Identifier => 'AverageProcessingTime',
Label => Translatable('Average processing time of communications (s)'),
Value => sprintf( $Mask, $CommunicationAverageSeconds ),
);
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,139 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::CommunicationLogAccountStatus;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::System::VariableCheck qw(:all);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::CommunicationLog::DB',
'Kernel::System::DateTime',
'Kernel::System::MailAccount',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('Communication Log Account Status (last 24 hours)');
}
sub Run {
my $Self = shift;
my $CommunicationLogDBObj = $Kernel::OM->Get('Kernel::System::CommunicationLog::DB');
my $DateTime = $Kernel::OM->Create('Kernel::System::DateTime');
$DateTime->Subtract( Days => 1 );
my $Connections = $CommunicationLogDBObj->GetConnectionsObjectsAndCommunications(
ObjectLogStartDate => $DateTime->ToString(),
);
if ( !$Connections || !@{$Connections} ) {
$Self->AddResultInformation(
Identifier => 'NoConnections',
Label => Translatable('No connections found.'),
);
return $Self->GetResults();
}
my %Account;
CONNECTION:
for my $Connection ( @{$Connections} ) {
next CONNECTION if !$Connection->{AccountType};
my $AccountKey = $Connection->{AccountType};
if ( $Connection->{AccountID} ) {
$AccountKey .= "::$Connection->{AccountID}";
}
if ( !$Account{$AccountKey} ) {
$Account{$AccountKey} = {
AccountID => $Connection->{AccountID},
AccountType => $Connection->{AccountType},
};
}
$Account{$AccountKey}->{ $Connection->{ObjectLogStatus} } ||= [];
push @{ $Account{$AccountKey}->{ $Connection->{ObjectLogStatus} } }, $Connection->{CommunicationID};
}
my @AllMailAccounts = $Kernel::OM->Get('Kernel::System::MailAccount')->MailAccountGetAll();
my %MailAccounts = map { $_->{ID} ? ( "$_->{Type}::$_->{ID}" => $_ ) : ( $_->{Type} => $_ ) } @AllMailAccounts;
for my $AccountKey ( sort keys %Account ) {
my $HealthStatus = $Self->_CheckHealth( $Account{$AccountKey} );
my $AccountLabel = $Account{$AccountKey}->{AccountType};
if ( $Account{$AccountKey}->{AccountID} && $MailAccounts{$AccountKey} ) {
my $MailAccount = $MailAccounts{$AccountKey};
$AccountLabel = "$MailAccount->{Host} / $MailAccount->{Login} ($Account{$AccountKey}->{AccountType})";
}
elsif ( $Account{$AccountKey}->{AccountID} ) {
$AccountLabel = $AccountKey;
}
if ( $HealthStatus eq 'Success' ) {
$Self->AddResultOk(
Identifier => $AccountKey,
Label => $AccountLabel,
Value => Translatable('ok'),
);
}
elsif ( $HealthStatus eq 'Failed' ) {
$Self->AddResultProblem(
Identifier => $AccountKey,
Label => $AccountLabel,
Value => Translatable('permanent connection errors'),
);
}
elsif ( $HealthStatus eq 'Warning' ) {
$Self->AddResultWarning(
Identifier => $AccountKey,
Label => $AccountLabel,
Value => Translatable('intermittent connection errors'),
);
}
}
return $Self->GetResults();
}
sub _CheckHealth {
my ( $Self, $Connections ) = @_;
# Success if all is Successful;
# Failed if all is Failed;
# Warning if has both Successful and Failed Connections;
my $Health = 'Success';
if ( IsArrayRefWithData( $Connections->{Failed} ) ) {
$Health = 'Failed';
if ( IsArrayRefWithData( $Connections->{Successful} ) ) {
$Health = 'Warning';
}
}
return $Health;
}
1;

View File

@@ -0,0 +1,82 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::ConfigSettings;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('Config Settings');
}
sub Run {
my $Self = shift;
my @Settings = (
'Home',
'FQDN',
'HttpType',
'DefaultLanguage',
'SystemID',
'Version',
'ProductName',
'Organization',
'OTRSTimeZone',
'Ticket::IndexModule',
'Ticket::SearchIndexModule',
'Ticket::Article::Backend::MIMEBase::ArticleStorage',
'SendmailModule',
'Frontend::RichText',
'Frontend::AvatarEngine',
'Loader::Agent::DefaultSelectedSkin',
'Loader::Customer::SelectedSkin',
);
# get config object
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
for my $Setting (@Settings) {
my $ConfigValue = $ConfigObject->Get($Setting);
if ( $Setting =~ m{###} ) {
my ( $Name, $SubKey ) = $Setting =~ m{(.*)###(.*)};
$ConfigValue = $ConfigObject->Get($Name);
$ConfigValue = $ConfigValue->{$SubKey} if ref $ConfigValue eq 'HASH';
}
if ( defined $ConfigValue ) {
$Self->AddResultInformation(
Identifier => $Setting,
Label => $Setting,
Value => $ConfigValue,
);
}
else {
$Self->AddResultProblem(
Identifier => $Setting,
Label => $Setting,
Value => $ConfigValue,
Message => Translatable('Could not determine value.'),
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,62 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::DaemonRunning;
use strict;
use warnings;
use Kernel::System::ObjectManager;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::Cache',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
# get config object
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# get the NodeID from the SysConfig settings, this is used on High Availability systems.
my $NodeID = $ConfigObject->Get('NodeID') || 1;
# get running daemon cache
my $Running = $Kernel::OM->Get('Kernel::System::Cache')->Get(
Type => 'DaemonRunning',
Key => $NodeID,
);
if ($Running) {
$Self->AddResultOk(
Label => Translatable('Daemon'),
Value => 1,
Message => Translatable('Daemon is running.'),
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Daemon'),
Value => 0,
Message => Translatable('Daemon is not running.'),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,208 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::DatabaseRecords;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::DB',
'Kernel::System::Ticket',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('Database Records');
}
sub Run {
my $Self = shift;
my @Checks = (
{
SQL => "SELECT count(*) FROM ticket",
Identifier => 'TicketCount',
Label => Translatable("Tickets"),
},
{
SQL => "SELECT count(*) FROM ticket_history",
Identifier => 'TicketHistoryCount',
Label => Translatable("Ticket History Entries"),
},
{
SQL => "SELECT count(*) FROM article",
Identifier => 'ArticleCount',
Label => Translatable("Articles"),
},
{
SQL =>
"SELECT count(*) from article_data_mime_attachment WHERE content_type NOT LIKE 'text/html%'",
Identifier => 'AttachmentCountDBNonHTML',
Label => Translatable("Attachments (DB, Without HTML)"),
},
{
SQL => "SELECT count(DISTINCT(customer_user_id)) FROM ticket",
Identifier => 'DistinctTicketCustomerCount',
Label => Translatable("Customers With At Least One Ticket"),
},
{
SQL => "SELECT count(*) FROM queue",
Identifier => 'QueueCount',
Label => Translatable("Queues"),
},
{
SQL => "SELECT count(*) FROM service",
Identifier => 'ServiceCount',
Label => Translatable("Services"),
},
{
SQL => "SELECT count(*) FROM users",
Identifier => 'AgentCount',
Label => Translatable("Agents"),
},
{
SQL => "SELECT count(*) FROM roles",
Identifier => 'RoleCount',
Label => Translatable("Roles"),
},
{
SQL => "SELECT count(*) FROM groups",
Identifier => 'GroupCount',
Label => Translatable("Groups"),
},
{
SQL => "SELECT count(*) FROM dynamic_field",
Identifier => 'DynamicFieldCount',
Label => Translatable("Dynamic Fields"),
},
{
SQL => "SELECT count(*) FROM dynamic_field_value",
Identifier => 'DynamicFieldValueCount',
Label => Translatable("Dynamic Field Values"),
},
{
SQL => "SELECT count(*) FROM dynamic_field WHERE valid_id > 1",
Identifier => 'InvalidDynamicFieldCount',
Label => Translatable("Invalid Dynamic Fields"),
},
{
SQL => "
SELECT count(*)
FROM dynamic_field_value
JOIN dynamic_field ON dynamic_field.id = dynamic_field_value.field_id
WHERE dynamic_field.valid_id > 1",
Identifier => 'InvalidDynamicFieldValueCount',
Label => Translatable("Invalid Dynamic Field Values"),
},
{
SQL => "SELECT count(*) FROM gi_webservice_config",
Identifier => 'WebserviceCount',
Label => Translatable("GenericInterface Webservices"),
},
{
SQL => "SELECT count(*) FROM pm_process",
Identifier => 'ProcessCount',
Label => Translatable("Processes"),
},
{
SQL => "
SELECT count(*)
FROM dynamic_field df
LEFT JOIN dynamic_field_value dfv ON df.id = dfv.field_id
RIGHT JOIN ticket t ON t.id = dfv.object_id
WHERE df.name = '"
. $Kernel::OM->Get('Kernel::Config')->Get("Process::DynamicFieldProcessManagementProcessID") . "'",
Identifier => 'ProcessTickets',
Label => Translatable("Process Tickets"),
},
);
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
my %Counts;
CHECK_RECORDS:
for my $Check (@Checks) {
$DBObject->Prepare( SQL => $Check->{SQL} );
while ( my @Row = $DBObject->FetchrowArray() ) {
$Counts{ $Check->{Identifier} } = $Row[0];
}
if ( defined $Counts{ $Check->{Identifier} } ) {
$Self->AddResultInformation(
Identifier => $Check->{Identifier},
Label => $Check->{Label},
Value => $Counts{ $Check->{Identifier} },
);
}
else {
$Self->AddResultProblem(
Identifier => $Check->{Identifier},
Label => $Check->{Label},
Value => $Counts{ $Check->{Identifier} },
Message => Translatable('Could not determine value.'),
);
}
}
$DBObject->Prepare(
SQL => "SELECT max(create_time), min(create_time) FROM ticket WHERE id > 1 ",
);
my $TicketWindowTime = 1;
while ( my @Row = $DBObject->FetchrowArray() ) {
if ( $Row[0] && $Row[1] ) {
my $OldestCreateTimeObject = $Kernel::OM->Create(
'Kernel::System::DateTime',
ObjectParams => {
String => $Row[0],
},
);
my $NewestCreateTimeObject = $Kernel::OM->Create(
'Kernel::System::DateTime',
ObjectParams => {
String => $Row[1],
},
);
my $Delta = $NewestCreateTimeObject->Delta( DateTimeObject => $OldestCreateTimeObject );
$TicketWindowTime = ( $Delta->{Years} * 12 ) + $Delta->{Months};
}
}
$TicketWindowTime = 1 if $TicketWindowTime < 1;
$Self->AddResultInformation(
Identifier => 'TicketWindowTime',
Label => Translatable('Months Between First And Last Ticket'),
Value => $TicketWindowTime,
);
$Self->AddResultInformation(
Identifier => 'TicketsPerMonth',
Label => Translatable('Tickets Per Month (avg)'),
Value => sprintf( "%d", $Counts{TicketCount} / $TicketWindowTime ),
);
my $OpenTickets = $Kernel::OM->Get('Kernel::System::Ticket')->TicketSearch(
Result => 'COUNT',
StateType => 'Open',
UserID => 1,
) || 0;
$Self->AddResultInformation(
Identifier => 'TicketOpenCount',
Label => Translatable('Open Tickets'),
Value => $OpenTickets,
);
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,55 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::DefaultSOAPUser;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
# get config object
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
my $SOAPUser = $ConfigObject->Get('SOAP::User') || '';
my $SOAPPassword = $ConfigObject->Get('SOAP::Password') || '';
if ( $SOAPUser eq 'some_user' && ( $SOAPPassword eq 'some_pass' || $SOAPPassword eq '' ) ) {
$Self->AddResultProblem(
Label => Translatable('Default SOAP Username And Password'),
Value => '',
Message =>
Translatable(
'Security risk: you use the default setting for SOAP::User and SOAP::Password. Please change it.'
),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Default SOAP Username And Password'),
Value => '',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,79 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::DefaultUser;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::Auth',
'Kernel::System::Group',
'Kernel::System::User',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
# get needed objects
my $UserObject = $Kernel::OM->Get('Kernel::System::User');
my $GroupObject = $Kernel::OM->Get('Kernel::System::Group');
my %UserList = $UserObject->UserList(
Type => 'Short',
Valid => '1',
);
my $DefaultPassword;
my $SuperUserID;
USER:
for my $UserID ( sort keys %UserList ) {
if ( $UserList{$UserID} eq 'root@localhost' ) {
$SuperUserID = 1;
last USER;
}
}
if ($SuperUserID) {
$DefaultPassword = $Kernel::OM->Get('Kernel::System::Auth')->Auth(
User => 'root@localhost',
Pw => 'root',
);
}
if ($DefaultPassword) {
$Self->AddResultProblem(
Label => Translatable('Default Admin Password'),
Value => '',
Message =>
Translatable(
'Security risk: the agent account root@localhost still has the default password. Please change it or invalidate the account.'
),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Default Admin Password'),
Value => '',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,42 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::EmailQueue;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::MailQueue',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('Email Sending Queue');
}
sub Run {
my $Self = shift;
my $MailQueue = $Kernel::OM->Get('Kernel::System::MailQueue')->List();
my $MailAmount = scalar @{$MailQueue};
$Self->AddResultInformation(
Label => Translatable('Emails queued for sending'),
Value => $MailAmount,
);
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,58 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::FQDN;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
my $FQDN = $Kernel::OM->Get('Kernel::Config')->Get('FQDN');
# Do we have set our FQDN?
if ( $FQDN eq 'yourhost.example.com' ) {
$Self->AddResultProblem(
Label => Translatable('FQDN (domain name)'),
Value => $FQDN,
Message => Translatable('Please configure your FQDN setting.'),
);
}
# FQDN syntax check.
elsif ( $FQDN !~ /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,12}$/ ) {
$Self->AddResultProblem(
Label => Translatable('Domain Name'),
Value => $FQDN,
Message => Translatable('Your FQDN setting is invalid.'),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Domain Name'),
Value => $FQDN,
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,71 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::FileSystemWritable;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
my $Home = $Kernel::OM->Get('Kernel::Config')->Get('Home');
my @TestDirectories = qw(
/bin/
/Kernel/
/Kernel/System/
/Kernel/Output/
/Kernel/Output/HTML/
/Kernel/Modules/
);
my @ReadonlyDirectories;
for my $TestDirectory (@TestDirectories) {
my $File = $Home . $TestDirectory . "check_permissions.$$";
if ( open( my $FH, '>', "$File" ) ) { ## no critic
print $FH "test";
close($FH);
unlink $File;
}
else {
push @ReadonlyDirectories, $TestDirectory;
}
}
if (@ReadonlyDirectories) {
$Self->AddResultProblem(
Label => Translatable('File System Writable'),
Value => join( ', ', @ReadonlyDirectories ),
Message => Translatable('The file system on your OTRS partition is not writable.'),
);
}
else {
$Self->AddResultOk(
Label => Translatable('File System Writable'),
Value => '',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,111 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
## nofilter(TidyAll::Plugin::OTRS::Perl::LayoutObject)
package Kernel::System::SupportDataCollector::Plugin::OTRS::LegacyConfigBackups;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::Main',
'Kernel::System::Package',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
my $Home = $Kernel::OM->Get('Kernel::Config')->Get('Home');
my $BackupsFolder = "$Home/Kernel/Config/Backups";
my @BackupFiles;
if ( -d $BackupsFolder ) {
@BackupFiles = $Kernel::OM->Get('Kernel::System::Main')->DirectoryRead(
Directory => $BackupsFolder,
Filter => '*',
);
}
if ( !@BackupFiles ) {
$Self->AddResultOk(
Label => Translatable('Legacy Configuration Backups'),
Value => 0,
Message => Translatable('No legacy configuration backup files found.'),
);
return $Self->GetResults();
}
# get package object
my $PackageObject = $Kernel::OM->Get('Kernel::System::Package');
my @InvalidPackages;
my @WrongFrameworkVersion;
for my $Package ( $PackageObject->RepositoryList() ) {
my $DeployCheck = $PackageObject->DeployCheck(
Name => $Package->{Name}->{Content},
Version => $Package->{Version}->{Content},
);
if ( !$DeployCheck ) {
push @InvalidPackages, "$Package->{Name}->{Content} $Package->{Version}->{Content}";
}
# get package
my $PackageContent = $PackageObject->RepositoryGet(
Name => $Package->{Name}->{Content},
Version => $Package->{Version}->{Content},
Result => 'SCALAR',
);
my %PackageStructure = $PackageObject->PackageParse(
String => $PackageContent,
);
my %CheckFramework = $PackageObject->AnalyzePackageFrameworkRequirements(
Framework => $PackageStructure{Framework},
NoLog => 1,
);
if ( !$CheckFramework{Success} ) {
push @WrongFrameworkVersion, "$Package->{Name}->{Content} $Package->{Version}->{Content}";
}
}
if ( @InvalidPackages || @WrongFrameworkVersion ) {
$Self->AddResultOk(
Label => Translatable('Legacy Configuration Backups'),
Value => scalar @BackupFiles,
Message => Translatable(
'Legacy configuration backup files found in Kernel/Config/Backups folder, but they might still be required by some packages.'
),
);
return $Self->GetResults();
}
$Self->AddResultWarning(
Label => Translatable('Legacy Configuration Backups'),
Value => scalar @BackupFiles,
Message => Translatable(
'Legacy configuration backup files are no longer needed for the installed packages, please remove them from Kernel/Config/Backups folder.'
),
);
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,158 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::PackageDeployment;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::Package',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
# get package object
my $PackageObject = $Kernel::OM->Get('Kernel::System::Package');
my @InvalidPackages;
my @NotVerifiedPackages;
my @WrongFrameworkVersion;
for my $Package ( $PackageObject->RepositoryList() ) {
my $DeployCheck = $PackageObject->DeployCheck(
Name => $Package->{Name}->{Content},
Version => $Package->{Version}->{Content},
);
if ( !$DeployCheck ) {
push @InvalidPackages, "$Package->{Name}->{Content} $Package->{Version}->{Content}";
}
# get package
my $PackageContent = $PackageObject->RepositoryGet(
Name => $Package->{Name}->{Content},
Version => $Package->{Version}->{Content},
Result => 'SCALAR',
);
my $Verified = $PackageObject->PackageVerify(
Package => $PackageContent,
Name => $Package->{Name}->{Content},
) || 'unknown';
if ( $Verified ne 'verified' ) {
push @NotVerifiedPackages, "$Package->{Name}->{Content} $Package->{Version}->{Content}";
}
my %PackageStructure = $PackageObject->PackageParse(
String => $PackageContent,
);
my %CheckFramework = $PackageObject->AnalyzePackageFrameworkRequirements(
Framework => $PackageStructure{Framework},
NoLog => 1,
);
if ( !$CheckFramework{Success} ) {
push @WrongFrameworkVersion, "$Package->{Name}->{Content} $Package->{Version}->{Content}";
}
}
if (@InvalidPackages) {
if ( $Kernel::OM->Get('Kernel::Config')->Get('Package::AllowLocalModifications') ) {
$Self->AddResultInformation(
Label => Translatable('Package Installation Status'),
Value => join( ', ', @InvalidPackages ),
Message => Translatable('Some packages have locally modified files.'),
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Package Installation Status'),
Value => join( ', ', @InvalidPackages ),
Message => Translatable('Some packages are not correctly installed.'),
);
}
}
else {
$Self->AddResultOk(
Label => Translatable('Package Installation Status'),
Value => '',
);
}
if (@NotVerifiedPackages) {
if ( $Kernel::OM->Get('Kernel::Config')->Get('Package::AllowLocalModifications') ) {
$Self->AddResultInformation(
Identifier => 'Verification',
Label => Translatable('Package Verification Status'),
Value => join( ', ', @NotVerifiedPackages ),
Message => Translatable(
'Some packages are not verified by the OTRS Group! It is recommended not to use this packages.'
),
);
}
else {
$Self->AddResultProblem(
Identifier => 'Verification',
Label => Translatable('Package Verification Status'),
Value => join( ', ', @NotVerifiedPackages ),
Message => Translatable(
'Some packages are not verified by the OTRS Group! It is recommended not to use this packages.'
),
);
}
}
else {
$Self->AddResultOk(
Identifier => 'Verification',
Label => Translatable('Package Verification Status'),
Value => '',
);
}
if (@WrongFrameworkVersion) {
if ( $Kernel::OM->Get('Kernel::Config')->Get('Package::AllowLocalModifications') ) {
$Self->AddResultInformation(
Identifier => 'FrameworkVersion',
Label => Translatable('Package Framework Version Status'),
Value => join( ', ', @WrongFrameworkVersion ),
Message => Translatable('Some packages are not allowed for the current framework version.'),
);
}
else {
$Self->AddResultProblem(
Identifier => 'FrameworkVersion',
Label => Translatable('Package Framework Version Status'),
Value => join( ', ', @WrongFrameworkVersion ),
Message => Translatable('Some packages are not allowed for the current framework version.'),
);
}
}
else {
$Self->AddResultOk(
Identifier => 'FrameworkVersion',
Label => Translatable('Package Framework Version Status'),
Value => '',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,75 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::PackageList;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::CSV',
'Kernel::System::Package',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('Package List');
}
sub Run {
my $Self = shift;
my $Home = $Kernel::OM->Get('Kernel::Config')->Get('Home');
# get needed objects
my $PackageObject = $Kernel::OM->Get('Kernel::System::Package');
my $CSVObject = $Kernel::OM->Get('Kernel::System::CSV');
my @PackageList = $PackageObject->RepositoryList( Result => 'Short' );
for my $Package (@PackageList) {
my @PackageData = (
[
$Package->{Name},
$Package->{Version},
$Package->{MD5sum},
$Package->{Vendor},
],
);
# use '-' (minus) as separator otherwise the line will not wrap and will not be totally
# visible
my $Message = $CSVObject->Array2CSV(
Data => \@PackageData,
Separator => '-',
Quote => "'",
);
# remove the new line character, otherwise it does not play good with output translations
chomp $Message;
$Self->AddResultInformation(
Identifier => $Package->{Name},
Label => $Package->{Name},
Value => $Package->{Version},
Message => $Message,
);
}
# if no packages where found we should not add any result, otherwise the table will be
# have that row instead of output just the label and a message of not packages found
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,58 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::SessionConfigSettings;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('Session Config Settings');
}
sub Run {
my $Self = shift;
my @Settings = qw(
SessionMaxTime
SessionMaxIdleTime
AgentSessionLimitPriorWarning
AgentSessionLimit
AgentSessionPerUserLimit
CustomerSessionLimit
CustomerSessionPerUserLimit
);
# get config object
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
for my $Setting (@Settings) {
my $ConfigValue = $ConfigObject->Get($Setting);
my $Message;
$Self->AddResultInformation(
Identifier => $Setting,
Label => $Setting,
Value => $ConfigValue,
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,55 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::SpoolMails;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::Main',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
my $Home = $Kernel::OM->Get('Kernel::Config')->Get('Home');
my $SpoolDir = "$Home/var/spool";
my @SpoolMails = $Kernel::OM->Get('Kernel::System::Main')->DirectoryRead(
Directory => $SpoolDir,
Filter => '*',
);
if ( scalar @SpoolMails ) {
$Self->AddResultProblem(
Label => Translatable('Spooled Emails'),
Value => scalar @SpoolMails,
Message => Translatable('There are emails in var/spool that OTRS could not process.'),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Spooled Emails'),
Value => scalar @SpoolMails,
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,50 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::SystemID;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
# Get the configured SystemID
my $SystemID = $Kernel::OM->Get('Kernel::Config')->Get('SystemID');
# Does the SystemID contain non-digits?
if ( $SystemID !~ /^\d+$/ ) {
$Self->AddResultProblem(
Label => Translatable('SystemID'),
Value => $SystemID,
Message => Translatable('Your SystemID setting is invalid, it should only contain digits.'),
);
}
else {
$Self->AddResultOk(
Label => Translatable('SystemID'),
Value => $SystemID,
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,66 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::Ticket::DefaultType;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::Type',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
# check, if Ticket::Type is enabled
my $TicketType = $Kernel::OM->Get('Kernel::Config')->Get('Ticket::Type');
# if not enabled, stop here
if ( !$TicketType ) {
return $Self->GetResults();
}
my $TypeObject = $Kernel::OM->Get('Kernel::System::Type');
# get default ticket type from config
my $DefaultTicketType = $Kernel::OM->Get('Kernel::Config')->Get('Ticket::Type::Default');
# get list of all ticket types
my %AllTicketTypes = reverse $TypeObject->TypeList();
if ( $AllTicketTypes{$DefaultTicketType} ) {
$Self->AddResultOk(
Label => Translatable('Default Ticket Type'),
Value => $DefaultTicketType,
);
}
else {
$Self->AddResultWarning(
Label => Translatable('Default Ticket Type'),
Value => $DefaultTicketType,
Message =>
Translatable(
'The configured default ticket type is invalid or missing. Please change the setting Ticket::Type::Default and select a valid ticket type.'
),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,62 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::Ticket::IndexModule;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
my $Module = $Kernel::OM->Get('Kernel::Config')->Get('Ticket::IndexModule');
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
my $TicketCount;
$DBObject->Prepare( SQL => 'SELECT count(*) FROM ticket' );
while ( my @Row = $DBObject->FetchrowArray() ) {
$TicketCount = $Row[0];
}
if ( $TicketCount > 60_000 && $Module =~ /RuntimeDB/ ) {
$Self->AddResultWarning(
Label => Translatable('Ticket Index Module'),
Value => $Module,
Message =>
Translatable(
'You have more than 60,000 tickets and should use the StaticDB backend. See admin manual (Performance Tuning) for more information.'
),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Ticket Index Module'),
Value => $Module,
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,66 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::Ticket::InvalidUsersWithLockedTickets;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
my $InvalidUsersTicketCount;
$DBObject->Prepare(
SQL => '
SELECT COUNT(*) FROM ticket, users
WHERE
ticket.user_id = users.id
AND ticket.ticket_lock_id = 2
AND users.valid_id != 1
',
Limit => 1,
);
while ( my @Row = $DBObject->FetchrowArray() ) {
$InvalidUsersTicketCount = $Row[0];
}
if ($InvalidUsersTicketCount) {
$Self->AddResultWarning(
Label => Translatable('Invalid Users with Locked Tickets'),
Value => $InvalidUsersTicketCount,
Message => Translatable('There are invalid users with locked tickets.'),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Invalid Users with Locked Tickets'),
Value => '0',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,53 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::Ticket::OpenTickets;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::System::Ticket',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
my $OpenTickets = $Kernel::OM->Get('Kernel::System::Ticket')->TicketSearch(
Result => 'COUNT',
StateType => 'Open',
UserID => 1,
Permission => 'ro',
) || 0;
if ( $OpenTickets > 8000 ) {
$Self->AddResultWarning(
Label => Translatable('Open Tickets'),
Value => $OpenTickets,
Message => Translatable('You should not have more than 8,000 open tickets in your system.'),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Open Tickets'),
Value => $OpenTickets,
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,52 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::Ticket::SearchIndexModule;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
my $ForceUnfilteredStorage = $Kernel::OM->Get('Kernel::Config')->Get('Ticket::SearchIndex::ForceUnfilteredStorage');
if ($ForceUnfilteredStorage) {
$Self->AddResultWarning(
Label => Translatable('Ticket Search Index Module'),
Value => 'Ticket::SearchIndex::ForceUnfilteredStorage',
Message =>
Translatable(
'The indexing process forces the storage of the original article text in the article search index, without executing filters or applying stop word lists. This will increase the size of the search index and thus may slow down fulltext searches.'
),
);
}
else {
$Self->AddResultOk(
Label => Translatable('Ticket Search Index Module'),
Value => 'Ticket::SearchIndex::ForceUnfilteredStorage',
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,91 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::Ticket::StaticDBOrphanedRecords;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::DB',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
my $Module = $Kernel::OM->Get('Kernel::Config')->Get('Ticket::IndexModule');
# get database object
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
if ( $Module !~ /StaticDB/ ) {
my ( $OrphanedTicketLockIndex, $OrphanedTicketIndex );
$DBObject->Prepare( SQL => 'SELECT count(*) from ticket_lock_index' );
while ( my @Row = $DBObject->FetchrowArray() ) {
$OrphanedTicketLockIndex = $Row[0];
}
if ($OrphanedTicketLockIndex) {
$Self->AddResultWarning(
Identifier => 'TicketLockIndex',
Label => Translatable('Orphaned Records In ticket_lock_index Table'),
Value => $OrphanedTicketLockIndex,
Message =>
Translatable(
'Table ticket_lock_index contains orphaned records. Please run bin/otrs.Console.pl "Maint::Ticket::QueueIndexCleanup" to clean the StaticDB index.'
),
);
}
else {
$Self->AddResultOk(
Identifier => 'TicketLockIndex',
Label => Translatable('Orphaned Records In ticket_lock_index Table'),
Value => $OrphanedTicketLockIndex || '0',
);
}
$DBObject->Prepare( SQL => 'SELECT count(*) from ticket_index' );
while ( my @Row = $DBObject->FetchrowArray() ) {
$OrphanedTicketIndex = $Row[0];
}
if ($OrphanedTicketLockIndex) {
$Self->AddResultWarning(
Identifier => 'TicketIndex',
Label => Translatable('Orphaned Records In ticket_index Table'),
Value => $OrphanedTicketIndex,
Message =>
Translatable(
'Table ticket_index contains orphaned records. Please run bin/otrs.Console.pl "Maint::Ticket::QueueIndexCleanup" to clean the StaticDB index.'
),
);
}
else {
$Self->AddResultOk(
Identifier => 'TicketIndex',
Label => Translatable('Orphaned Records In ticket_index Table'),
Value => $OrphanedTicketIndex || '0',
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,107 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::TimeSettings;
use strict;
use warnings;
use POSIX;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
use Kernel::System::DateTime;
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('Time Settings');
}
sub Run {
my $Self = shift;
# Server time zone
my $ServerTimeZone = POSIX::tzname();
$Self->AddResultOk(
Identifier => 'ServerTimeZone',
Label => Translatable('Server time zone'),
Value => $ServerTimeZone,
);
my $ConfigObject = $Kernel::OM->Get('Kernel::Config');
# OTRS time zone
my $OTRSTimeZone = $ConfigObject->Get('OTRSTimeZone');
if ( defined $OTRSTimeZone ) {
$Self->AddResultOk(
Identifier => 'OTRSTimeZone',
Label => Translatable('OTRS time zone'),
Value => $OTRSTimeZone,
);
}
else {
$Self->AddResultProblem(
Identifier => 'OTRSTimeZone',
Label => Translatable('OTRS time zone'),
Value => '',
Message => Translatable('OTRS time zone is not set.'),
);
}
# User default time zone
my $UserDefaultTimeZone = $ConfigObject->Get('UserDefaultTimeZone');
if ( defined $UserDefaultTimeZone ) {
$Self->AddResultOk(
Identifier => 'UserDefaultTimeZone',
Label => Translatable('User default time zone'),
Value => $UserDefaultTimeZone,
);
}
else {
$Self->AddResultProblem(
Identifier => 'UserDefaultTimeZone',
Label => Translatable('User default time zone'),
Value => '',
Message => Translatable('User default time zone is not set.'),
);
}
# Calendar time zones
for my $Counter ( 1 .. 9 ) {
my $CalendarTimeZone = $ConfigObject->Get( 'TimeZone::Calendar' . $Counter );
if ( defined $CalendarTimeZone ) {
$Self->AddResultOk(
Identifier => "OTRSTimeZone::Calendar$Counter",
# Use of $LanguageObject->Translate() is not possible to avoid translated strings to be sent to OTRS Group.
Label => "OTRS time zone setting for calendar $Counter",
Value => $CalendarTimeZone,
);
}
else {
$Self->AddResultInformation(
Identifier => "OTRSTimeZone::Calendar$Counter",
# Use of $LanguageObject->Translate() is not possible to avoid translated strings to be sent to OTRS Group.
Label => "OTRS time zone setting for calendar $Counter",
Value => '',
Message => Translatable('Calendar time zone is not set.'),
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,67 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::UI::AgentSkinUsage;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::DB',
'Kernel::System::User',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('UI - Agent Skin Usage');
}
sub Run {
my $Self = shift;
# First get count of all agents. We avoid checking for Valid for performance reasons, as this
# would require fetching of all agent data to check for the preferences.
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
my $AgentsWithDefaultSkin = 1;
$DBObject->Prepare( SQL => 'SELECT count(*) FROM users' );
while ( my @Row = $DBObject->FetchrowArray() ) {
$AgentsWithDefaultSkin = $Row[0];
}
my $DefaultSkin = $Kernel::OM->Get('Kernel::Config')->Get('Loader::Agent::DefaultSelectedSkin');
my %SkinPreferences = $Kernel::OM->Get('Kernel::System::User')->SearchPreferences(
Key => 'UserSkin',
);
my %SkinUsage;
# Check how many agents have a skin preference configured, assume default skin for the rest.
for my $UserID ( sort keys %SkinPreferences ) {
$SkinUsage{ $SkinPreferences{$UserID} }++;
$AgentsWithDefaultSkin--;
}
$SkinUsage{$DefaultSkin} += $AgentsWithDefaultSkin;
for my $Skin ( sort keys %SkinUsage ) {
$Self->AddResultInformation(
Identifier => $Skin,
Label => $Skin,
Value => $SkinUsage{$Skin},
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,67 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::UI::AgentThemeUsage;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::DB',
'Kernel::System::User',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('UI - Agent Theme Usage');
}
sub Run {
my $Self = shift;
# First get count of all agents. We avoid checking for Valid for performance reasons, as this
# would require fetching of all agent data to check for the preferences.
my $DBObject = $Kernel::OM->Get('Kernel::System::DB');
my $AgentsWithDefaultTheme = 1;
$DBObject->Prepare( SQL => 'SELECT count(*) FROM users' );
while ( my @Row = $DBObject->FetchrowArray() ) {
$AgentsWithDefaultTheme = $Row[0];
}
my $DefaultThem = $Kernel::OM->Get('Kernel::Config')->Get('DefaultTheme');
my %ThemePreferences = $Kernel::OM->Get('Kernel::System::User')->SearchPreferences(
Key => 'UserTheme',
);
my %ThemeUsage;
# Check how many agents have a theme preference configured, assume default theme for the rest.
for my $UserID ( sort keys %ThemePreferences ) {
$ThemeUsage{ $ThemePreferences{$UserID} }++;
$AgentsWithDefaultTheme--;
}
$ThemeUsage{$DefaultThem} += $AgentsWithDefaultTheme;
for my $Theme ( sort keys %ThemeUsage ) {
$Self->AddResultInformation(
Identifier => $Theme,
Label => $Theme,
Value => $ThemeUsage{$Theme},
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,52 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::UI::SpecialStats;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
'Kernel::System::DB',
'Kernel::System::User',
);
sub GetDisplayPath {
return Translatable('OTRS') . '/' . Translatable('UI - Special Statistics');
}
sub Run {
my $Self = shift;
my %PreferenceMap = (
UserNavBarItemsOrder => Translatable('Agents using custom main menu ordering'),
AdminNavigationBarFavourites => Translatable('Agents using favourites for the admin overview'),
);
for my $Preference ( sort keys %PreferenceMap ) {
my %FoundPreferences = $Kernel::OM->Get('Kernel::System::User')->SearchPreferences(
Key => $Preference,
);
$Self->AddResultInformation(
Identifier => $Preference,
Label => $PreferenceMap{$Preference},
Value => scalar keys %FoundPreferences,
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,37 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::OTRS::Version;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = (
'Kernel::Config',
);
sub GetDisplayPath {
return Translatable('OTRS');
}
sub Run {
my $Self = shift;
$Self->AddResultInformation(
Label => Translatable('OTRS Version'),
Value => $Kernel::OM->Get('Kernel::Config')->Get('Version'),
);
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,52 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Webserver::Apache::LoadedModules;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = ();
sub GetDisplayPath {
return Translatable('Webserver') . '/' . Translatable('Loaded Apache Modules');
}
sub Run {
my $Self = shift;
my %Environment = %ENV;
# No web request or no apache webserver with mod_perl, skip this check.
if (
!$ENV{GATEWAY_INTERFACE}
|| !$ENV{SERVER_SOFTWARE}
|| $ENV{SERVER_SOFTWARE} !~ m{apache}i
|| !$ENV{MOD_PERL}
|| !eval { require Apache2::Module; }
)
{
return $Self->GetResults();
}
for ( my $Module = Apache2::Module::top_module(); $Module; $Module = $Module->next() ) {
$Self->AddResultInformation(
Identifier => $Module->name(),
Label => $Module->name(),
Value => $Module->ap_api_major_version() . '.' . $Module->ap_api_minor_version(),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,68 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Webserver::Apache::MPMModel;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = ();
sub GetDisplayPath {
return Translatable('Webserver');
}
sub Run {
my $Self = shift;
my %Environment = %ENV;
# No web request or no apache webserver with mod_perl, skip this check.
if ( !$ENV{GATEWAY_INTERFACE} || !$ENV{SERVER_SOFTWARE} || $ENV{SERVER_SOFTWARE} !~ m{apache}i || !$ENV{MOD_PERL} )
{
return $Self->GetResults();
}
my $MPMModel;
my %KnownModels = (
'worker.c' => 1,
'prefork.c' => 1,
'event.c' => 1,
);
MODULE:
for ( my $Module = Apache2::Module::top_module(); $Module; $Module = $Module->next() ) {
if ( $KnownModels{ $Module->name() } ) {
$MPMModel = $Module->name();
}
}
if ( $MPMModel eq 'prefork.c' ) {
$Self->AddResultOk(
Identifier => 'MPMModel',
Label => Translatable('MPM model'),
Value => $MPMModel,
);
}
else {
$Self->AddResultProblem(
Identifier => 'MPMModel',
Label => Translatable('MPM model'),
Value => $MPMModel,
Message => Translatable("OTRS requires apache to be run with the 'prefork' MPM model."),
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,178 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Webserver::Apache::Performance;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = ();
sub GetDisplayPath {
return Translatable('Webserver');
}
sub Run {
my $Self = shift;
my %Environment = %ENV;
# No web request or no apache webserver, skip this check.
if ( !$ENV{GATEWAY_INTERFACE} || !$ENV{SERVER_SOFTWARE} || $ENV{SERVER_SOFTWARE} !~ m{apache}i ) {
return $Self->GetResults();
}
# Check for CGI accelerator
if ( $ENV{MOD_PERL} ) {
$Self->AddResultOk(
Identifier => "CGIAcceleratorUsed",
Label => Translatable('CGI Accelerator Usage'),
Value => $ENV{MOD_PERL},
);
}
elsif ( $INC{'CGI/Fast.pm'} || $ENV{FCGI_ROLE} || $ENV{FCGI_SOCKET_PATH} ) {
$Self->AddResultOk(
Identifier => "CGIAcceleratorUsed",
Label => Translatable('CGI Accelerator Usage'),
Value => 'fastcgi',
);
}
else {
$Self->AddResultWarning(
Identifier => "CGIAcceleratorUsed",
Label => Translatable('CGI Accelerator Usage'),
Value => '',
Message => Translatable('You should use FastCGI or mod_perl to increase your performance.'),
);
}
if ( $ENV{MOD_PERL} ) {
my $ModDeflateLoaded =
Apache2::Module::loaded('mod_deflate.c') || Apache2::Module::loaded('mod_deflate.so');
if ($ModDeflateLoaded) {
$Self->AddResultOk(
Identifier => "ModDeflateLoaded",
Label => Translatable('mod_deflate Usage'),
Value => 'active',
);
}
else {
$Self->AddResultWarning(
Identifier => "ModDeflateLoaded",
Label => Translatable('mod_deflate Usage'),
Value => 'not active',
Message => Translatable('Please install mod_deflate to improve GUI speed.'),
);
}
my $ModFilterLoaded =
Apache2::Module::loaded('mod_filter.c') || Apache2::Module::loaded('mod_filter.so');
if ($ModFilterLoaded) {
$Self->AddResultOk(
Identifier => "ModFilterLoaded",
Label => Translatable('mod_filter Usage'),
Value => 'active',
);
}
else {
$Self->AddResultWarning(
Identifier => "ModFilterLoaded",
Label => Translatable('mod_filter Usage'),
Value => 'not active',
Message => Translatable('Please install mod_filter if mod_deflate is used.'),
);
}
my $ModHeadersLoaded =
Apache2::Module::loaded('mod_headers.c') || Apache2::Module::loaded('mod_headers.so');
if ($ModHeadersLoaded) {
$Self->AddResultOk(
Identifier => "ModHeadersLoaded",
Label => Translatable('mod_headers Usage'),
Value => 'active',
);
}
else {
$Self->AddResultWarning(
Identifier => "ModHeadersLoaded",
Label => Translatable('mod_headers Usage'),
Value => 'not active',
Message => Translatable('Please install mod_headers to improve GUI speed.'),
);
}
# check if Apache::Reload is loaded
my $ApacheReloadUsed = 0;
for my $Module ( sort keys %INC ) {
$Module =~ s/\//::/g;
$Module =~ s/\.pm$//g;
if ( $Module eq 'Apache::Reload' || $Module eq 'Apache2::Reload' ) {
$ApacheReloadUsed = $Module;
}
}
if ($ApacheReloadUsed) {
$Self->AddResultOk(
Identifier => "ApacheReloadUsed",
Label => Translatable('Apache::Reload Usage'),
Value => 'active',
);
}
else {
$Self->AddResultWarning(
Identifier => "ApacheReloadUsed",
Label => Translatable('Apache::Reload Usage'),
Value => 'not active',
Message =>
Translatable(
'Apache::Reload or Apache2::Reload should be used as PerlModule and PerlInitHandler to prevent web server restarts when installing and upgrading modules.'
),
);
}
my $ApacheDBIUsed;
for my $Module ( sort keys %INC ) {
$Module =~ s/\//::/g;
$Module =~ s/\.pm$//g;
if ( $Module eq 'Apache::DBI' || $Module eq 'Apache2::DBI' ) {
$ApacheDBIUsed = $Module;
}
}
if ($ApacheDBIUsed) {
$Self->AddResultOk(
Identifier => "ApacheDBIUsed",
Label => Translatable('Apache2::DBI Usage'),
Value => 'active',
);
}
else {
$Self->AddResultWarning(
Identifier => "ApacheDBIUsed",
Label => Translatable('Apache2::DBI Usage'),
Value => 'not active',
Message =>
Translatable(
'Apache2::DBI should be used to get a better performance with pre-established database connections.'
),
);
}
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,60 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Webserver::EnvironmentVariables;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = ();
sub GetDisplayPath {
return Translatable('Webserver') . '/' . Translatable('Environment Variables');
}
sub Run {
my $Self = shift;
my %Environment = %ENV;
# Skip the plugin, if the support data collection isn't running in a web request.
return $Self->GetResults() if !$ENV{GATEWAY_INTERFACE};
for my $NotNeededString (
qw(
HTTP_REFERER HTTP_CACHE_CONTROL HTTP_COOKIE HTTP_USER_AGENT
HTTP_ACCEPT_LANGUAGE HTTP_ACCEPT_ENCODING HTTP_ACCEPT
QUERY_STRING REQUEST_METHOD REQUEST_URI SCRIPT_NAME
ALLUSERSPROFILE APPDATA LOCALAPPDATA COMMONPROGRAMFILES
PROGRAMDATA PROGRAMFILES PSMODULEPATH PUBLIC
SYSTEMDRIVE SYSTEMROOT TEMP WINDIR
USERPROFILE REMOTE_PORT
)
)
{
delete $Environment{$NotNeededString};
}
my @Result;
for my $Variable ( sort { $a cmp $b } keys %Environment ) {
$Self->AddResultInformation(
Identifier => $Variable,
Label => $Variable,
Value => $Environment{$Variable},
);
}
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,41 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Webserver::InternalWebRequest;
use strict;
use warnings;
use Kernel::System::ObjectManager;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = ();
sub GetDisplayPath {
return Translatable('Webserver');
}
sub Run {
my $Self = shift;
# Skip the plugin, if the support data collection is running in a web request.
return $Self->GetResults() if $ENV{GATEWAY_INTERFACE};
$Self->AddResultWarning(
Label => Translatable('Support Data Collection'),
Value => 0,
Message => Translatable('Support data could not be collected from the web server.'),
);
return $Self->GetResults();
}
1;

View File

@@ -0,0 +1,51 @@
# --
# Copyright (C) 2001-2019 OTRS AG, https://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see https://www.gnu.org/licenses/gpl-3.0.txt.
# --
package Kernel::System::SupportDataCollector::Plugin::Webserver::Version;
use strict;
use warnings;
use parent qw(Kernel::System::SupportDataCollector::PluginBase);
use Kernel::Language qw(Translatable);
our @ObjectDependencies = ();
sub GetDisplayPath {
return Translatable('Webserver');
}
sub Run {
my $Self = shift;
my %Environment = %ENV;
# Skip the plugin, if the support data collection isn't running in a web request.
return $Self->GetResults() if !$ENV{GATEWAY_INTERFACE};
my $Version = $ENV{SERVER_SOFTWARE};
if ($Version) {
$Self->AddResultInformation(
Label => Translatable('Webserver Version'),
Value => $ENV{SERVER_SOFTWARE},
);
}
else {
$Self->AddResultProblem(
Label => Translatable('Webserver Version'),
Value => '',
Message => Translatable('Could not determine webserver version.')
);
}
return $Self->GetResults();
}
1;