Difference between revisions of "Talk:Zabbix"

From SME Server
Jump to navigationJump to search
(→‎SNMP: new section)
 
(4 intermediate revisions by 2 users not shown)
Line 11: Line 11:
 
I know this documentation isn't finished. I have too few time to spend on it, and would really need help.
 
I know this documentation isn't finished. I have too few time to spend on it, and would really need help.
  
I'm runnign SME8B6 and trying to install zabbix from source (had 1.8.5 now on my server).
+
I'm running SME8B6 and trying to install zabbix from source (had 1.8.5 now on my server).
 
I'd like to start to create packages to RHEL5/Centos5 and update packages available as soon as SME8 is released. Maybe we can use the http://wiki.contribs.org/SME8.0_Contribs_QA area for tell everyone our efforts: http://wiki.contribs.org/index.php?title=SME8.0_Contribs_QA&action=edit&section=118
 
I'd like to start to create packages to RHEL5/Centos5 and update packages available as soon as SME8 is released. Maybe we can use the http://wiki.contribs.org/SME8.0_Contribs_QA area for tell everyone our efforts: http://wiki.contribs.org/index.php?title=SME8.0_Contribs_QA&action=edit&section=118
  
Line 30: Line 30:
  
 
then go to the web interface, it will prompt you again for the configuration of the db
 
then go to the web interface, it will prompt you again for the configuration of the db
 +
 +
== migrate manually from one server to another ==
 +
 +
save files and config on old server
 +
 +
cd /root
 +
touch zabconfig
 +
chmod 0700 zabconfig
 +
config print zabbix-agent |sed 's/[=|]/ /g ; s/^/config set /' >zabconfig
 +
config print zabbix-server |sed 's/[=|]/ /g ; s/^/config set /' >>zabconfig
 +
# smeserver-zabbix-server smeserver-zabbix-agent smeserver-zabbix-proxy
 +
