Vous avez sans doute remarqué que toutes vos traps SNMP sont stockés dans le fichier /var/log/messages.

Le but de cet article est de mieux organiser les journaux de snmptt et ainsi d’identifier si notre serveur de supervision reçoit des traps inconnus.

Pour configurer les journaux de SNMPTT, il faut éditer le fichier /etc/snmp/centreon_traps/snmptt.ini en y apportant les modifications suivantes:

log_enable = 1
log_file = /var/log/snmptt.log
unknown_trap_log_enable = 1
unknown_trap_log_file = /var/log/snmpttunknown.log

Vous pouvez faire des tests de bon fonctionnement en utilisant la commande snmptrap, puis vous pourrez consulter les fichier de log suivants:

  • snmptt.log 
root@central-centreon:~# tail -f /var/log/snmptt.log
Thu Mar  1 11:48:18 2012 .1.3.6.1.6.3.1.1.5.1 1 "Status Event" localhost.localdomain - SNMP is restarting
Mon Jun 18 18:05:27 2012 .1.3.6.1.6.3.1.1.5.1 1 "Status Event" localhost.localdomain - SNMP is restarting
  • snmpttunknown.log 
root@central-centreon:~# tail -fn 15 /var/log/snmpttunknown.log
Tue Jun 12 17:07:49 2012: Unknown trap (.1.3.6.1.2.1.1.3.0) received from localhost.localdomain at:
Value 0: localhost.localdomain
Value 1: 127.0.0.1
Value 2: 0:0:00:00.00
Value 3: .1.3.6.1.2.1.1.3.0
Value 4: 127.0.0.1
Value 5:
Value 6:
Value 7:
Value 8:
Value 9:
Value 10:
Ent Value 0: .0.1=