Zabbix Documentation 5.0
Install and configure Zabbix 4.0
https://serveradmin.ru/ustanovka-i-nastroyka-zabbix-4-0/
Monitoring SNMP devices with Zabbix:
https://www.experts-exchange.com/articles/31203/Monitoring-SNMP-devices-with-Zabbix.html
ESXi:
# esxcli system snmp set –communities GokuBlack
# esxcli system snmp set –syscontact=”Zamasu <zamasu@dbsuper.com>”
# esxcli system snmp set –syslocation=”Universe10 – IT Room”
# esxcli system snmp set –enable true
https://techexpert.tips/ru/vmware-ru/zabbix-monitor-vmware-esxi-с-использованием-snmp/
https://sysadmin-note.ru/monitoring-esxi-6-zabbix-3-x/
https://habr.com/en/sandbox/135130/
https://www.zabbix.org/wiki/Esxi_standalone_template
Integration with Mattermost:
https://www.zabbix.com/integrations/mattermost
https://habr.com/ru/post/442404/
chmod 755 /usr/lib/zabbix/alertscripts/zabbixMatterBot.pl
“Can’t locate JSON.pm in @inc” error: sudo apt-get install libjson-perl
Bot or webhook will use the name of the user that created it.
Mysql Databases Cleanup:
https://www.zabbix.com/forum/zabbix-help/438523-how-to-set-zabbix-to-delete-old-data?p=438544#post438544
https://www.zabbix.com/forum/zabbix-cookbook/465716-how-to-cleanup-database-disk-space-from-oversized-auditlog-database-table
First of all check that you have enough disk space and start from smallest databases.
List zabbix databases and make a decision which of them you want to reduce in size:
ls -l /var/lib/mysql/zabbix
Stop zabbix service:
/etc/init.d/zabbix-server stop
Find date unlil you want to keep history and convert it to unix format here:
https://www.unixtimestamp.com/
Login to mysql:
mysql -p zabbix
Reduce databases you want:
DELETE FROM alerts WHERE clock < UNIXTIMEFORMAT;
OPTIMIZE TABLE alerts;
analyze table alerts;
DELETE FROM trends WHERE clock < UNIXTIMEFORMAT;
OPTIMIZE TABLE trends;
analyze table trends;
DELETE FROM trends_uint WHERE clock < UNIXTIMEFORMAT;
OPTIMIZE TABLE trends_uint;
analyze table trends_uint;
DELETE FROM history WHERE clock < UNIXTIMEFORMAT;
OPTIMIZE TABLE history;
analyze table history;
DELETE FROM history_str WHERE clock < UNIXTIMEFORMAT;
OPTIMIZE TABLE history_str;
analyze table history_str;
DELETE FROM history_text WHERE clock < UNIXTIMEFORMAT;
OPTIMIZE TABLE history_text;
analyze table history_text;
DELETE FROM history_uint WHERE clock < UNIXTIMEFORMAT;
OPTIMIZE TABLE history_uint;
analyze table history_uint;
exit
Start zabbix service:
/etc/init.d/zabbix-server start
nano /etc/zabbix/zabbix_server.conf
HousekeepingFrequency=1
MaxHousekeeperDelete=0
Set Housekeeping to 90 days in zabbix configuration
Generate UUIDs:
https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/450493-uuid-when-importing-new-items
PHP v1:
//content
$content = file_get_contents('old.yaml');
$content = preg_replace_callback("|uuid: (.*)\n|U", function ($matches) { return "uuid: ".str_replace('-', '', generateUUIDv4())."\n"; }, $content);
$fp = fopen("new.yaml", "w");
fwrite($fp, $content);
fclose($fp);
function generateUUIDv4() {
$data = random_bytes(16);
// Set version (4) and variant (2) bits
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
// Convert binary data to hexadecimal format
$uuid = vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
return $uuid;
}
echo $content
PHP v2:
# Define the file path
$filePath = "C:\path\to\your\file.yaml"
# Read the file content
$content = Get-Content $filePath -Raw
# Define the regex pattern to find UUIDs
$pattern = '(?<=uuid:\s)[0-9a-f]{32}'
# Function to generate a new UUID
function New-UUID {
return [guid]::NewGuid().ToString('N')
}
# Replace all found UUIDs with new ones
$newContent = [regex]::Replace($content, $pattern, { param($match) New-UUID })
# Write the modified content back to the file
$newContent | Set-Content $filePath -NoNewline
Write-Host "UUIDs successfully replaced in file $filePath"
Or in Notepad++ with plugin PythonScript:
import uuid
def calculate(match):
IdNew = str(uuid.uuid4()).replace("-", "")
return '- uuid: ' + IdNew
editor.rereplace(r'- uuid: [A-Za-z0-9]+', calculate)
