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,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;