Blame tests/p_net-snmp/snmpv3_test.sh

Christoph Galuschka caaecd
#!/bin/sh
Christoph Galuschka caaecd
# Author: Athmane Madjoudj <athmanem@gmail.com>
Christoph Galuschka dae1aa
# Author: Christoph Galuschka <christoph.galuschka@chello.at>
Christoph Galuschka caaecd
f49232
f49232
if (t_GetPkgRel basesystem | grep -q el9)
f49232
then
f49232
  t_Log "This is a C9 system. Snmpwal failing. Fix later. Skipping."
f49232
  t_CheckExitStatus 0
f49232
  exit $PASS
f49232
fi
f49232
Christoph Galuschka caaecd
t_Log "Running $0 - snmpv3 test"
Christoph Galuschka caaecd
Christoph Galuschka caaecd
# Make Backup of snmpd.conf and add V3-settings
Christoph Galuschka caaecd
/bin/cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.orig
Christoph Galuschka caaecd
echo 'rouser centosro' >> /etc/snmp/snmpd.conf
Christoph Galuschka caaecd
echo 'createUser centosro MD5 centosro DES centosro' >> /etc/snmp/snmpd.conf
Christoph Galuschka caaecd
Christoph Galuschka caaecd
# Restart Service
Christoph Galuschka caaecd
service snmpd restart
Christoph Galuschka caaecd
Christoph Galuschka caaecd
#Run test
Christoph Galuschka caaecd
snmpget -v 3 -u centosro  -n "" -l authPriv -a MD5 -A centosro -x DES -X centosro 127.0.0.1 sysUpTime.0 > /dev/null 2>&1
Athmane Madjoudj 55ca06
ret_val=$?
Christoph Galuschka caaecd
Christoph Galuschka caaecd
# Restore settings
Christoph Galuschka caaecd
/bin/cp /etc/snmp/snmpd.conf.orig /etc/snmp/snmpd.conf
Christoph Galuschka caaecd
service snmpd restart
Christoph Galuschka caaecd
Athmane Madjoudj 55ca06
t_CheckExitStatus $ret_val