Initial import of 6.0.9-release1.el8

This commit is contained in:
Andrew Lukoshko 2022-11-21 21:37:02 +01:00
commit 787ef0d2ce
31 changed files with 3271 additions and 0 deletions

1
.zabbix.metadata Normal file
View File

@ -0,0 +1 @@
7f2bd26f4bd2438fc1cdb5f165764f5409d0963e SOURCES/zabbix-6.0.9.tar.gz

39
SOURCES/agent2.conf.patch Normal file
View File

@ -0,0 +1,39 @@
diff -urN zabbix-6.0.0alpha5.orig/src/go/conf/zabbix_agent2.conf zabbix-6.0.0alpha5/src/go/conf/zabbix_agent2.conf
--- zabbix-6.0.0alpha5.orig/src/go/conf/zabbix_agent2.conf 2021-10-11 13:30:51.773826173 +0300
+++ zabbix-6.0.0alpha5/src/go/conf/zabbix_agent2.conf 2021-10-11 13:35:07.332846424 +0300
@@ -10,6 +10,8 @@
# Default:
# PidFile=/tmp/zabbix_agent2.pid
+PidFile=/run/zabbix/zabbix_agent2.pid
+
### Option: LogType
# Specifies where log messages are written to:
# system - syslog
@@ -27,6 +29,8 @@
# Default:
# LogFile=/tmp/zabbix_agent2.log
+LogFile=/var/log/zabbix/zabbix_agent2.log
+
### Option: LogFileSize
# Maximum size of log file in MB.
# 0 - disable automatic log rotation.
@@ -36,6 +40,8 @@
# Default:
# LogFileSize=1
+LogFileSize=0
+
### Option: DebugLevel
# Specifies debug level:
# 0 - basic information about starting and stopping of Zabbix processes
@@ -259,6 +265,8 @@
# Default:
# Include=
+Include=/etc/zabbix/zabbix_agent2.d/*.conf
+
# Include=/usr/local/etc/zabbix_agent2.userparams.conf
# Include=/usr/local/etc/zabbix_agent2.conf.d/
# Include=/usr/local/etc/zabbix_agent2.conf.d/*.conf

View File

@ -0,0 +1,12 @@
diff -urN zabbix-6.2.0rc1.orig/src/go/conf/zabbix_agent2.conf zabbix-6.2.0rc1/src/go/conf/zabbix_agent2.conf
--- zabbix-6.2.0rc1.orig/src/go/conf/zabbix_agent2.conf 2022-06-17 15:12:53.347314289 +0300
+++ zabbix-6.2.0rc1/src/go/conf/zabbix_agent2.conf 2022-06-17 15:13:18.402810532 +0300
@@ -10,7 +10,7 @@
# Default:
# PidFile=/tmp/zabbix_agent2.pid
-PidFile=/run/zabbix/zabbix_agent2.pid
+PidFile=/var/run/zabbix/zabbix_agent2.pid
### Option: LogType
# Specifies where log messages are written to:

191
SOURCES/conf.patch Normal file
View File

@ -0,0 +1,191 @@
diff -urN zabbix-5.4.0/conf/zabbix_agentd.conf zabbix-5.4.0-patched/conf/zabbix_agentd.conf
--- zabbix-5.4.0/conf/zabbix_agentd.conf 2021-04-26 18:52:41.000000000 +0300
+++ zabbix-5.4.0-patched/conf/zabbix_agentd.conf 2021-06-03 13:50:48.085656485 +0300
@@ -10,6 +10,8 @@
# Default:
# PidFile=/tmp/zabbix_agentd.pid
+PidFile=/run/zabbix/zabbix_agentd.pid
+
### Option: LogType
# Specifies where log messages are written to:
# system - syslog
@@ -27,7 +29,7 @@
# Default:
# LogFile=
-LogFile=/tmp/zabbix_agentd.log
+LogFile=/var/log/zabbix/zabbix_agentd.log
### Option: LogFileSize
# Maximum size of log file in MB.
@@ -38,6 +40,8 @@
# Default:
# LogFileSize=1
+LogFileSize=0
+
### Option: DebugLevel
# Specifies debug level:
# 0 - basic information about starting and stopping of Zabbix processes
@@ -293,6 +297,7 @@
# Mandatory: no
# Default:
# User=zabbix
+# NOTE: This option is overriden by settings in systemd service file!
### Option: Include
# You may include individual files or all files in a directory in the configuration file.
@@ -302,6 +307,8 @@
# Default:
# Include=
+Include=/etc/zabbix/zabbix_agentd.d/*.conf
+
# Include=/usr/local/etc/zabbix_agentd.userparams.conf
# Include=/usr/local/etc/zabbix_agentd.conf.d/
# Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf
diff -urN zabbix-5.4.0/conf/zabbix_proxy.conf zabbix-5.4.0-patched/conf/zabbix_proxy.conf
--- zabbix-5.4.0/conf/zabbix_proxy.conf 2021-04-26 18:52:41.000000000 +0300
+++ zabbix-5.4.0-patched/conf/zabbix_proxy.conf 2021-06-03 13:36:33.849788003 +0300
@@ -88,7 +88,7 @@
# Default:
# LogFile=
-LogFile=/tmp/zabbix_proxy.log
+LogFile=/var/log/zabbix/zabbix_proxy.log
### Option: LogFileSize
# Maximum size of log file in MB.
@@ -99,6 +99,8 @@
# Default:
# LogFileSize=1
+LogFileSize=0
+
### Option: DebugLevel
# Specifies debug level:
# 0 - basic information about starting and stopping of Zabbix processes
@@ -138,6 +140,8 @@
# Default:
# PidFile=/tmp/zabbix_proxy.pid
+PidFile=/run/zabbix/zabbix_proxy.pid
+
### Option: SocketDir
# IPC socket directory.
# Directory to store IPC sockets used by internal Zabbix services.
@@ -146,6 +150,8 @@
# Default:
# SocketDir=/tmp
+SocketDir=/run/zabbix
+
### Option: DBHost
# Database host name.
# If set to localhost, socket is used for MySQL.
@@ -414,6 +420,8 @@
# Default:
# SNMPTrapperFile=/tmp/zabbix_traps.tmp
+SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
+
### Option: StartSNMPTrapper
# If 1, SNMP trapper process is started.
#
@@ -529,7 +537,7 @@
#
# Mandatory: no
# Default:
-# ExternalScripts=${datadir}/zabbix/externalscripts
+# ExternalScripts=/usr/lib/zabbix/externalscripts
### Option: FpingLocation
# Location of fping.
diff -urN zabbix-5.4.0/conf/zabbix_server.conf zabbix-5.4.0-patched/conf/zabbix_server.conf
--- zabbix-5.4.0/conf/zabbix_server.conf 2021-04-26 18:52:41.000000000 +0300
+++ zabbix-5.4.0-patched/conf/zabbix_server.conf 2021-06-03 13:37:11.324270989 +0300
@@ -35,7 +35,7 @@
# Default:
# LogFile=
-LogFile=/tmp/zabbix_server.log
+LogFile=/var/log/zabbix/zabbix_server.log
### Option: LogFileSize
# Maximum size of log file in MB.
@@ -46,6 +46,8 @@
# Default:
# LogFileSize=1
+LogFileSize=0
+
### Option: DebugLevel
# Specifies debug level:
# 0 - basic information about starting and stopping of Zabbix processes
@@ -67,6 +69,8 @@
# Default:
# PidFile=/tmp/zabbix_server.pid
+PidFile=/run/zabbix/zabbix_server.pid
+
### Option: SocketDir
# IPC socket directory.
# Directory to store IPC sockets used by internal Zabbix services.
@@ -75,6 +79,8 @@
# Default:
# SocketDir=/tmp
+SocketDir=/run/zabbix
+
### Option: DBHost
# Database host name.
# If set to localhost, socket is used for MySQL.
@@ -373,6 +379,8 @@
# Default:
# SNMPTrapperFile=/tmp/zabbix_traps.tmp
+SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
+
### Option: StartSNMPTrapper
# If 1, SNMP trapper process is started.
#
@@ -538,7 +546,7 @@
#
# Mandatory: no
# Default:
-# AlertScriptsPath=${datadir}/zabbix/alertscripts
+# AlertScriptsPath=/usr/lib/zabbix/alertscripts
### Option: ExternalScripts
# Full path to location of external scripts.
@@ -547,7 +555,7 @@
#
# Mandatory: no
# Default:
-# ExternalScripts=${datadir}/zabbix/externalscripts
+# ExternalScripts=/usr/lib/zabbix/externalscripts
### Option: FpingLocation
# Location of fping.
diff -urN zabbix-5.4.0/src/go/conf/zabbix_web_service.conf zabbix-5.4.0-patched/src/go/conf/zabbix_web_service.conf
--- zabbix-5.4.0/src/go/conf/zabbix_web_service.conf 2021-04-26 18:52:41.000000000 +0300
+++ zabbix-5.4.0-patched/src/go/conf/zabbix_web_service.conf 2021-06-03 13:39:04.704416798 +0300
@@ -20,6 +20,8 @@
# Default:
# LogFile=/tmp/zabbix_web_service.log
+LogFile=/var/log/zabbix/zabbix_web_service.log
+
### Option: LogFileSize
# Maximum size of log file in MB.
# 0 - disable automatic log rotation.
@@ -29,6 +31,8 @@
# Default:
# LogFileSize=1
+LogFileSize=0
+
### Option: DebugLevel
# Specifies debug level:
# 0 - basic information about starting and stopping of Zabbix processes

View File

@ -0,0 +1,54 @@
diff -urN zabbix-6.2.0rc1.orig/conf/zabbix_agentd.conf zabbix-6.2.0rc1/conf/zabbix_agentd.conf
--- zabbix-6.2.0rc1.orig/conf/zabbix_agentd.conf 2022-06-17 15:08:20.256831191 +0300
+++ zabbix-6.2.0rc1/conf/zabbix_agentd.conf 2022-06-17 15:08:43.660356151 +0300
@@ -10,7 +10,7 @@
# Default:
# PidFile=/tmp/zabbix_agentd.pid
-PidFile=/run/zabbix/zabbix_agentd.pid
+PidFile=/var/run/zabbix/zabbix_agentd.pid
### Option: LogType
# Specifies where log messages are written to:
diff -urN zabbix-6.2.0rc1.orig/conf/zabbix_proxy.conf zabbix-6.2.0rc1/conf/zabbix_proxy.conf
--- zabbix-6.2.0rc1.orig/conf/zabbix_proxy.conf 2022-06-17 15:08:20.256831191 +0300
+++ zabbix-6.2.0rc1/conf/zabbix_proxy.conf 2022-06-17 15:09:55.866893477 +0300
@@ -133,7 +133,7 @@
# Default:
# PidFile=/tmp/zabbix_proxy.pid
-PidFile=/run/zabbix/zabbix_proxy.pid
+PidFile=/var/run/zabbix/zabbix_proxy.pid
### Option: SocketDir
# IPC socket directory.
@@ -143,7 +143,7 @@
# Default:
# SocketDir=/tmp
-SocketDir=/run/zabbix
+SocketDir=/var/run/zabbix
### Option: DBHost
# Database host name.
diff -urN zabbix-6.2.0rc1.orig/conf/zabbix_server.conf zabbix-6.2.0rc1/conf/zabbix_server.conf
--- zabbix-6.2.0rc1.orig/conf/zabbix_server.conf 2022-06-17 15:08:20.256831191 +0300
+++ zabbix-6.2.0rc1/conf/zabbix_server.conf 2022-06-17 15:09:29.379429530 +0300
@@ -69,7 +69,7 @@
# Default:
# PidFile=/tmp/zabbix_server.pid
-PidFile=/run/zabbix/zabbix_server.pid
+PidFile=/var/run/zabbix/zabbix_server.pid
### Option: SocketDir
# IPC socket directory.
@@ -79,7 +79,7 @@
# Default:
# SocketDir=/tmp
-SocketDir=/run/zabbix
+SocketDir=/var/run/zabbix
### Option: DBHost
# Database host name.

View File

@ -0,0 +1,39 @@
diff -urN zabbix-5.0.14.orig/src/libs/zbxicmpping/icmpping.c zabbix-5.0.14/src/libs/zbxicmpping/icmpping.c
--- zabbix-5.0.14.orig/src/libs/zbxicmpping/icmpping.c 2021-07-16 18:09:40.807727222 +0300
+++ zabbix-5.0.14/src/libs/zbxicmpping/icmpping.c 2021-07-16 18:11:43.121350484 +0300
@@ -53,34 +53,7 @@
static void get_source_ip_option(const char *fping, const char **option, unsigned char *checked)
{
- FILE *f;
- char *p, tmp[MAX_STRING_LEN];
-
- zbx_snprintf(tmp, sizeof(tmp), "%s -h 2>&1", fping);
-
- if (NULL == (f = popen(tmp, "r")))
- return;
-
- while (NULL != zbx_fgets(tmp, sizeof(tmp), f))
- {
- for (p = tmp; isspace(*p); p++)
- ;
-
- if ('-' == p[0] && 'I' == p[1] && (isspace(p[2]) || ',' == p[2]))
- {
- *option = "-I";
- continue;
- }
-
- if ('-' == p[0] && 'S' == p[1] && (isspace(p[2]) || ',' == p[2]))
- {
- *option = "-S";
- break;
- }
- }
-
- pclose(f);
-
+ *option = "-S";
*checked = 1;
}

54
SOURCES/frontend.patch Normal file
View File

@ -0,0 +1,54 @@
diff -urN zabbix-6.0.0alpha5.orig/ui/include/classes/core/CConfigFile.php zabbix-6.0.0alpha5/ui/include/classes/core/CConfigFile.php
--- zabbix-6.0.0alpha5.orig/ui/include/classes/core/CConfigFile.php 2021-10-25 13:53:56.255241288 +0300
+++ zabbix-6.0.0alpha5/ui/include/classes/core/CConfigFile.php 2021-10-25 13:55:17.469626565 +0300
@@ -25,7 +25,7 @@
const CONFIG_ERROR = 2;
const CONFIG_VAULT_ERROR = 3;
- const CONFIG_FILE_PATH = '/conf/zabbix.conf.php';
+ const CONFIG_FILE_PATH = '/etc/zabbix/web/zabbix.conf.php';
private static $supported_db_types = [
ZBX_DB_MYSQL => true,
diff -urN zabbix-6.0.0alpha5.orig/ui/include/classes/core/ZBase.php zabbix-6.0.0alpha5/ui/include/classes/core/ZBase.php
--- zabbix-6.0.0alpha5.orig/ui/include/classes/core/ZBase.php 2021-10-25 13:53:56.255241288 +0300
+++ zabbix-6.0.0alpha5/ui/include/classes/core/ZBase.php 2021-10-25 13:56:49.379799191 +0300
@@ -368,7 +368,7 @@
* @throws Exception
*/
protected function setMaintenanceMode() {
- require_once 'conf/maintenance.inc.php';
+ require_once '/etc/zabbix/web/maintenance.inc.php';
if (defined('ZBX_DENY_GUI_ACCESS')) {
if (!isset($ZBX_GUI_ACCESS_IP_RANGE) || !in_array(CWebUser::getIp(), $ZBX_GUI_ACCESS_IP_RANGE)) {
@@ -381,7 +381,7 @@
* Load zabbix config file.
*/
protected function loadConfigFile() {
- $configFile = $this->getRootDir().CConfigFile::CONFIG_FILE_PATH;
+ $configFile = CConfigFile::CONFIG_FILE_PATH;
$config = new CConfigFile($configFile);
$this->config = $config->load();
}
diff -urN zabbix-6.0.0alpha5.orig/ui/include/classes/setup/CSetupWizard.php zabbix-6.0.0alpha5/ui/include/classes/setup/CSetupWizard.php
--- zabbix-6.0.0alpha5.orig/ui/include/classes/setup/CSetupWizard.php 2021-10-25 13:53:56.255241288 +0300
+++ zabbix-6.0.0alpha5/ui/include/classes/setup/CSetupWizard.php 2021-10-25 14:00:03.899931721 +0300
@@ -259,7 +259,7 @@
// make zabbix.conf.php downloadable
header('Content-Type: application/x-httpd-php');
header('Content-Disposition: attachment; filename="'.basename(CConfigFile::CONFIG_FILE_PATH).'"');
- $config = new CConfigFile(APP::getInstance()->getRootDir().CConfigFile::CONFIG_FILE_PATH);
+ $config = new CConfigFile(CConfigFile::CONFIG_FILE_PATH);
$config->config = [
'DB' => [
'TYPE' => $this->getConfig('DB_TYPE'),
@@ -793,7 +793,7 @@
$this->setConfig('ZBX_CONFIG_FILE_CORRECT', true);
- $config_file_name = APP::getInstance()->getRootDir().CConfigFile::CONFIG_FILE_PATH;
+ $config_file_name = CConfigFile::CONFIG_FILE_PATH;
$config = new CConfigFile($config_file_name);
$config->config = [
'DB' => [

View File

@ -0,0 +1,79 @@
diff -urN 5.4.orig/src/zabbix_java/lib/logback.xml 5.4/src/zabbix_java/lib/logback.xml
--- 5.4.orig/src/zabbix_java/lib/logback.xml 2021-02-03 14:46:36.510530149 +0200
+++ 5.4/src/zabbix_java/lib/logback.xml 2021-02-03 16:08:48.139648517 +0200
@@ -2,10 +2,10 @@
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>/tmp/zabbix_java.log</file>
+ <file>/var/log/zabbix/zabbix_java_gateway.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>/tmp/zabbix_java.log.%i</fileNamePattern>
+ <fileNamePattern>/var/log/zabbix/zabbix_java_gateway.log.%i</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>3</maxIndex>
</rollingPolicy>
diff -urN 5.4.orig/src/zabbix_java/settings.sh 5.4/src/zabbix_java/settings.sh
--- 5.4.orig/src/zabbix_java/settings.sh 2021-02-03 14:46:36.510530149 +0200
+++ 5.4/src/zabbix_java/settings.sh 2021-02-03 17:30:37.637881653 +0200
@@ -24,7 +24,7 @@
# Default:
# PID_FILE=
-PID_FILE="/tmp/zabbix_java.pid"
+PID_FILE="/var/run/zabbix/zabbix_java_gateway.pid"
### Option: zabbix.startPollers
# Number of worker threads to start.
diff -urN 5.4.orig/src/zabbix_java/shutdown.sh 5.4/src/zabbix_java/shutdown.sh
--- 5.4.orig/src/zabbix_java/shutdown.sh 2021-02-03 14:46:36.510530149 +0200
+++ 5.4/src/zabbix_java/shutdown.sh 2021-02-03 14:54:19.090352858 +0200
@@ -1,7 +1,14 @@
#!/bin/sh
-cd `dirname $0`
-. ./settings.sh
+if [ -r /etc/zabbix/zabbix_java_gateway.conf ]; then
+ . /etc/zabbix/zabbix_java_gateway.conf
+fi
+
+if [ -z $GATEWAY_HOME ]; then
+ GATEWAY_HOME="/usr/share/zabbix-java-gateway"
+fi
+
+cd $GATEWAY_HOME
if [ -n "$PID_FILE" ]; then
if [ -f "$PID_FILE" ]; then
diff -urN 5.4.orig/src/zabbix_java/startup.sh 5.4/src/zabbix_java/startup.sh
--- 5.4.orig/src/zabbix_java/startup.sh 2021-02-03 14:46:36.510530149 +0200
+++ 5.4/src/zabbix_java/startup.sh 2021-02-03 15:51:17.466224873 +0200
@@ -1,7 +1,12 @@
#!/bin/sh
-cd `dirname $0`
-. ./settings.sh
+if [ -r /etc/zabbix/zabbix_java_gateway.conf ]; then
+ . /etc/zabbix/zabbix_java_gateway.conf
+fi
+
+if [ -z $GATEWAY_HOME ]; then
+ GATEWAY_HOME="/usr/share/zabbix-java-gateway"
+fi
if [ -n "$PID_FILE" -a -f "$PID_FILE" ]; then
PID=`cat "$PID_FILE"`
@@ -15,9 +20,9 @@
JAVA=${JAVA:-java}
JAVA_OPTIONS="$JAVA_OPTIONS -server"
-if [ -z "$PID_FILE" ]; then
- JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=logback-console.xml"
-fi
+JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=/etc/zabbix/zabbix_java_gateway_logback.xml"
+
+cd $GATEWAY_HOME
CLASSPATH="lib"
for jar in lib/*.jar bin/*.jar; do

View File

@ -0,0 +1,9 @@
diff -urN zabbix-6.0.4.orig/src/go/pkg/zbxcmd/zbxcmd_nix.go zabbix-6.0.4/src/go/pkg/zbxcmd/zbxcmd_nix.go
--- zabbix-6.0.4.orig/src/go/pkg/zbxcmd/zbxcmd_nix.go 2022-04-11 15:19:08.372205383 +0300
+++ zabbix-6.0.4/src/go/pkg/zbxcmd/zbxcmd_nix.go 2022-04-11 15:19:59.055215492 +0300
@@ -1,4 +1,4 @@
-//go:build !windows
+// +build !windows
/*
** Zabbix

97
SOURCES/zabbix-agent.init Normal file
View File

@ -0,0 +1,97 @@
#!/bin/sh
#
# chkconfig: - 86 14
# description: Zabbix agent daemon
# processname: zabbix_agentd
# config: /etc/zabbix/zabbix_agentd.conf
#
### BEGIN INIT INFO
# Provides: zabbix-agent
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: zabbix zabbix-proxy
# Should-Stop: zabbix zabbix-proxy
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop Zabbix agent
# Description: Zabbix agent
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -x /usr/sbin/zabbix_agentd ]; then
exec=/usr/sbin/zabbix_agentd
else
exit 5
fi
prog=${exec##*/}
conf=/etc/zabbix/zabbix_agentd.conf
pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r')
timeout=10
if [ -f /etc/sysconfig/zabbix-agent ]; then
. /etc/sysconfig/zabbix-agent
fi
if [ -n "$ZABBIX_AGENT_USER" ]; then
user_conf="--user=$ZABBIX_AGENT_USER"
else
user_conf=''
fi
lockfile=/var/lock/subsys/zabbix-agent
start()
{
echo -n $"Starting Zabbix agent: "
daemon $user_conf $exec -c $conf
rv=$?
echo
[ $rv -eq 0 ] && touch $lockfile
return $rv
}
stop()
{
echo -n $"Shutting down Zabbix agent: "
killproc -p $pidfile -d $timeout $prog
rv=$?
echo
[ $rv -eq 0 ] && rm -f $lockfile
return $rv
}
restart()
{
stop
start
}
case "$1" in
start|stop|restart)
$1
;;
force-reload)
restart
;;
status)
status -p $pidfile $prog
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
restart
fi
;;
reload)
action $"Service ${0##*/} does not support the reload action: " /bin/false
exit 3
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 2
;;
esac

View File

@ -0,0 +1,20 @@
[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_agentd.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-agent
Type=forking
Restart=on-failure
PIDFile=/run/zabbix/zabbix_agentd.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
User=zabbix
Group=zabbix
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,4 @@
# Configuration file for /etc/init.d/zabbix-agent service
# User to run zabbix agent as
ZABBIX_AGENT_USER=zabbix

View File

@ -0,0 +1,97 @@
#!/bin/sh
#
# chkconfig: - 86 14
# description: Zabbix agent 2 daemon
# processname: zabbix_agent2
# config: /etc/zabbix/zabbix_agent2.conf
#
### BEGIN INIT INFO
# Provides: zabbix-agent2
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Should-Start: zabbix zabbix-proxy
# Should-Stop: zabbix zabbix-proxy
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop Zabbix agent 2
# Description: Zabbix agent 2
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -x /usr/sbin/zabbix_agent2 ]; then
exec=/usr/sbin/zabbix_agent2
else
exit 5
fi
prog=${exec##*/}
conf=/etc/zabbix/zabbix_agent2.conf
pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r')
timeout=10
if [ -f /etc/sysconfig/zabbix-agent2 ]; then
. /etc/sysconfig/zabbix-agent2
fi
if [ -n "$ZABBIX_AGENT_USER" ]; then
user_conf="--user=$ZABBIX_AGENT_USER"
else
user_conf=''
fi
lockfile=/var/lock/subsys/zabbix-agent2
start()
{
echo -n $"Starting Zabbix agent 2: "
daemon $user_conf $exec -c $conf &>/dev/null &
rv=$?
echo
[ $rv -eq 0 ] && touch $lockfile
return $rv
}
stop()
{
echo -n $"Shutting down Zabbix agent 2: "
killproc -p $pidfile -d $timeout $prog
rv=$?
echo
[ $rv -eq 0 ] && rm -f $lockfile
return $rv
}
restart()
{
stop
start
}
case "$1" in
start|stop|restart)
$1
;;
force-reload)
restart
;;
status)
status -p $pidfile $prog
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
restart
fi
;;
reload)
action $"Service ${0##*/} does not support the reload action: " /bin/false
exit 3
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 2
;;
esac

