易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 678|回复: 0
收起左侧

zabbix相关记录zabbix的一些步骤

[复制链接]
发表于 2022-11-3 17:00:04 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
Make sure that the files have the zabbix user/group and are executable.
# chown zabbix:zabbix /usr/lib/zabbix/externalscripts/*# chmod +x /usr/lib/zabbix/externalscripts/*.sh
The Zabbix user cannot login to the bash by default. We need to enable it as follows (if not already done in RZA6).
usermod --shell /bin/bash zabbix
If not already created, create the HOME directory for the Zabbix user.
usermod -m -d /var/lib/zabbix zabbixchown zabbix:zabbix /var/lib/zabbixchmod 755 /var/lib/zabbix
Create the directories for the saved configuration and firmware files and change the access rights.
mkdir /var/lib/zabbix/configuration-backupmkdir /var/lib/zabbix/configuration-backup/raymkdir /var/lib/zabbix/firmwaremkdir /var/lib/zabbix/firmware/ray3chown -R zabbix:zabbix /var/lib/zabbix/
The directory for the SSH key should now be located in /var/lib/zabbix/.ssh directory. Change the current directory to this one and login as zabbix.
su zabbix
A new prompt appears. We need to upload the SSH keys into every unit we want to control. You can either have you own RSA/DSA key or you can create a new one following this example. Run
ssh-keygen -t rsa
Follow the guide of the ssh-keygen application and leave the passphrase empty. To copy our RSA key into RAy3 units, copy the public part of the key and run the following command:
ssh admin@192.168.132.200
Just replace 192.168.132.200 with the correct RAy3 IP address. The prompt will ask for the admin password, fill it in and click Enter. Now, you should be logged in RAy3 CLI. Run the following command:
vi .ssh/authorized_keys
- n6 G5 p/ J. J8 |  S; h# {! V1 ~- d
                               
登录/注册后可看大图
Note
Browse the Internet for how to use ‘vi’ text editor if you are in trouble.

" N/ n6 ~% k# Z+ v) _5 L
Insert (paste) your public part of the key to a new line. Save the changes and close the file. Logout and check, if you can access the unit without a password.
ssh -i rsa admin@192.168.132.200
We completed all Linux tasks, but we still need to edit Zabbix web interface.
Scripts must be manually created in the Zabbix Administration – Scripts menu. See the example below and create Zabbix scripts for RAy3 units.

0 V$ X8 b8 `) g& Z  L( _                               
登录/注册后可看大图

0 J4 {4 Y7 ]& l5 x9 {0 p* [/ a3 x6 C" u, l, I, j# z6 [  {6 _: @+ [
Fig. 3.22: RAy3 scripts in Zabbix

; C3 G' ?: w6 R2 ]1 @5 S( m4 v- b/ W5 E  g$ [# f
If you open one of them, you can modify them as required. If you do not have any, you need to create them from scratch.
Configuration backup – the script creates a configuration backup file in /var/lib/zabbix/configuration-backup/ray/ directory. The name is taken from RAy3 S/N and Ethernet IP.

2 `: X. |; C9 H8 L0 n                               
登录/注册后可看大图

  I5 G/ H- @% Z, I) b5 u# C- L- N8 t% X; T- m: b* ~
Fig. 3.23: RSS sample script details
% V9 S. b# S4 W- t3 V

3 p+ p+ G* c+ v, _& v+ B
  • Name: RAy3 Configuration backup
  • Scope: Manual host action
  • Menu path: RAy3
  • Type: Script
  • Execute on: Zabbix server
  • Commands:
    /usr/lib/zabbix/externalscripts/ray_cli_cnf_backup_get.sh {HOST.CONN} {$HOST_SSHKEY} {$HOST_SSHPORT} 2>>/usr/lib/zabbix/externalscripts/script-log.txt

    ) u8 G/ ?( I; b
0 u+ X. a5 V2 J, `" d5 R& j
Set other parameters to suit your needs.
Displaying firmware version – the script reads a current FW version installed in RAy3 unit.
All is the same, except the “Commands” parameter:
/usr/lib/zabbix/externalscripts/ray_cli_fw_show.sh {HOST.CONN} {$HOST_SSHKEY} {$HOST_SSHPORT} 2>>/usr/lib/zabbix/externalscripts/script-log.txt
Upgrading firmware version – the script uploads a firmware file and a special CLI script into local RAy3 unit which is then executed and FW of both units within the link are upgraded. The script command is:
/usr/lib/zabbix/externalscripts/ray_cli_fw_upgrade.sh {HOST.CONN} {$HOST_SSHKEY} {$HOST_SSHPORT} “/var/lib/zabbix/firmware/ray3/ray3-fw-2.0.3.0.cpio” “2.0.3.0” 2>>/usr/lib/zabbix/externalscripts/script-log.txt
The parameters are MACROs which should be enabled by default due to our Template. Each RAy3 unit uses the SSH port 22 and the SSH key saved in /var/lib/zabbix/.ssh/rsa file by default. If you need to modify any of these parameters, go to the Configuration – Hosts menu and edit the particular Host’s MACROs.

2 a6 c, @& L5 a; H- [; o) n& l3 h                               
登录/注册后可看大图
/ d# `; S0 y- W( Y! t1 W% ?
/ [7 Q7 ?* [& S' B+ f; t0 {- y
Fig. 3.24: Host MACROs
1 p2 b& I$ ?: B* u0 h

7 E; ^( _  \+ t+ J$ o$ _6 \+ q

  [' ]$ n9 T$ e5 m' \                               
登录/注册后可看大图

- F7 x' ]4 c$ }( d
/ u7 p  d  z. o# ?1 g/ d& a, M
Fig. 3.25: RAy3 scripts – map

' o$ l" x9 v: N8 n/ C! b- c0 Q! G3 F" ~
The easiest script displays the FW version.
' e$ u& t8 J  J( {% R
                               
登录/注册后可看大图
# W& F+ h# i; Z9 i- k- ?5 \: r& i

( x  S( y1 z) z3 n6 v0 s$ Z5 _3 Z0 f
Fig. 3.26: Displaying FW version script output
5 J" K/ N( h4 k2 O  n& x! M% k3 u& ~

/ b( m) u% f$ S; O9 f8 M& R
Another script is the Configuration backup. The expected output should display a full path to the stored file.
3 D" u. y9 w  |2 C! v
                               
登录/注册后可看大图

8 E$ p; d0 Z7 O  |4 Q' |9 F
, ]' w3 E- Q2 F! E8 M7 {  ]
Fig. 3.27: RAy3 Configuration backup script output

' I1 X7 Y7 _% C: i& P) U, d; L# [8 S0 u5 Y9 [$ l
The last script should be first tested and verified in RAy3 units/links which are e.g., on your desk so that you double-check a correct behaviour.

% i" M! c8 P* q: s3.3.7. Branding/ e' D9 ^/ j3 Z2 q5 i5 f
5 h4 `( U& r3 c, y
- P$ O3 W, N  j2 `1 U+ ?
Zabbix 6.0 LTS offers you to use your own company’s branding instead of Zabbix ones, or RACOM logos in case of using RZA6.
; G( e0 G7 S% I5 x) N0 y( M! m
                               
登录/注册后可看大图

" ]- u7 d1 m# P3 t: w! C* H; q  a" f1 x, j' |6 K
Fig. 3.28: RACOM Branding

$ `) P  W. `% \4 b" @# M3 E( V/ ]' d' ~* g; M
General and brief procedure is described here:
2 B+ a4 G1 [% E  b6 Ghttps://www.zabbix.com/documentation/current/en/manual/web_interface/rebranding
For the RZA6, we created a file /usr/share/zabbix/local/conf/brand.conf.php with this content:
<?phpreturn ['BRAND_LOGO' => 'racom/racom_logo.png','BRAND_LOGO_SIDEBAR' => 'racom/racom_logo.png','BRAND_LOGO_SIDEBAR_COMPACT' => 'racom/racom_logo_compact.png',#'BRAND_HELP_URL' => 'https://www.racom.eu/ APP NOTE LINK '];
Logos were scaled to 140×20 and 20×13 (compact one). The logos are placed in /usr/share/zabbix/racom/ directory. After these changes, the Login screen can look like:

: w) |' Z0 p9 d. D8 G2 B3 F                               
登录/注册后可看大图
, j& E% K/ F# _7 Y0 ^$ g# z
! P& S0 X0 V" U8 I) V  r4 R4 S
Fig. 3.29: RACOM Branding login page
3 h2 L% S8 _+ W" k6 \6 {

6 _4 j; x5 e1 j7 I& c& f
If you need any additional help or information, do not hesitate to contact support@racom.eu. We are ready and happy to help you.
We do recommend using our RZA6 solution. If not in your real network, then as a start for getting familiar with RAy3 SNMP and Zabbix NMS, because RZA6 has many configuration steps pre-configured and done.

$ X  w, P  L2 V  ]/ {: _- K" M
4 I0 s. e6 h. F% E' v* M
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )点击这里给我发消息

GMT+8, 2026-4-8 21:40 , Processed in 0.051880 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

快速回复 返回顶部 返回列表