/[smecontribs]/rpms/smeserver-zabbix-server/contribs10/smeserver-zabbix-server-0.1-z50.patch
ViewVC logotype

Diff of /rpms/smeserver-zabbix-server/contribs10/smeserver-zabbix-server-0.1-z50.patch

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

Revision 1.1 by jpp, Sun Dec 11 01:45:54 2022 UTC Revision 1.2 by jpp, Sun Dec 11 03:04:05 2022 UTC
# Line 1  Line 1 
1  diff -Nur --no-dereference smeserver-zabbix-server-0.1.old/createlinks smeserver-zabbix-server-0.1/createlinks  diff -Nur --no-dereference smeserver-zabbix-server-0.1.old/createlinks smeserver-zabbix-server-0.1/createlinks
2  --- smeserver-zabbix-server-0.1.old/createlinks 2022-12-10 02:37:45.031000000 -0500  --- smeserver-zabbix-server-0.1.old/createlinks 2022-12-10 02:37:45.031000000 -0500
3  +++ smeserver-zabbix-server-0.1/createlinks     2022-12-10 20:44:05.704000000 -0500  +++ smeserver-zabbix-server-0.1/createlinks     2022-12-10 21:14:41.987000000 -0500
4  @@ -40,6 +40,7 @@  @@ -15,7 +15,7 @@
5     templates2events("/etc/sudoers", $event);
6     templates2events("/var/lib/zabbix/bin/sendxmpp", $event);
7     templates2events("/var/lib/zabbix/.sendxmpprc", $event);
8    -templates2events("/etc/e-smith/sql/init/80zabbix-server", qw(zabbix-server-update bootstrap-console-save));
9    +templates2events("/etc/e-smith/sql/init105/80zabbix-server", qw(zabbix-server-update bootstrap-console-save));
10     templates2events("/etc/rc.d/init.d/masq", $event);
11    
12     # Services to restart
13    @@ -40,10 +40,11 @@
14   #Systemd start stop   #Systemd start stop
15   # rpm update action (invoked by yum on install and update   # rpm update action (invoked by yum on install and update
16   $contrib = "smeserver-zabbix-server";   $contrib = "smeserver-zabbix-server";
17  +safe_symlink("/etc/e-smith/events/$contrib-update", "root/etc/e-smith/events/$contrib-z50-update");  +safe_symlink("/etc/e-smith/events/$contrib-update", "root/etc/e-smith/events/$contrib-z50-update");
18   event_actions("$contrib-update", qw(   event_actions("$contrib-update", qw(
19     systemd-default 10  -  systemd-default 10
20     systemd-reload 12  -  systemd-reload 12
21    -  zabbix-server 50
22    +  systemd-default 88
23    +  systemd-reload 89
24    +  zabbix-server 92
25     ));
26    
27     event_templates("$contrib-update", qw(
28    @@ -51,7 +52,7 @@
29       /etc/crontab
30       /etc/rc.d/init.d/masq
31       /etc/sudoers
32    -  /etc/e-smith/sql/init/80zabbix-server
33    +  /etc/e-smith/sql/init105/80zabbix-server
34       /etc/zabbix/zabbix.conf.php
35       /etc/zabbix/web/zabbix.conf.php
36       /var/lib/zabbix/bin/sendxmpp
37    @@ -67,6 +68,8 @@
38       httpd-e-smith sigusr1
39       php74-php-fpm  reload
40       masq          adjust
41    -  zabbix-server restart
42     ));
43    
44    +#zabbix server 92 will stop zabbix, restart mariadb105-mysql.init and start zabbix
45    +#that is why those services are not listed in event_service. order matter.
46    +#also this is at the end to be sure that mariadb105 is installed and running
47    diff -Nur --no-dereference 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
48    --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/events/actions/zabbix-server       2022-12-10 02:37:44.990000000 -0500
49    +++ smeserver-zabbix-server-0.1/root/etc/e-smith/events/actions/zabbix-server   2022-12-10 21:12:05.409000000 -0500
50    @@ -1,7 +1,7 @@
51     #!/bin/bash
52     # restart mysql.init
53     /usr/bin/systemctl stop zabbix-server  1>/dev/null
54    -/usr/bin/systemctl restart mysql.init  1>/dev/null
55    +/usr/bin/systemctl restart mariadb105-mysql.init  1>/dev/null
56     /usr/bin/systemctl start zabbix-server 1>/dev/null
57     exit 0
58    
59    diff -Nur --no-dereference 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
60    --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/e-smith/sql/init/80zabbix-server     2022-12-10 02:37:45.025000000 -0500
61    +++ smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/e-smith/sql/init/80zabbix-server 1969-12-31 19:00:00.000000000 -0500
62    @@ -1,93 +0,0 @@
63    -{
64    -my $db = ${'zabbix-server'}{'DbName'} || 'zabbixdb';
65    -my $user = ${'zabbix-server'}{'DbUser'} || 'zabbixuser';
66    -my $pass = ${'zabbix-server'}{'DbPassword'} || 'secret';
67    -
68    -my $schema = `rpm -qd zabbix-server-mysql | grep create`;
69    -chomp $schema;
70    -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";
71    -chomp $curcharset;
72    -my $adminpass= ${'zabbix-server'}{'AdminPassword'} || 'zabbix';
73    -
74    -$OUT .= <<"END";
75    -#! /bin/sh
76    -if [ -d /var/lib/mysql/$db ]; then
77    -
78    -       # check if utf8
79    -        if [[ "$curcharset" != "utf8" ]] ;then
80    -                echo "ALTER DATABASE $db CHARACTER SET utf8 COLLATE utf8_bin;" |/usr/bin/mysql
81    -                echo 'ALTER TABLE `$db`.`problem_tag` DROP INDEX `problem_tag_1`, ADD INDEX `problem_tag_1` (`eventid`, `tag` (100), `value`(100));' |mysql
82    -                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
83    -        fi
84    -       for P in \$(rpm -qd zabbix-server-mysql | grep dbpatch | grep mysql); do
85    -               /usr/bin/mysql $db < \$P
86    -       done
87    -else
88    -       echo "CREATE DATABASE $db CHARACTER SET utf8 COLLATE utf8_bin;" | /usr/bin/mysql
89    -       /usr/bin/gunzip < $schema |     /usr/bin/mysql $db
90    -
91    -fi
92    -
93    -/usr/bin/mysql <<EOF
94    -USE $db;
95    -update users set passwd=md5('$adminpass') where alias='Admin' and passwd=md5('zabbix');
96    -EOF
97    -
98    -
99    -/usr/bin/mysql <<EOF
100    -USE mysql;
101    -
102    -REPLACE INTO user (
103    -                     host,
104    -                     user,
105    -                     password)
106    -            VALUES (
107    -                     'localhost',
108    -                     '${'zabbix-server'}{DbUser}',
109    -                     PASSWORD ('${'zabbix-server'}{DbPassword}'));
110    -
111    -
112    -REPLACE INTO db (
113    -                   host,
114    -                   db,
115    -                   user,
116    -                   select_priv, insert_priv, update_priv, delete_priv,
117    -                   create_priv, alter_priv, index_priv, drop_priv, create_tmp_table_priv,
118    -                   grant_priv, lock_tables_priv, references_priv)
119    -          VALUES (
120    -                   'localhost',
121    -                   '${'zabbix-server'}{DbName}',
122    -                   '${'zabbix-server'}{DbUser}',
123    -                   'Y', 'Y', 'Y', 'Y',
124    -                   'Y', 'Y', 'Y', 'Y', 'Y',
125    -                   'N', 'Y', 'Y');
126    -
127    -FLUSH PRIVILEGES;
128    -
129    -USE ${'zabbix-server'}{DbName};
130    -
131    -INSERT IGNORE INTO media_type (
132    -               mediatypeid,
133    -               type, description,
134    -               smtp_server,
135    -               smtp_helo,
136    -               smtp_email,
137    -               exec_path,
138    -               gsm_modem,
139    -               username,
140    -               passwd)
141    -       VALUES(
142    -               4,
143    -               1,
144    -               'xmpp',
145    -               '',
146    -               '',
147    -               '',
148    -               'sendxmpp',
149    -               '',
150    -               '',
151    -               '');
152    -
153    -EOF
154    -END
155    -}
156    diff -Nur --no-dereference smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/e-smith/sql/init105/80zabbix-server smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/e-smith/sql/init105/80zabbix-server
157    --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/e-smith/sql/init105/80zabbix-server  1969-12-31 19:00:00.000000000 -0500
158    +++ smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/e-smith/sql/init105/80zabbix-server      2022-12-10 21:48:11.872000000 -0500
159    @@ -0,0 +1,70 @@
160    +{
161    +my $db = ${'zabbix-server'}{'DbName'} || 'zabbixdb';
162    +my $user = ${'zabbix-server'}{'DbUser'} || 'zabbixuser';
163    +my $pass = ${'zabbix-server'}{'DbPassword'} || 'secret';
164    +
165    +my $schema = `rpm -qd zabbix-server-mysql | grep create`;
166    +chomp $schema;
167    +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";
168    +chomp $curcharset;
169    +my $adminpass= ${'zabbix-server'}{'AdminPassword'} || 'zabbix';
170    +
171    +$OUT .= <<"END";
172    +#! /bin/sh
173    +#if [ -d /var/lib/mysql/$db ]; then
174    +if [ -d /var/opt/rh/rh-mariadb105/lib/mysql/$db ]; then
175    +       # check if utf8
176    +        if [[ "$curcharset" != "utf8" ]] ;then
177    +                echo "ALTER DATABASE $db CHARACTER SET utf8 COLLATE utf8_bin;" |/usr/bin/mysql105
178    +                echo 'ALTER TABLE `$db`.`problem_tag` DROP INDEX `problem_tag_1`, ADD INDEX `problem_tag_1` (`eventid`, `tag` (100), `value`(100));' |/usr/bin/mysql105
179    +                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
180    +        fi
181    +       for P in \$(rpm -qd zabbix-server-mysql | grep dbpatch | grep mysql); do
182    +               /usr/bin/mysql105 $db < \$P
183    +       done
184    +else
185    +       echo "CREATE DATABASE $db CHARACTER SET utf8 COLLATE utf8_bin;" | /usr/bin/mysql105
186    +       /usr/bin/gunzip < $schema |     /usr/bin/mysql105 $db
187    +
188    +fi
189    +
190    +/usr/bin/mysql105 <<EOF
191    +USE $db;
192    +update users set passwd=md5('$adminpass') where alias='Admin' and passwd=md5('zabbix');
193    +EOF
194    +
195    +
196    +/usr/bin/mysql105 <<EOF
197    +USE mysql;
198    +
199    +grant all on $db.* to '${'zabbix-server'}{DbUser}'\@'localhost' identified by '${'zabbix-server'}{DbPassword}';
200    +
201    +FLUSH PRIVILEGES;
202    +
203    +USE ${'zabbix-server'}{DbName};
204    +
205    +INSERT IGNORE INTO media_type (
206    +               mediatypeid,
207    +               type, description,
208    +               smtp_server,
209    +               smtp_helo,
210    +               smtp_email,
211    +               exec_path,
212    +               gsm_modem,
213    +               username,
214    +               passwd)
215    +       VALUES(
216    +               4,
217    +               1,
218    +               'xmpp',
219    +               '',
220    +               '',
221    +               '',
222    +               'sendxmpp',
223    +               '',
224    +               '',
225    +               '');
226    +
227    +EOF
228    +END
229    +}
230    diff -Nur --no-dereference smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/zabbix/zabbix.conf.php/10database smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix.conf.php/10database
231    --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/zabbix/zabbix.conf.php/10database    2009-02-02 22:01:01.000000000 -0500
232    +++ smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix.conf.php/10database        2022-12-10 22:03:00.362000000 -0500
233    @@ -1,7 +1,7 @@
234     global $DB;
235    
236     $DB["TYPE"]             = "MYSQL";
237    -$DB["SERVER"]           = "localhost";
238    +$DB["SERVER"]           = "{$OUT = ( -d "/var/lib/mysql/zabbixdb") ? "localhost" : "localhost:/var/lib/mysql/mariadb105.sock"}";
239     $DB["PORT"]             = "0";
240    
241     {
242    diff -Nur --no-dereference smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/zabbix/zabbix_server.conf/80database smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_server.conf/80database
243    --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates/etc/zabbix/zabbix_server.conf/80database 2022-12-10 02:37:44.939000000 -0500
244    +++ smeserver-zabbix-server-0.1/root/etc/e-smith/templates/etc/zabbix/zabbix_server.conf/80database     2022-12-10 21:28:53.268000000 -0500
245    @@ -28,7 +28,8 @@
246    
247     # Connect to MySQL using Unix socket?
248    
249    -DBSocket=/var/lib/mysql/mysql.sock
250    +#DBSocket=/var/lib/mysql/mysql.sock
251    +DBSocket=/var/lib/mysql/{$OUT = ( -d "/var/lib/mysql/zabbixdb") ? "mysql" : "mariadb105"}.sock
252    
253     # Enable database cache module
254     StartDBSyncers=1
255    diff -Nur --no-dereference smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/80zabbix-server smeserver-zabbix-server-0.1/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/80zabbix-server
256    --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/80zabbix-server    2009-02-02 17:40:29.000000000 -0500
257    +++ smeserver-zabbix-server-0.1/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init/80zabbix-server        1969-12-31 19:00:00.000000000 -0500
258    @@ -1 +0,0 @@
259    -PERMS=0750
260    diff -Nur --no-dereference smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init105/80zabbix-server smeserver-zabbix-server-0.1/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init105/80zabbix-server
261    --- smeserver-zabbix-server-0.1.old/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init105/80zabbix-server 1969-12-31 19:00:00.000000000 -0500
262    +++ smeserver-zabbix-server-0.1/root/etc/e-smith/templates.metadata/etc/e-smith/sql/init105/80zabbix-server     2009-02-02 17:40:29.000000000 -0500
263    @@ -0,0 +1 @@
264    +PERMS=0750


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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