View File

@ -0,0 +1,20 @@
[Unit]
Description=Zabbix Agent 2
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_agent2.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-agent2
Type=simple
Restart=on-failure
PIDFile=/run/zabbix/zabbix_agent2.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_agent2 -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
User=zabbix
Group=zabbix
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,4 @@
# Configuration file for /etc/init.d/zabbix-agent2 service
# User to run zabbix agent as
ZABBIX_AGENT_USER=zabbix

View File

@ -0,0 +1,134 @@
#! /bin/sh
#
# chkconfig: - 85 15
# description: zabbix java gateway
#
### BEGIN INIT INFO
# Provides: zabbix
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: start and stop zabbix java gateway
# Description: Zabbix Java Gateway
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Source Zabbix Java Gateway configuration
. /etc/zabbix/zabbix_java_gateway.conf
if [ -r "/etc/sysconfig/zabbix-java-gateway" ]; then
. /etc/sysconfig/zabbix-java-gateway
fi
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
RETVAL=0
EXECDIR=/usr/sbin/zabbix_java
case "$1" in
start)
echo -n "Starting zabbix java gateway: "
if [ -n "$PID_FILE" -a -e "$PID_FILE" ]; then
echo "zabbix java gateway is already running"
exit 1
fi
JAVA=${JAVA:-java}
JAVA_OPTIONS="-server $JAVA_OPTIONS"
if [ -z "$PID_FILE" ]; then
JAVA_OPTIONS="$JAVA_OPTIONS -Dlogback.configurationFile=logback-console.xml"
fi
cd $EXECDIR
CLASSPATH="lib"
for jar in {lib,bin}/*.jar; do
if [[ $jar != *junit* ]]; then
CLASSPATH="$CLASSPATH:$jar"
fi
done
if [ -n "$PID_FILE" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.pidFile=$PID_FILE"
fi
if [ -n "$LISTEN_IP" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenIP=$LISTEN_IP"
fi
if [ -n "$LISTEN_PORT" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.listenPort=$LISTEN_PORT"
fi
if [ -n "$START_POLLERS" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.startPollers=$START_POLLERS"
fi
if [ -n "$TIMEOUT" ]; then
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dzabbix.timeout=$TIMEOUT"
fi
tcp_timeout=${TIMEOUT:=3}000
ZABBIX_OPTIONS="$ZABBIX_OPTIONS -Dsun.rmi.transport.tcp.responseTimeout=$tcp_timeout"
COMMAND_LINE="$JAVA $JAVA_OPTIONS -classpath $CLASSPATH $ZABBIX_OPTIONS com.zabbix.gateway.JavaGateway"
if [ -n "$PID_FILE" ]; then
PID=$(su -s /bin/bash -c "$COMMAND_LINE > /dev/null 2>&1 & echo \$!" zabbix)
if ps -p $PID > /dev/null 2>&1; then
echo $PID > $PID_FILE
else
echo "zabbix java gateway did not start"
exit 1
fi
else
exec $COMMAND_LINE
RETVAL=$?
fi
;;
stop)
echo -n "Shutting down zabbix java gateway: "
if [ -n "$PID_FILE" ]; then
if [ -e "$PID_FILE" ]; then
kill `cat $PID_FILE` && rm $PID_FILE
else
echo "zabbix java gateway is not running"
exit 1
fi
else
echo "zabbix java gateway is not configured as a daemon: variable \$PID_FILE is not set"
exit 1
fi
;;
restart)
$0 stop
$0 start
RETVAL=$?
;;
condrestart)
if [ -n "$PID_FILE" -a -e "$PID_FILE" ]; then
$0 stop
$0 start
fi
RETVAL=$?
;;
status)
status -p $PID_FILE $0
RETVAL=$?
exit $RETVAL
;;
*)
echo "Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
;;
esac
[ "$RETVAL" -eq 0 ] && success $"$base startup" || failure $"$base startup"
echo
exit $RETVAL

View File

@ -0,0 +1,17 @@
[Unit]
Description=Zabbix Java Gateway
After=syslog.target
After=network.target
[Service]
Type=forking
KillMode=process
PIDFile=/run/zabbix/zabbix_java_gateway.pid
ExecStart=/usr/sbin/zabbix_java_gateway_startup
ExecStop=/usr/sbin/zabbix_java_gateway_shutdown
SuccessExitStatus=143
User=zabbix
Group=zabbix
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,9 @@
/var/log/zabbix/zabbix_COMPONENT.log {
weekly
rotate 12
compress
delaycompress
missingok
notifempty
create 0664 zabbix zabbix
}

61
SOURCES/zabbix-nginx.conf Normal file
View File

@ -0,0 +1,61 @@
server {
# listen 8080;
# server_name example.com;
root /usr/share/zabbix;
index index.php;
location = /favicon.ico {
log_not_found off;
}
location / {
try_files $uri $uri/ =404;
}
location /assets {
access_log off;
expires 10d;
}
location ~ /\.ht {
deny all;
}
location ~ /(api\/|conf[^\.]|include|locale) {
deny all;
return 404;
}
location /vendor {
deny all;
return 404;
}
location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/run/php-fpm/zabbix.sock;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param DOCUMENT_ROOT /usr/share/zabbix;
fastcgi_param SCRIPT_FILENAME /usr/share/zabbix$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED /usr/share/zabbix$fastcgi_script_name;
include fastcgi_params;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_intercept_errors on;
fastcgi_ignore_client_abort off;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 180;
fastcgi_read_timeout 180;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
}
}

View File

@ -0,0 +1,24 @@
[zabbix]
user = apache
group = apache
listen = /run/php-fpm/zabbix.sock
listen.acl_users = apache,nginx
listen.allowed_clients = 127.0.0.1
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 200
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
php_value[max_execution_time] = 300
php_value[memory_limit] = 128M
php_value[post_max_size] = 16M
php_value[upload_max_filesize] = 2M
php_value[max_input_time] = 300
php_value[max_input_vars] = 10000

88
SOURCES/zabbix-proxy.init Normal file
View File

@ -0,0 +1,88 @@
#!/bin/sh
#
# chkconfig: - 85 15
# description: Zabbix proxy daemon
# config: /etc/zabbix/zabbix_proxy.conf
#
### BEGIN INIT INFO
# Provides: zabbix-proxy
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop Zabbix proxy
# Description: Zabbix proxy
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -x /usr/sbin/zabbix_proxy ]; then
exec=/usr/sbin/zabbix_proxy
else
exit 5
fi
prog=${exec##*/}
conf=/etc/zabbix/zabbix_proxy.conf
pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r')
timeout=10
if [ -f /etc/sysconfig/zabbix-proxy ]; then
. /etc/sysconfig/zabbix-proxy
fi
lockfile=/var/lock/subsys/zabbix-proxy
start()
{
echo -n $"Starting Zabbix proxy: "
daemon $exec -c $conf
rv=$?
echo
[ $rv -eq 0 ] && touch $lockfile
return $rv
}
stop()
{
echo -n $"Shutting down Zabbix proxy: "
killproc -p $pidfile -d $timeout $prog
rv=$?
echo
[ $rv -eq 0 ] && rm -f $lockfile
return $rv
}
restart()
{
stop
start
}
case "$1" in
start|stop|restart)
$1
;;
force-reload)
restart
;;
status)
status -p $pidfile $prog
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
restart
fi
;;
reload)
action $"Service ${0##*/} does not support the reload action: " /bin/false
exit 3
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 2
;;
esac

