Debian – Installation of LSI MegaRAID SNMP AGENT

debian-jessiehardware-raidlsimegaraidsnmp

My OS is :

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

I succeded to install the MegaRaid Storage Manager and I can use 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
---------------------------------------------------------------

But now, I would install the snmp agent of my RAID controller.
I used the rpm and I convert it ina deb with alien :

# 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

I edited /etc/init.d/lsi_mrdsnmpd to resolve the problem of the daemon command by replacing it by :

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

Moreover, I added a symbolic link to solve a problem of library :

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

But now, when I try to start the service :

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

I don't have nothing in a ps command. And if I verify the syslog log, I have :

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

If I try to execute manually the command :

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

Same result on the syslog.

I tried to strace the start of the service :
Here th eend of the 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 +++

But now, I'm blocked and i don't know to resolve this problem, have you got an idea of that ?

Thanks,

EDIT

Well, today the service is running :

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

youpi!!!

But…when I try to pass a OID to the agent via lsi_mrdsnmpmain it returns nothing and the result code is 1 :

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

I strace the service lsi_mrdsnmpagent and I can read that each time i try 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

And if i strace lsi_mrdsnmpmain I obtain:

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 +++

If you have ideas about the EBADF (Bad file descriptor) or ideas to access mib…

Thanks !

Best Answer

Ok!! Now it works perfectly. To answer my own question the error from the lsimrdsnmpmain was from the user which the snmpd process started. In my conf, the daemon snmpd was started with the user 'snmp' and the daemon lsimrdsnmpagent was started with the user root. I modified the user os the daemon snmpd in /etc/defaults/snmpd.conf and now the two process can speak together very well.

I hope this response will help other persons who want to run the lsi megaraid sas tools on a debian.