You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+147
Original file line number
Diff line number
Diff line change
@@ -359,6 +359,153 @@ Or through the Zabbix web interface:
359
359
re_send = False
360
360
```
361
361
362
+
**Major update**
363
+
If you want to upgrade mamonsu to a version that is not compatible with the previous one, what you must do to continue using the application depends on whether you need to retain the metrics data collected.
364
+
If you do not need to retain the collected data, just unlink old template and link a new one.
365
+
366
+
If you need to retain the collected data, do the following:
367
+
368
+
1. Install the new version of mamonsu.
369
+
2. Generate a new template for the Zabbix server.
370
+
3. If you performed a bootstrap using the previous version of mamonsu, run the bootstrap command again.
371
+
4. Upload the new template to the Zabbix server.
372
+
5. Rename the host for which you want to retain the collected data and leave the old template linked to that host.
373
+
6. Create a new host for the same system and link the new template to it.
374
+
7. Restart mamonsu. It will collect data for the new host. The old host will no longer be used, but the data collected will be available.
375
+
376
+
The difficulty is that Zabbix cannot massively rename nodes.
377
+
We offer the following recommendations:
378
+
1. If you have access to the Zabbix database:
379
+
Mass rename hosts via SQL:
380
+
```shell
381
+
zabbix=# SELECT host, name FROM hosts
382
+
zabbix-# WHERE host LIKE '%local-pg%';
383
+
-[ RECORD 1 ]----
384
+
host | local-pg-2
385
+
name | local-pg-2
386
+
-[ RECORD 2 ]----
387
+
host | local-pg-3
388
+
name | local-pg-3
389
+
390
+
zabbix=# UPDATE hosts
391
+
zabbix=# SET host = host || ' OLD-MAMONSU',
392
+
zabbix=# name = name || ' OLD-MAMONSU'
393
+
zabbix=# WHERE host LIKE '%local-pg%';
394
+
UPDATE 2
395
+
zabbix=# SELECT host, name FROM hosts
396
+
zabbix=# WHERE host LIKE '%local-pg%';
397
+
-[ RECORD 1 ]----------------
398
+
host | local-pg-2 OLD-MAMONSU
399
+
name | local-pg-2 OLD-MAMONSU
400
+
-[ RECORD 2 ]----------------
401
+
host | local-pg-3 OLD-MAMONSU
402
+
name | local-pg-3 OLD-MAMONSU
403
+
```
404
+
2. Using Zabbix API:
405
+
API query:
406
+
```shell
407
+
curl -H "Content-type: application/json-rpc" -X POST http://zabbix/api_jsonrpc.php -d'
408
+
{
409
+
"jsonrpc": "2.0",
410
+
"method": "host.update",
411
+
"params": {
412
+
"hostid": "HOST_ID",
413
+
"host": "local-pg-3 OLD-MAMONSU",
414
+
"name": "local-pg-3 OLD-MAMONSU"
415
+
},
416
+
"auth": "AUTH_TOKEN",
417
+
"id": 1
418
+
}'
419
+
```
420
+
<details>
421
+
<summary>Script</summary>
422
+
423
+
```shell
424
+
#!/bin/bash
425
+
426
+
ZABBIX_URL="http://zabbix/"
427
+
ZABBIX_USER="Admin"
428
+
ZABBIX_PASSWORD="zabbix"
429
+
ZABBIX_PATTERN=""
430
+
ZABBIX_SUFFIX="OLD"
431
+
432
+
forparameterin"$@"
433
+
do
434
+
case$parameterin
435
+
-u=*|--url=*) # zabbix url
436
+
ZABBIX_URL="${parameter#*=}"
437
+
shift
438
+
;;
439
+
-U=*|--user=*) # zabbix user
440
+
ZABBIX_USER="${parameter#*=}"
441
+
shift
442
+
;;
443
+
-P=*|--password=*) # zabbix password
444
+
ZABBIX_PASSWORD="${parameter#*=}"
445
+
shift
446
+
;;
447
+
-p=*|--pattern=*) # zabbix host pattern
448
+
ZABBIX_PATTERN="${parameter#*=}"
449
+
shift
450
+
;;
451
+
-s=*|--suffix=*) # zabbix host suffix
452
+
ZABBIX_SUFFIX="${parameter#*=}"
453
+
shift
454
+
;;
455
+
*)
456
+
# unknown option
457
+
;;
458
+
esac
459
+
done
460
+
461
+
# get zabbix auth token
462
+
auth_token=$(curl -H "Content-type: application/json-rpc" -X POST ${ZABBIX_URL}api_jsonrpc.php -d'
0 commit comments