View File

@ -0,0 +1,32 @@
[Unit]
Description=Zabbix Proxy
After=syslog.target
After=network.target
After=mysql.service
After=mysqld.service
After=mariadb.service
After=postgresql.service
After=pgbouncer.service
After=postgresql-9.4.service
After=postgresql-9.5.service
After=postgresql-9.6.service
After=postgresql-10.service
After=postgresql-11.service
After=postgresql-12.service
After=postgresql-13.service
After=postgresql-14.service
[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_proxy.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-proxy
Type=forking
Restart=on-failure
PIDFile=/run/zabbix/zabbix_proxy.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_proxy -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=0
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,88 @@
#!/bin/sh
#
# chkconfig: - 85 15
# description: Zabbix server daemon
# config: /etc/zabbix/zabbix_server.conf
#
### BEGIN INIT INFO
# Provides: zabbix
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: Start and stop Zabbix server
# Description: Zabbix server
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
if [ -x /usr/sbin/zabbix_server ]; then
exec=/usr/sbin/zabbix_server
else
exit 5
fi
prog=${exec##*/}
conf=/etc/zabbix/zabbix_server.conf
pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r')
timeout=10
if [ -f /etc/sysconfig/zabbix-server ]; then
. /etc/sysconfig/zabbix-server
fi
lockfile=/var/lock/subsys/zabbix-server
start()
{
echo -n $"Starting Zabbix server: "
daemon $exec -c $conf
rv=$?
echo
[ $rv -eq 0 ] && touch $lockfile
return $rv
}
stop()
{
echo -n $"Shutting down Zabbix server: "
killproc -p $pidfile -d $timeout $prog
rv=$?
echo
[ $rv -eq 0 ] && rm -f $lockfile
return $rv
}
restart()
{
stop
start
}
case "$1" in
start|stop|restart)
$1
;;
force-reload)
restart
;;
status)
status -p $pidfile $prog
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
restart
fi
;;
reload)
action $"Service ${0##*/} does not support the reload action: " /bin/false
exit 3
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 2
;;
esac

