This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
сервис_snmp [2022/02/23 07:31] val [Варианты использования snmp консоли в режиме чтения] |
сервис_snmp [2024/06/19 14:12] (current) val [Настройка snmptrapd сервиса] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Сервис SNMP ====== | ====== Сервис SNMP ====== | ||
+ | * https://ru.wikipedia.org/wiki/Management_Information_Base | ||
===== Пакет net-snmp ===== | ===== Пакет net-snmp ===== | ||
Line 72: | Line 73: | ||
server# systemctl enable snmptrapd | server# systemctl enable snmptrapd | ||
+ | ubuntu24# systemctl status snmptrapd.socket | ||
</code> | </code> | ||
+ | === Debian/Ubuntu === | ||
+ | * Срабатывает более точный traphandle | ||
+ | * !!! В Ubuntu24 snmptrapd работает с правами Debian-snmp, надо использовать [[Пакет sudo]] | ||
- | === Debian/Ubuntu === | ||
<code> | <code> | ||
server# cat /etc/snmp/snmptrapd.conf | server# cat /etc/snmp/snmptrapd.conf | ||
Line 87: | Line 91: | ||
traphandle SNMPv2-SMI::enterprises.9.9.43.* /root/cisco-backup-config.sh | traphandle SNMPv2-SMI::enterprises.9.9.43.* /root/cisco-backup-config.sh | ||
+ | #traphandle SNMPv2-SMI::enterprises.9.9.43.* sudo /root/cisco-backup-config.sh | ||
#router RMON | #router RMON | ||
- | traphandle SNMPv2-SMI::mib-2.16.0.* /usr/bin/traptoemail -s localhost student@corp13.un | + | traphandle SNMPv2-SMI::mib-2.16.0.* /usr/bin/traptoemail -s localhost student@corpX.un |
traphandle default cat >> /tmp/traps | traphandle default cat >> /tmp/traps | ||
Line 112: | Line 117: | ||
/usr/bin/sshpass -p cisco /usr/bin/scp ${cisco_name}:running-config /srv/tftp/${cisco_name}-running-config | /usr/bin/sshpass -p cisco /usr/bin/scp ${cisco_name}:running-config /srv/tftp/${cisco_name}-running-config | ||
+ | #/usr/bin/sshpass -p cisco /usr/bin/scp -O ${cisco_name}:running-config /srv/tftp/${cisco_name}-running-config | ||
cd /srv/tftp/ | cd /srv/tftp/ | ||
/usr/bin/git add * | /usr/bin/git add * | ||
Line 161: | Line 167: | ||
=== Вывод количества байт, прошедших через порт устройства с момента его включения === | === Вывод количества байт, прошедших через порт устройства с момента его включения === | ||
<code> | <code> | ||
- | server# snmpget -c public -v2c -On router ifInOctets.3 | + | FastEthernet0/0 |
- | server# snmpget -c public -v2c -On router ifHCInOctets.3 | + | |
+ | server# snmpget -c public -v2c -On router ifInOctets.1 | ||
+ | server# snmpget -c public -v2c -On router ifHCInOctets.1 | ||
+ | |||
+ | Port-channel1 | ||
- | server# snmpget -c public -v2c -On router ifOutOctets.2 | + | server# snmpget -c public -v2c -On router ifOutOctets.5 |
- | server# snmpget -c public -v2c -On router ifHCOutOctets.2 | + | server# snmpget -c public -v2c -On router ifHCOutOctets.5 |
</code> | </code> | ||