/[smecontribs]/rpms/smeserver-zabbix-server/contribs9/smeserver-zabbix-server-0.1-zabbix4.4.6.patch
ViewVC logotype

Contents of /rpms/smeserver-zabbix-server/contribs9/smeserver-zabbix-server-0.1-zabbix4.4.6.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Thu May 14 02:21:50 2020 UTC (4 years, 6 months ago) by jpp
Branch: MAIN
CVS Tags: smeserver-zabbix-server-0_1-19_el6_sme, HEAD
Changes since 1.3: +41 -40 lines
* Sun May 10 2020 Jean-Philipe Pialasse <tests@pialasse.com> 0.1-19.sme
- adapt for zabbix 4.4.6

1 diff -Nur smeserver-zabbix-server-0.1.old/createlinks smeserver-zabbix-server-0.1/createlinks
2 --- smeserver-zabbix-server-0.1.old/createlinks 2020-05-13 22:05:14.431000000 -0400
3 +++ smeserver-zabbix-server-0.1/createlinks 2020-05-13 22:18:11.840000000 -0400
4 @@ -8,6 +8,8 @@
5 templates2events("/etc/httpd/conf/httpd.conf", $event);
6 templates2events("/etc/zabbix/zabbix_server.conf", qw(zabbix-server-update bootstrap-console-save));
7 templates2events("/etc/zabbix/zabbix.conf.php", qw(zabbix-server-update bootstrap-console-save));
8 +# new path with zabbix 4.4.6
9 +templates2events("/etc/zabbix/web/zabbix.conf.php", qw(zabbix-server-update bootstrap-console-save));
10 templates2events("/etc/sudoers", $event);
11 templates2events("/var/lib/zabbix/bin/sendxmpp", $event);
12 templates2events("/var/lib/zabbix/.sendxmpprc", $event);
13 @@ -15,10 +17,11 @@
14 templates2events("/etc/rc.d/init.d/masq", $event);
15
16 # Services to restart
17 -safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
18 +#safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/mysql.init");
19 safe_symlink("sigusr1", "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith");
20 safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/zabbix-server");
21 safe_symlink("adjust", "root/etc/e-smith/events/$event/services2adjust/masq");
22 +safe_symlink("/etc/e-smith/events/actions/zabbix-server","root/etc/e-smith/events/$event/50zabbix-server");
23
24 # PHP header and footer
25 safe_symlink("/etc/e-smith/templates-default/template-begin-php", "root/etc/e-smith/templates/etc/zabbix/zabbix.conf.php/template-begin");
26 diff -Nur smeserver-zabbix-server-0.1.old/root/etc/e-smith/events/actions/zabbix-server smeserver-zabbix-server-0.1/root/etc/e-smith/events/actions/zabbix-server
27 --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/events/actions/zabbix-server 1969-12-31 19:00:00.000000000 -0500
28 +++ smeserver-zabbix-server-0.1/root/etc/e-smith/events/actions/zabbix-server 2020-05-13 22:05:54.925000000 -0400
29 @@ -0,0 +1,7 @@
30 +#!/bin/bash
31 +# restart mysql.init
32 +/sbin/service zabbix-server stop 1>/dev/null
33 +/sbin/service mysql.init restart 1>/dev/null
34 +/sbin/service zabbix-server start 1>/dev/null
35 +exit 0
36 +
37 diff -Nur smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/e-smith/sql/init/80zabbix-server smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/e-smith/sql/init/80zabbix-server
38 --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/e-smith/sql/init/80zabbix-server 2020-05-13 22:05:14.450000000 -0400
39 +++ smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/e-smith/sql/init/80zabbix-server 2020-05-13 22:07:18.871000000 -0400
40 @@ -1,27 +1,30 @@
41 {
42 -my $db = ${'zabbix-server'}{'DbName'} || 'zabbix';
43 -my $user = ${'zabbix-server'}{'DbUser'} || 'zabbix';
44 +my $db = ${'zabbix-server'}{'DbName'} || 'zabbixdb';
45 +my $user = ${'zabbix-server'}{'DbUser'} || 'zabbixuser';
46 my $pass = ${'zabbix-server'}{'DbPassword'} || 'secret';
47
48 -my $schema = `rpm -qd zabbix-server-mysql | grep schema | grep mysql`;
49 -$schema = `rpm -qd zabbix-server | grep schema | grep mysql` if $schema eq '';
50 -my $data = `rpm -qd zabbix-server-mysql | grep data.sql`;
51 -$data = `rpm -qd zabbix-server| grep mysql | grep data.sql` if $data eq '';
52 -my $images = `rpm -qd zabbix-server-mysql | grep images_mysql`;
53 -$images = `rpm -qd zabbix-server | grep mysql |grep images` if $images eq '';
54 -
55 +my $schema = `rpm -qd zabbix-server-mysql | grep create`;
56 +chomp $schema;
57 +my $curcharset=`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/'`;
58 +chomp $curcharset;
59
60 $OUT .= <<"END";
61 #! /bin/sh
62 if [ -d /var/lib/mysql/$db ]; then
63 - for P in \$(rpm -qd zabbix-server | grep dbpatch | grep mysql); do
64 +
65 + # check if utf8
66 + if [[ "$curcharset" != "utf8" ]] ;then
67 + echo "ALTER DATABASE $db CHARACTER SET utf8 COLLATE utf8_bin;" |/usr/bin/mysql
68 + echo 'ALTER TABLE `$db`.`problem_tag` DROP INDEX `problem_tag_1`, ADD INDEX `problem_tag_1` (`eventid`, `tag` (100), `value`(100));' |mysql
69 + 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"' |mysql
70 + fi
71 + for P in \$(rpm -qd zabbix-server-mysql | grep dbpatch | grep mysql); do
72 /usr/bin/mysql $db < \$P
73 done
74 else
75 - /usr/bin/mysqladmin create $db
76 - /usr/bin/mysql $db < $schema
77 - /usr/bin/mysql $db < $data
78 - /usr/bin/mysql $db < $images
79 + echo "CREATE DATABASE $db CHARACTER SET utf8 COLLATE utf8_bin;" | /usr/bin/mysql
80 + /usr/bin/gunzip < $schema | /usr/bin/mysql $db
81 +
82 fi
83
84 /usr/bin/mysql <<EOF
85 diff -Nur smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98zabbix-web smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98zabbix-web
86 --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98zabbix-web 2020-05-13 22:05:14.446000000 -0400
87 +++ smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98zabbix-web 2020-05-13 22:05:54.925000000 -0400
88 @@ -24,6 +24,7 @@
89 php_admin_value memory_limit 256M
90 php_admin_value date.timezone $tz
91 php_admin_value post_max_size 32M
92 + php_admin_value always_populate_raw_post_data -1
93 AllowOverride None
94 Order allow,deny
95 Allow from $access
96 diff -Nur smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates.metadata/etc/zabbix/web/zabbix.conf.php smeserver-zabbix-server-0.1/root/etc/e-smith/templates.metadata/etc/zabbix/web/zabbix.conf.php
97 --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates.metadata/etc/zabbix/web/zabbix.conf.php 1969-12-31 19:00:00.000000000 -0500
98 +++ smeserver-zabbix-server-0.1/root/etc/e-smith/templates.metadata/etc/zabbix/web/zabbix.conf.php 2020-05-13 22:15:54.659000000 -0400
99 @@ -0,0 +1,3 @@
100 +TEMPLATE_PATH="/etc/zabbix/zabbix.conf.php"
101 +OUTPUT_FILENAME="/etc/zabbix/web/zabbix.conf.php"
102 +

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed