initial commit of file from CVS for smeserver-zabbix-server on Sat Sep 7 21:19:08 AEST 2024
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#Only non rpm owned files are backupe there
|
||||
{
|
||||
use RPM2;
|
||||
my $rpm_db = RPM2->open_rpm_db();
|
||||
|
||||
my @dirs = qw(
|
||||
/etc/zabbix
|
||||
/etc/zabbix/zabbix_agentd.conf.d/
|
||||
/var/lib/zabbix/bin/
|
||||
);
|
||||
|
||||
foreach my $some_dir (@dirs) {
|
||||
next unless ( -e $some_dir );
|
||||
opendir(my $dh, $some_dir) || die "Can't open $some_dir: $!";
|
||||
while ( (my $file = readdir $dh) ) {
|
||||
next if $file =~ /^\.{1,2}$/;
|
||||
$OUT .= "$some_dir/$file\n" unless $rpm_db->find_by_file("$some_dir/$file");
|
||||
}
|
||||
closedir $dh;
|
||||
}
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
{
|
||||
my $db = ${'zabbix-server'}{'DbName'} || 'zabbixdb';
|
||||
my $user = ${'zabbix-server'}{'DbUser'} || 'zabbixuser';
|
||||
my $pass = ${'zabbix-server'}{'DbPassword'} || 'secret';
|
||||
|
||||
my $schema = `rpm -qd zabbix-server-mysql | grep create`;
|
||||
chomp $schema;
|
||||
my $curcharset= ( -d "/var/lib/mysql/$db" ) ? `echo 'show variables like "character_set_database";'|mysql $db|grep character_set_database|sed -r 's/^character_set_database\\s*([a-zA-Z0-9_-]+)/\\1/'` : "utf8";
|
||||
chomp $curcharset;
|
||||
my $adminpass= ${'zabbix-server'}{'AdminPassword'} || 'zabbix';
|
||||
$hashpass=`/usr/bin/htpasswd -bnBC 10 '' $adminpass | tr -d ':'`;
|
||||
$hashpass =~ tr/\r\n//d;
|
||||
$version = `/bin/ls -d /usr/share/doc/zabbix-web*|grep -Eo '[0-9.]+\$'|cut -d. -f1 || echo 4 `;
|
||||
$modpass=($version > 4)? "update users set passwd='$hashpass' where alias='Admin';": "#$version";
|
||||
$OUT .= <<"END";
|
||||
#! /bin/sh
|
||||
if [ -d /var/opt/rh/rh-mariadb105/lib/mysql/$db ]; then
|
||||
# check if utf8
|
||||
if [[ "$curcharset" != "utf8" ]] ;then
|
||||
echo "ALTER DATABASE $db CHARACTER SET utf8 COLLATE utf8_bin;" |/usr/bin/mysql105
|
||||
echo 'ALTER TABLE `$db`.`problem_tag` DROP INDEX `problem_tag_1`, ADD INDEX `problem_tag_1` (`eventid`, `tag` (100), `value`(100));' |/usr/bin/mysql105
|
||||
mysql --batch --skip-column-names --execute 'select concat("alter table ",TABLE_SCHEMA,".",TABLE_NAME," CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;") from information_schema.TABLES where TABLE_SCHEMA="$db"' | /usr/bin/mysql105
|
||||
fi
|
||||
for P in \$(rpm -qd zabbix-server-mysql | grep dbpatch | grep mysql); do
|
||||
/usr/bin/mysql105 $db < \$P
|
||||
done
|
||||
else
|
||||
echo "CREATE DATABASE $db CHARACTER SET utf8 COLLATE utf8_bin;" | /usr/bin/mysql105
|
||||
/usr/bin/gunzip < $schema | /usr/bin/mysql105 $db
|
||||
|
||||
fi
|
||||
|
||||
/usr/bin/mysql105 <<EOF
|
||||
USE $db;
|
||||
update users set passwd=md5('$adminpass') where alias='Admin' and passwd=md5('zabbix');
|
||||
$modpass
|
||||
EOF
|
||||
|
||||
|
||||
/usr/bin/mysql105 <<EOF
|
||||
USE mysql;
|
||||
|
||||
grant all on $db.* to '${'zabbix-server'}{DbUser}'\@'localhost' identified by '${'zabbix-server'}{DbPassword}';
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
|
||||
USE ${'zabbix-server'}{DbName};
|
||||
|
||||
INSERT IGNORE INTO media_type (
|
||||
mediatypeid,
|
||||
type, description,
|
||||
smtp_server,
|
||||
smtp_helo,
|
||||
smtp_email,
|
||||
exec_path,
|
||||
gsm_modem,
|
||||
username,
|
||||
passwd)
|
||||
VALUES(
|
||||
4,
|
||||
1,
|
||||
'xmpp',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'sendxmpp',
|
||||
'',
|
||||
'',
|
||||
'');
|
||||
|
||||
EOF
|
||||
END
|
||||
}
|
@@ -0,0 +1,45 @@
|
||||
{
|
||||
if (
|
||||
((${'zabbix-server'}{'status'} || 'disabled') eq 'enabled') &&
|
||||
((${'zabbix-server'}{'WebAccess'} || 'local') ne 'disabled')){
|
||||
|
||||
my $access = (${'zabbix-server'}{'WebAccess'} || 'local') eq 'public' ?
|
||||
'all granted':"ip $localAccess $externalSSLAccess";
|
||||
|
||||
my $tz = ${'TimeZone'} || 'Europe/Paris';
|
||||
|
||||
$OUT .=<<"HERE";
|
||||
#-------------------------------------------#
|
||||
# Zabbix monitoring system php web frontend #
|
||||
#-------------------------------------------#
|
||||
|
||||
Alias /zabbix /usr/share/zabbix
|
||||
|
||||
<Directory "/usr/share/zabbix">
|
||||
SSLRequireSSL on
|
||||
Options FollowSymLinks
|
||||
AllowOverride None
|
||||
#AddType application/x-httpd-php .php
|
||||
<FilesMatch .php>
|
||||
SetHandler "proxy:unix:/var/run/php-fpm/php74-zabbix-server.sock|fcgi://localhost"
|
||||
</FilesMatch>
|
||||
Require $access
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/include">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Require all denied
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
<Directory "/usr/share/zabbix/include/classes">
|
||||
Require all denied
|
||||
<files *.php>
|
||||
Require all denied
|
||||
</files>
|
||||
</Directory>
|
||||
|
||||
HERE
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
{
|
||||
|
||||
if ($port ne ${modSSL}{'TCPPort'}){
|
||||
$OUT = ' RewriteRule ^/zabbix(/.*|$) https://%{HTTP_HOST}/zabbix$1 [L,R]';
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,60 @@
|
||||
{
|
||||
if ($PHP_VERSION eq '74'){
|
||||
if ((${'zabbix-server'}{status} || 'disabled') eq 'enabled'){
|
||||
my $id = 'zabbix-server';
|
||||
my $openbasedir = '/usr/share/zabbix:/var/cache/zabbix/:/var/run/php-fpm/:/var/lib/php/zabbix/' .
|
||||
':/var/lock/zabbix/:/etc/zabbix/:/usr/share/php/:/usr/share/pear/:/opt/remi/php74/root/usr/share/pear/' .
|
||||
':/opt/remi/php74/root/usr/share/php/';
|
||||
$disablefunctions = 'system, show_source, symlink, exec, dl, shell_exec, passthru, phpinfo, ' .
|
||||
'escapeshellarg, escapeshellcmd';
|
||||
|
||||
$socket = ( -d "/var/lib/mysql/zabbixdb") ? "/var/lib/mysql/mysql.sock" : "/var/lib/mysql/mariadb105.sock";
|
||||
|
||||
$OUT .=<<_EOF;
|
||||
|
||||
[php$PHP_VERSION-$id]
|
||||
user = www
|
||||
group = www
|
||||
listen.owner = root
|
||||
listen.group = www
|
||||
listen.mode = 0660
|
||||
listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
|
||||
pm = dynamic
|
||||
pm.max_children = 15
|
||||
pm.start_servers = 3
|
||||
pm.min_spare_servers = 3
|
||||
pm.max_spare_servers = 4
|
||||
pm.max_requests = 1000
|
||||
request_terminate_timeout = 30
|
||||
php_admin_value[session.save_path] = /var/lib/php/zabbix/session
|
||||
php_admin_value[opcache.file_cache] = /var/lib/php/zabbix/opcache
|
||||
php_admin_value[upload_tmp_dir] = /var/lib/php/zabbix/tmp
|
||||
php_admin_value[error_log] = /var/log/php/zabbix/error.log
|
||||
slowlog = /var/log/php/zabbix/slow.log
|
||||
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
|
||||
php_admin_flag[display_errors] = off
|
||||
php_admin_flag[log_errors] = on
|
||||
php_admin_value[error_log] = syslog
|
||||
php_admin_value[memory_limit] = 256M
|
||||
php_admin_value[max_execution_time] = 600
|
||||
php_admin_value[max_input_time] = 600
|
||||
php_admin_value[post_max_size] = 32M
|
||||
php_admin_value[upload_max_filesize] = 16M
|
||||
php_admin_value[disable_functions] = $disablefunctions
|
||||
php_admin_value[open_basedir] = $openbasedir
|
||||
php_admin_flag[allow_url_fopen] = on
|
||||
php_admin_flag[file_upload] = off
|
||||
php_admin_flag[session.cookie_httponly] = on
|
||||
php_admin_flag[allow_url_include] = off
|
||||
php_admin_value[session.save_handler] = files
|
||||
php_admin_value[always_populate_raw_post_data] = -1
|
||||
php_value[mysqli.default_socket] = $socket
|
||||
php_value[mysql.default_socket] = $socket
|
||||
|
||||
_EOF
|
||||
}
|
||||
else{
|
||||
$OUT .= '; Zabbix Server is disabled';
|
||||
}
|
||||
}
|
||||
}
|
1
root/etc/e-smith/templates/etc/sudoers/00zabbixAlias
Normal file
1
root/etc/e-smith/templates/etc/sudoers/00zabbixAlias
Normal file
@@ -0,0 +1 @@
|
||||
Cmnd_Alias ZABBIX = /usr/sbin/fping,/usr/sbin/fping6
|
1
root/etc/e-smith/templates/etc/sudoers/30zabbix
Normal file
1
root/etc/e-smith/templates/etc/sudoers/30zabbix
Normal file
@@ -0,0 +1 @@
|
||||
zabbix ALL=(root) NOPASSWD: ZABBIX
|
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
** ZABBIX
|
||||
** Copyright (C) 2000-2005 SIA Zabbix
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation; either version 2 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
**/
|
||||
|
@@ -0,0 +1,20 @@
|
||||
global $DB;
|
||||
|
||||
$DB["TYPE"] = "MYSQL";
|
||||
$DB["SERVER"] = "localhost";
|
||||
$DB["PORT"] = "0";
|
||||
|
||||
{
|
||||
|
||||
my $dbname = ${'zabbix-server'}{'DbName'} || 'zabbix';
|
||||
my $dbuser = ${'zabbix-server'}{'DbUser'} || 'zabbix';
|
||||
my $dbpass = ${'zabbix-server'}{'DbPassword'} || 'secret';
|
||||
|
||||
$OUT .=<<"HERE";
|
||||
|
||||
\$DB["DATABASE"] = "$dbname";
|
||||
\$DB["USER"] = "$dbuser";
|
||||
\$DB["PASSWORD"] = "$dbpass";
|
||||
HERE
|
||||
}
|
||||
|
@@ -0,0 +1,10 @@
|
||||
{
|
||||
my $port = ${'zabbix-server'}{'TCPPort'} || '10051';
|
||||
|
||||
$OUT .=<<"HERE";
|
||||
|
||||
\$ZBX_SERVER = "localhost";
|
||||
\$ZBX_SERVER_PORT = "$port";
|
||||
HERE
|
||||
}
|
||||
|
@@ -0,0 +1 @@
|
||||
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
|
@@ -0,0 +1,4 @@
|
||||
# This is config file for ZABBIX server process
|
||||
# To get more information about ZABBIX,
|
||||
# go http://www.zabbix.com
|
||||
|
@@ -0,0 +1,11 @@
|
||||
############ GENERAL PARAMETERS #################
|
||||
|
||||
#NodeID dropped since Zabbix 2.40
|
||||
{
|
||||
# This defines unique NodeID in distributed setup,
|
||||
# Default value 0 (standalone server)
|
||||
# This parameter must be between 0 and 999
|
||||
#my $nodeID = ${'zabbix-server'}{'NodeID'} || '0';
|
||||
#$OUT .= "NodeID=$nodeID\n";
|
||||
}
|
||||
|
@@ -0,0 +1,35 @@
|
||||
# Number of pre-forked instances of pollers
|
||||
# Default value is 5
|
||||
# This parameter must be between 0 and 255
|
||||
StartPollers=5
|
||||
|
||||
# Number of pre-forked instances of IPMI pollers
|
||||
# Default value is 0
|
||||
# This parameter must be between 0 and 255
|
||||
#StartIPMIPollers=0
|
||||
|
||||
# Number of pre-forked instances of pollers for unreachable hosts
|
||||
# Default value is 1
|
||||
# This parameter must be between 0 and 255
|
||||
#StartPollersUnreachable=1
|
||||
|
||||
# Number of pre-forked instances of trappers
|
||||
# Default value is 5
|
||||
# This parameter must be between 0 and 255
|
||||
StartTrappers=5
|
||||
|
||||
# Number of pre-forked instances of ICMP pingers
|
||||
# Default value is 1
|
||||
# This parameter must be between 0 and 255
|
||||
StartPingers=1
|
||||
|
||||
# Number of pre-forked instances of discoverers
|
||||
# Default value is 1
|
||||
# This parameter must be between 0 and 255
|
||||
StartDiscoverers=1
|
||||
|
||||
# Number of pre-forked instances of HTTP pollers
|
||||
# Default value is 1
|
||||
# This parameter must be between 0 and 255
|
||||
#StartHTTPPollers=1
|
||||
|
@@ -0,0 +1,16 @@
|
||||
# Listen port for trapper. Default port number is 10051. This parameter
|
||||
# must be between 1024 and 32767
|
||||
{
|
||||
my $port = ${'zabbix-server'}{'TCPPort'} || '10051';
|
||||
$OUT .= "ListenPort=$port\n";
|
||||
}
|
||||
|
||||
# Source IP address for outgouing connections
|
||||
#SourceIP=
|
||||
|
||||
# Listen interface for trapper. Trapper will listen all network interfaces
|
||||
# if this parameter is missing.
|
||||
|
||||
#ListenIP=127.0.0.1
|
||||
|
||||
|
@@ -0,0 +1,15 @@
|
||||
# How often ZABBIX will perform housekeeping procedure
|
||||
# (in hours)
|
||||
# Default value is 1 hour
|
||||
# Housekeeping is removing unnecessary information from
|
||||
# tables history, alert, and alarms
|
||||
# This parameter must be between 1 and 24
|
||||
|
||||
#HousekeepingFrequency=1
|
||||
|
||||
# Uncomment this line to disable housekeeping procedure
|
||||
#DisableHousekeeping=1
|
||||
|
||||
# Frequency of ICMP pings (item keys 'icmpping' and 'icmppingsec'). Defauls is 60 seconds.
|
||||
#PingerFrequency=60
|
||||
|
@@ -0,0 +1,9 @@
|
||||
# Specifies debug level
|
||||
# 0 - debug is not created
|
||||
# 1 - critical information
|
||||
# 2 - error information
|
||||
# 3 - warnings (default)
|
||||
# 4 - for debugging (produces lots of information)
|
||||
|
||||
DebugLevel=3
|
||||
|
@@ -0,0 +1,13 @@
|
||||
# Name of PID file
|
||||
|
||||
PidFile=/run/zabbix/zabbix_server.pid
|
||||
|
||||
# Name of log file
|
||||
# If not set, syslog is used
|
||||
|
||||
LogFile=/var/log/zabbix/zabbix_server.log
|
||||
|
||||
# Maximum size of log file in MB. Set to 0 to disable automatic log rotation.
|
||||
LogFileSize=10
|
||||
|
||||
|
@@ -0,0 +1,17 @@
|
||||
# Location for custom alert scripts
|
||||
AlertScriptsPath=/var/lib/zabbix/bin
|
||||
|
||||
# Location of external scripts
|
||||
ExternalScripts=/var/lib/zabbix/bin
|
||||
|
||||
# Location of fping. Default is /usr/sbin/fping
|
||||
# Make sure that fping binary has root permissions and SUID flag set
|
||||
FpingLocation=/var/lib/zabbix/bin/fping
|
||||
|
||||
# Location of fping6. Default is /usr/sbin/fping6
|
||||
# Make sure that fping binary has root permissions and SUID flag set
|
||||
Fping6Location=/var/lib/zabbix/bin/fping6
|
||||
|
||||
# Temporary directory. Default is /tmp
|
||||
TmpDir=/var/lib/zabbix/tmp
|
||||
|
@@ -0,0 +1,36 @@
|
||||
# Database host name
|
||||
# Default is localhost
|
||||
|
||||
DBHost=localhost
|
||||
|
||||
# Database name
|
||||
# SQLite3 note: path to database file must be provided. DBUser and DBPassword are ignored.
|
||||
{
|
||||
my $dbname = ${'zabbix-server'}{'DbName'} || 'zabbix';
|
||||
my $dbuser = ${'zabbix-server'}{'DbUser'} || 'zabbix';
|
||||
my $dbpass = ${'zabbix-server'}{'DbPassword'} || 'secret';
|
||||
|
||||
$OUT .=<<"HERE";
|
||||
|
||||
DBName=$dbname
|
||||
|
||||
# Database user
|
||||
|
||||
DBUser=$dbuser
|
||||
|
||||
# Database password
|
||||
# Comment this line if no password used
|
||||
|
||||
DBPassword=$dbpass
|
||||
HERE
|
||||
|
||||
}
|
||||
|
||||
# Connect to MySQL using Unix socket?
|
||||
|
||||
#DBSocket=/var/lib/mysql/mysql.sock
|
||||
DBSocket=/var/lib/mysql/{$OUT = ( -d "/var/lib/mysql/zabbixdb") ? "mysql" : "mariadb105"}.sock
|
||||
|
||||
# Enable database cache module
|
||||
StartDBSyncers=1
|
||||
|
@@ -0,0 +1,12 @@
|
||||
{
|
||||
my $tz = ${'TimeZone'} || 'Europe/Paris';
|
||||
$OUT =<<"HERE";
|
||||
max_execution_time=600
|
||||
max_input_time=600
|
||||
memory_limit=256M
|
||||
date.timezone=$tz
|
||||
post_max_size=32M
|
||||
always_populate_raw_post_data=-1
|
||||
HERE
|
||||
}
|
||||
|
@@ -0,0 +1,3 @@
|
||||
# Jabber Account for zabbix alerts
|
||||
{${'zabbix-server'}{'JabberAccount'}}@{${'zabbix-server'}{'JabberServer'}} {${'zabbix-server'}{'JabberPassword'}}
|
||||
|
@@ -0,0 +1,6 @@
|
||||
|
||||
echo "$3" | \
|
||||
sendxmpp -r zabbix -f /var/lib/zabbix/.sendxmpprc \
|
||||
{(${'zabbix-server'}{'JabberTLS'} || 'enabled') eq 'disabled' ? '':'-t \\';}
|
||||
-s "$2" "$1"
|
||||
|
Reference in New Issue
Block a user