Advertisement
jilapat

Install Zabbix with Telegram Library

Apr 25th, 2017
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. ====Install Script====
  2. ===Preparation to install Zabbix===
  3. rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
  4. yum install zabbix-server-mysql zabbix-web-mysql mariadb-server net-tools zabbix-agent python-pip unzip wget -y
  5. systemctl enable mariadb
  6. systemctl start mariadb
  7. mysql_secure_installation
  8.  
  9. ===Preparation Zabbix Database===
  10. mysql -uroot -p<root_password>
  11. mysql> create database zabbix character set utf8 collate utf8_bin;
  12. mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
  13. mysql> quit;
  14. zcat /usr/share/doc/zabbix-server-mysql-3.2.*/create.sql.gz | mysql -uzabbix -p zabbix
  15.  
  16. ===Preparation Environment to Run Zabbix===
  17. nano /etc/zabbix/zabbix_server.conf
  18. nano /etc/php.ini
  19.  
  20. php_value max_execution_time 300
  21. php_value memory_limit 128M
  22. php_value post_max_size 16M
  23. php_value upload_max_filesize 2M
  24. php_value max_input_time 300
  25. php_value always_populate_raw_post_data -1
  26. php_value date.timezone Asia/Bangkok
  27.  
  28. ===Setup Service and Startup Service===
  29. systemctl enable httpd
  30. systemctl start httpd
  31. systemctl start zabbix-server
  32. systemctl enable zabbix-server
  33. systemctl start zabbix-agent
  34. systemctl enable zabbix-agent
  35.  
  36.  
  37. ===Install Telegram Library===
  38. pip install --upgrade pip
  39. pip install requests
  40. cd /usr/lib/zabbix/alertscripts
  41. wget th.jilapat.com/telegramlib.zip
  42. chmod 777 zbxtg*
  43. nano zbxtg_settings.py
  44.  
  45. ===Test Telegram Lib===
  46. ./zbxtg.py "jphang" "This is Subject" "This is Body" --debug
  47.  
  48.  
  49. ===Operation Script===
  50. EVENT: {TRIGGER.NAME} on {HOSTNAME}
  51. Last value: {ITEM.LASTVALUE1} ({TIME})
  52. zbxtg;graphs
  53. zbxtg;graphs_period=10800
  54. zbxtg;itemid:{ITEM.ID1}
  55. zbxtg;title:{HOST.HOST} - {TRIGGER.NAME}
  56.  
  57. ===Recovery Operation Script===
  58. {TRIGGER.STATUS}: {TRIGGER.NAME} back to normal.
  59. Last value: {ITEM.LASTVALUE1} ({TIME})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement