Debian - 安装 LSI MegaRAID SNMP AGENT

Debian - 安装 LSI MegaRAID SNMP AGENT

我的操作系统是:

Distributor ID: Debian
Description:    Debian GNU/Linux 8.9 (jessie)
Release:        8.9
Codename:       jessie

我成功安装了 MegaRaid 存储管理器,并且可以使用 StorCli。

# dpkg --install lib-utils2_1.00-9_all.deb without errors
# dpkg --install megaraid-storage-manager_17.05.00-3_all.deb without errors

# ./storcli64 /c0 /vall show
Controller = 0
Status = Success
Description = None


Virtual Drives :
==============

---------------------------------------------------------------
DG/VD TYPE  State Access Consist Cache Cac sCC       Size Name
---------------------------------------------------------------
0/0   RAID1 Optl  RW     Yes     RWBD  -   ON  278.464 GB OS
1/1   RAID5 Optl  RW     Yes     RWBD  -   ON    8.180 TB DATA
---------------------------------------------------------------

但是现在,我要安装 RAID 控制器的 snmp 代理。我使用了 rpm,并使用 alien 将其转换为 deb:

# dpkg -i sas-snmp_17.05-3_amd64.deb
(Lecture de la base de données... 54953 fichiers et répertoires déjà installés.)
Préparation du dépaquetage de sas-snmp_17.05-3_amd64.deb ...
Dépaquetage de sas-snmp (17.05-3) ...
Paramétrage de sas-snmp (17.05-3) ...
Starting snmpd
/etc/lsi_mrdsnmp/sas/install: 182: [: 0: unexpected operator
[ ok ] Restarting snmpd (via systemctl): snmpd.service.
Starting LSI SNMP Agent
/etc/lsi_mrdsnmp/sas/install: 210: [: 0: unexpected operator
Starting LSI SNMP Agent:
/etc/init.d/lsi_mrdsnmpd: 153: /etc/init.d/lsi_mrdsnmpd: daemon: not found

我进行了编辑/etc/init.d/lsi_mrdsnmpd,通过将守护进程命令替换为以下内容来解决该问题:

....
${agent} -c ${SNMPDCONF}
#daemon ${agent} -c ${SNMPDCONF}
....

此外,我添加了一个符号链接来解决库的问题:

/usr/lib/libsas_objects.so -> /usr/lib64/libsas_objects.so.1

但是现在,当我尝试启动服务时:

# ./lsi_mrdsnmpd start
Starting LSI SNMP Agent:
LSI MegaRAID SNMP Agent Ver 3.18.0.5 (Oct 30th, 2012) Started

我在 ps 命令中什么都没有。如果我验证 syslog 日志,我会得到:

Oct 16 16:43:45 Server1 MegaRAID SNMP AGENT: Error in getting Shared Memory(lsi_mrdsnmpmain)

如果我尝试手动执行命令:

# ./lsi_mrdsnmpagent -c /etc/snmp/snmpd.conf
LSI MegaRAID SNMP Agent Ver 3.18.0.5 (Oct 30th, 2012) Started

系统日志上的结果相同。

我尝试strace启动该服务:这里是 strace 的结束:

16:46:54 fstat(3, {st_dev=makedev(8, 1), st_ino=8128118, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=2945, st_atime=2017/10/16-09:39:01, st_mtime=2017/05/02-08:24:20, st_ctime=2017/05/02-08:24:20}) = 0
16:46:54 fstat(3, {st_dev=makedev(8, 1), st_ino=8128118, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=2945, st_atime=2017/10/16-09:39:01, st_mtime=2017/05/02-08:24:20, st_ctime=2017/05/02-08:24:20}) = 0
16:46:54 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f712d916000
16:46:54 read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\f\0\0\0\f\0\0\0\0\0\..., 4096) = 2945
16:46:54 lseek(3, -1863, SEEK_CUR)      = 1082
16:46:54 read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\r\0\0\0\r\0\0\0\0\0\0\0\270\0\0\0\r\0\0\0\37\377\377\377\377k\310J\213\377\377\377\377\221`P\213\377\377\377\377\233Gx\360\377\377\377\377\233\327,p\377\377\377\377\234\274\221p\377\377\377\377\235\300H\360\377\377\377\377\236\211\376p\377\377\377\377\2..."..., 4096) = 1863
16:46:54 close(3)                       = 0
16:46:54 munmap(0x7f712d916000, 4096)   = 0
16:46:54 socket(PF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
16:46:54 connect(3, {sa_family=AF_LOCAL, sun_path="/dev/log"}, 110) = 0
16:46:54 sendto(3, "<30>Oct 16 16:46:54 LSI MegaRAID SNMP Agent: Agent Ver 3.18.0.5 (Oct 30th, 2012) Started\n", 89, MSG_NOSIGNAL, NULL, 0) = 89
16:46:54 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f712d90ba10) = 4715
16:46:54 exit_group(0)                  = ?
16:46:54 +++ exited with 0 +++

但是现在,我被阻止了,我不知道如何解决这个问题,你知道吗?

谢谢,

编辑

嗯,今天服务正在运行:

root     16777     1  0 16:35 ?        00:00:00 /etc/lsi_mrdsnmp/lsi_mrdsnmpagent -c /etc/snmp/snmpd.conf
root     16778 16777  0 16:35 ?        00:00:00 /etc/lsi_mrdsnmp/lsi_mrdsnmpagent -c /etc/snmp/snmpd.conf

有屁!!!

但是...当我尝试通过 lsi_mrdsnmpmain 将 OID 传递给代理时,它没有返回任何内容,结果代码为 1:

# /usr/sbin/lsi_mrdsnmpmain -g .1.3.6.1.4.1.3582.5.1.1.0
# echo $?
1

我对服务 lsi_mrdsnmpagent 进行跟踪,每次尝试 lsi_mrdsnmpmain 时我都可以读取到:

futex(0x7f61f938e000, FUTEX_WAIT, 0, NULL) = 0
write(1, "####INSIDE GET#####\n", 20)   = -1 EBADF (Bad file descriptor)
futex(0x7f61f938e020, FUTEX_WAKE, 1)    = 1
futex(0x7f61f938e000, FUTEX_WAIT, 0, NULL) = 0
write(1, "####INSIDE GET#####\n", 20)   = -1 EBADF (Bad file descriptor)
futex(0x7f61f938e020, FUTEX_WAKE, 1)    = 1
futex(0x7f61f938e000, FUTEX_WAIT, 0, NULL) = 0
write(1, "####INSIDE GET#####\n", 20)   = -1 EBADF (Bad file descriptor)
futex(0x7f61f938e020, FUTEX_WAKE, 1)    = 1
futex(0x7f61f938e000, FUTEX_WAIT, 0, NULL

如果我 strace lsi_mrdsnmpmain 我会得到:

15:41:36 rt_sigaction(SIGRT_1, {0x7fe5257a8a40, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7fe5257b1890}, NULL, 8) = 0
15:41:36 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
15:41:36 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
15:41:36 shmget(0x884b9, 1024, 0600)    = 131072
15:41:36 shmat(131072, 0, 0)            = 0x7fe525bdc000
15:41:36 futex(0x7fe525bdc000, FUTEX_WAKE, 1) = 1
15:41:36 futex(0x7fe525bdc020, FUTEX_WAIT, 0, NULL) = 0
15:41:36 shmdt(0x7fe525bdc000)          = 0
15:41:36 exit_group(1)                  = ?
15:41:36 +++ exited with 1 +++

如果您对 EBADF(坏文件描述符)有想法或有访问 mib 的想法......

谢谢 !

答案1

好的!!现在它运行正常。回答我自己的问题,lsimrdsnmpmain 的错误来自 snmpd 进程启动的用户。在我的配置文件中,守护进程 snmpd 由用户“snmp”启动,守护进程 lsimrdsnmpagent 由用户 root 启动。我在 /etc/defaults/snmpd.conf 中修改了守护进程 snmpd 的用户操作系统,现在这两个进程可以很好地通信。

我希望这个回复能够帮助其他想要在 debian 上运行 lsi megaraid sas 工具的人。

答案2

SELinux 是我在 RHEL(AlmaLinux 9.1)上遇到的问题

root 正在运行 snmpd 和 lsi_mrdsnmpagent

root   4417  0.0  0.0  29368 21416 ?  Ss   13:20   0:04 /usr/sbin/snmpd -LS0-6d -f
root   4505  0.0  0.0  23112 14176 ?  Ss   14:46   0:00 /etc/lsi_mrdsnmp/lsi_mrdsnmpagent -c /etc/snmp/snmpd.conf

得到以下结果和错误(pass 语句在 snmpd.conf 文件中)

# snmpwalk localhost -v 2c -c [REDACTED] .1.3.6.1.4.1.3582
SNMPv2-SMI::enterprises.3582 = No Such Instance currently exists at this OID

# journalctl --since "1 hour ago"
May 04 14:50:34 cjis-arc-01 systemd[1]: Finished dnf makecache.
May 04 14:56:47 cjis-arc-01 unknown[4565]: MegaRAID SNMP AGENT: Error in getting Shared Memory(lsi_mrdsnmpmain)

禁用 SELinux

# setenforce 0

现在工作

# snmpwalk localhost -v 2c -c [REDACTED] .1.3.6.1.4.1.3582

SNMPv2-SMI::enterprises.3582.5.1.1.0 = STRING: "cjis-arc-01"
SNMPv2-SMI::enterprises.3582.5.1.2.0 = STRING: "AlmaLinux release 9.1 (Lime Lynx)x86_64"
SNMPv2-SMI::enterprises.3582.5.1.3.1.0 = STRING: "1.31-00"
SNMPv2-SMI::enterprises.3582.5.1.3.2.0 = STRING: "lsi_mrdsnmpagent"
SNMPv2-SMI::enterprises.3582.5.1.3.3.0 = STRING: "3.18.0.5"
SNMPv2-SMI::enterprises.3582.5.1.3.4.0 = STRING: "21st January, 2013"
SNMPv2-SMI::enterprises.3582.5.1.4.1.1.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.1.2.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.2.1.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.3.1.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.3.2.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.3.3.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.3.4.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.4.1.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.4.2.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.4.3.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.4.4.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.4.5.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.4.6.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.4.7.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.5.1.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.4.5.2.1.0 = INTEGER: 0
SNMPv2-SMI::enterprises.3582.5.1.8.1.0 = STRING: "Avago Technologies"

相关内容