if [ -d /etc/zabbix ]; then
 +
  for F in /etc/zabbix/*; do
 +
    rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >>dir.list
 +
  done
 +
fi
 +
if [ -d /etc/zabbix/zabbix_agentd.conf.d ]; then
 +
  for F in /etc/zabbix/zabbix_agentd.conf.d/*; do
 +
    rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >>dir.list
 +
  done
 +
fi
 +
if [ -d /var/lib/zabbix/bin ]; then
 +
  for F in /var/lib/zabbix/bin/*; do
 +
    rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >>dir.list
 +
  done
 +
fi
 +
echo "/var/lib/zabbix/tmp/" >>dir.list
 +
echo "/root/zabconfig"  >>dir.list
 +
tar cvzf zabbix.tgz -T dir.list --xattrs
 +
mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$(config getprop zabbix-server DbName)" | gzip -c > /root/zabbix.sql.gz
 +
 +
then scp to your new server(assuming you SCP from SME9 to SME10, you need to enable a common cipher
 +
scp -c aes128-ctr /root/zabbix.tgz /root/zabbix.sql.gz root@newip:/root
 +
 +
then, on new server, restore  the data
 +
tar -zxf zabbix.tgz --directory /
 +
then restore the config keys
 +
bash zabconfig
 +
then restore the mysqldb, assuming you already had installed mariadb105 on sme10
 +
zcat zabbix.sql.gz |sed 's/ENGINE=MyISAM/ENGINE=InnoDB/g'|mysql105
 +
create user give him privileges
 +
echo "CREATE USER IF NOT EXISTS `config getprop zabbix-server DbUser`@localhost IDENTIFIED BY '`config getprop zabbix-server DbPassword`';"| mysql105
 +
echo "GRANT ALL PRIVILEGES ON `config getprop zabbix-server DbName`.* TO `config getprop zabbix-server DbUser`@localhost; FLUSH PRIVILEGES;" | mysql105
 +
 +
then follow the wiki procedure to install zabbix z50, including the informations about upgrading your database before installing
 +
 +
== Zabbix db  partitionning ==
 +
 +
for huge db with >200 hosts
 +
https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/373410-zabbix-housekeeper-processes-more-than-75-busy
 +
https://bestmonitoringtools.com/zabbix-partitioning-tables-on-mysql-database/
 +
 +
== SNMP ==
 +
 +
in case you need to install MIBS, yo will need last version of git from wandisco if you are on SME 10
 +
will also need to install tree rpm
 +
 +
then
 +
 +
git clone https://github.com/jeonghanlee/snmp-mibs-downloader-env.git
 +
cd snmp-mibs-downloader-env
 +
make init
 +
make install
 +
make get
 +
systemctl restart zabbix-server

Latest revision as of 02:13, 28 June 2023

If I just install the zabbix-server contrib, will that include all I need to monitor the smeserver the server is installed on? Or do I need to install the agent as well?

It would be great to include in this documentation the steps needed to install and fully configure via db command lines the full monitoring of the smeserver the zabbix server is installed on. This would provide enough of an example for users to get going with installing the agent on other smeservers...

Thanks


Hi. I've just added a small note on how-to monitor the localhost here

I know this documentation isn't finished. I have too few time to spend on it, and would really need help.

I'm running SME8B6 and trying to install zabbix from source (had 1.8.5 now on my server). I'd like to start to create packages to RHEL5/Centos5 and update packages available as soon as SME8 is released. Maybe we can use the http://wiki.contribs.org/SME8.0_Contribs_QA area for tell everyone our efforts: http://wiki.contribs.org/index.php?title=SME8.0_Contribs_QA&action=edit&section=118

I've already compiled 1.8.5 for both sme7 and SME8, those package are available in our repo (Fws). I havne't pushed this version in smecontribs repo because the web interface is not compatible with PHP4, so it would break compatibility with standard SME7, but the agent, proxy and server packages works. I need to add a note to the wiki page about this.

upgrade 4.2.6 to 4.4.4

you will need to change encoding for the db

first

 service zabbix-server stop
 mysqldump zabbixdb >zabbixdb.sql
 echo 'ALTER TABLE `zabbixdb`.`problem_tag` DROP INDEX `problem_tag_1`, ADD INDEX `problem_tag_1` (`eventid`, `tag` (100), `value`(100));' |mysql
 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="zabbixdb"' |mysql
 service zabbix-server start


then go to the web interface, it will prompt you again for the configuration of the db

migrate manually from one server to another

save files and config on old server

cd /root
touch zabconfig
chmod 0700 zabconfig
config print zabbix-agent |sed 's/[=|]/ /g ; s/^/config set /' >zabconfig
config print zabbix-server |sed 's/[=|]/ /g ; s/^/config set /' >>zabconfig
# smeserver-zabbix-server smeserver-zabbix-agent smeserver-zabbix-proxy
if [ -d /etc/zabbix ]; then
 for F in /etc/zabbix/*; do
   rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >>dir.list
 done
fi
if [ -d /etc/zabbix/zabbix_agentd.conf.d ]; then
 for F in /etc/zabbix/zabbix_agentd.conf.d/*; do
   rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >>dir.list
 done
fi
if [ -d /var/lib/zabbix/bin ]; then
 for F in /var/lib/zabbix/bin/*; do
   rpm -qf "$F" >/dev/null 2>&1 || echo "$F" >>dir.list
 done
fi
echo "/var/lib/zabbix/tmp/" >>dir.list
echo "/root/zabconfig"  >>dir.list
tar cvzf zabbix.tgz -T dir.list --xattrs
mysqldump --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$(config getprop zabbix-server DbName)" | gzip -c > /root/zabbix.sql.gz

then scp to your new server(assuming you SCP from SME9 to SME10, you need to enable a common cipher

scp -c aes128-ctr /root/zabbix.tgz /root/zabbix.sql.gz root@newip:/root

then, on new server, restore the data

tar -zxf zabbix.tgz --directory /

then restore the config keys

bash zabconfig

then restore the mysqldb, assuming you already had installed mariadb105 on sme10

zcat zabbix.sql.gz |sed 's/ENGINE=MyISAM/ENGINE=InnoDB/g'|mysql105

create user give him privileges

echo "CREATE USER IF NOT EXISTS `config getprop zabbix-server DbUser`@localhost IDENTIFIED BY '`config getprop zabbix-server DbPassword`';"| mysql105
echo "GRANT ALL PRIVILEGES ON `config getprop zabbix-server DbName`.* TO `config getprop zabbix-server DbUser`@localhost; FLUSH PRIVILEGES;" | mysql105

then follow the wiki procedure to install zabbix z50, including the informations about upgrading your database before installing

Zabbix db partitionning

for huge db with >200 hosts https://www.zabbix.com/forum/zabbix-troubleshooting-and-problems/373410-zabbix-housekeeper-processes-more-than-75-busy https://bestmonitoringtools.com/zabbix-partitioning-tables-on-mysql-database/

SNMP

in case you need to install MIBS, yo will need last version of git from wandisco if you are on SME 10 will also need to install tree rpm

then

git clone https://github.com/jeonghanlee/snmp-mibs-downloader-env.git
cd snmp-mibs-downloader-env
make init
make install
make get
systemctl restart zabbix-server