View File

@ -0,0 +1,32 @@
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target
After=mysql.service
After=mysqld.service
After=mariadb.service
After=postgresql.service
After=pgbouncer.service
After=postgresql-9.4.service
After=postgresql-9.5.service
After=postgresql-9.6.service
After=postgresql-10.service
After=postgresql-11.service
After=postgresql-12.service
After=postgresql-13.service
After=postgresql-14.service
[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_server.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-server
Type=forking
Restart=on-failure
PIDFile=/run/zabbix/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=0
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
d /run/zabbix 0755 zabbix zabbix - -

View File

@ -0,0 +1,41 @@
#
# Zabbix monitoring system php web frontend
#
Alias /zabbix /usr/share/zabbix
ProxyTimeout 300
<Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Require all granted
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
<FilesMatch \.(php|phar)$>
SetHandler "proxy:unix:/run/php-fpm/zabbix.sock|fcgi://localhost"
</FilesMatch>
</Directory>
<Directory "/usr/share/zabbix/conf">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/app">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/include">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/local">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/vendor">
Require all denied
</Directory>

View File

@ -0,0 +1,19 @@
[Unit]
Description=Zabbix Web Service
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_web_service.conf"
EnvironmentFile=-/etc/sysconfig/zabbix_web_service
Type=simple
Restart=on-failure
KillMode=control-group
ExecStart=/usr/sbin/zabbix_web_service -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
User=zabbix
Group=zabbix
[Install]
WantedBy=multi-user.target

59
SOURCES/zabbix-web22.conf Normal file
View File

@ -0,0 +1,59 @@
#
# Zabbix monitoring system php web frontend
#
Alias /zabbix /usr/share/zabbix
<Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
<IfModule mod_php5.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
</IfModule>
</Directory>
<Directory "/usr/share/zabbix/conf">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>
<Directory "/usr/share/zabbix/app">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>
<Directory "/usr/share/zabbix/include">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>
<Directory "/usr/share/zabbix/local">
Order deny,allow
Deny from all
<files *.php>
Order deny,allow
Deny from all
</files>
</Directory>

38
SOURCES/zabbix-web24.conf Normal file
View File

@ -0,0 +1,38 @@
#
# Zabbix monitoring system php web frontend
#
Alias /zabbix /usr/share/zabbix
<Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Require all granted
<IfModule mod_php5.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
</IfModule>
</Directory>
<Directory "/usr/share/zabbix/conf">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/app">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/include">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/local">
Require all denied
</Directory>

22
SOURCES/zabbix_policy.te Normal file
View File

@ -0,0 +1,22 @@
module zabbix_policy 1.2;
require {
type zabbix_t;
type zabbix_port_t;
type zabbix_var_run_t;
type postgresql_port_t;
type httpd_t;
class tcp_socket name_connect;
class sock_file { create unlink };
class unix_stream_socket connectto;
}
#============= zabbix_t ==============
allow zabbix_t self:unix_stream_socket connectto;
allow zabbix_t zabbix_port_t:tcp_socket name_connect;
allow zabbix_t zabbix_var_run_t:sock_file create;
allow zabbix_t zabbix_var_run_t:sock_file unlink;
allow httpd_t zabbix_port_t:tcp_socket name_connect;
#============= httpd_t ==============
allow httpd_t postgresql_port_t:tcp_socket name_connect;

1886
SPECS/zabbix.spec Normal file

File diff suppressed because it is too large Load Diff