sudo apt-get install snmpd && sudo apt-get install snmpd
[email protected]:~$ cat /etc/services | grep snmp
snmp 161/tcp # Simple Net Mgmt Protocol snmp 161/udp # Simple Net Mgmt Protocol snmp-trap 162/tcp snmptrap # Traps for SNMP snmp-trap 162/udp snmptrap # Traps for SNMP
NOTA: Utilitzarem el port marcat amb negreta (161/udp)
[email protected]:~$ sudo nmap -sU localhost -p 161 Starting Nmap 5.21 ( http://nmap.org ) at 2012-04-12 19:52 CEST Nmap scan report for localhost (127.0.0.1) Host is up (0.019s latency). Hostname localhost resolves to 2 IPs. Only scanned 127.0.0.1 rDNS record for 127.0.0.1: localhost.localdomain PORT STATE SERVICE 161/udp open snmp Nmap done: 1 IP address (1 host up) scanned in 0.11 seconds [email protected]:~$
############################################################################### # # AGENT BEHAVIOUR # # Listen for connections from the local system only # agentAddress udp:127.0.0.1:161 # Listen for connections on all interfaces (both IPv4 *and* IPv6) gentAddress udp:161,udp6:[::1]:161
############################################################################### # # ACCESS CONTROL # # system + hrSystem groups only view systemonly included .1.3.6.1.2.1.1 view systemonly included .1.3.6.1.2.1.25.1 # Full access from the local host # rocommunity public localhost # Default access to basic system info rocommunity public default -V systemonly
[email protected]:~$ dpkg -L snmp | grep bin /usr/bin /usr/bin/snmpbulkget /usr/bin/snmpbulkwalk /usr/bin/snmpconf /usr/bin/snmpdelta /usr/bin/snmpdf /usr/bin/snmpget /usr/bin/snmpgetnext /usr/bin/snmpnetstat /usr/bin/snmpset /usr/bin/snmpstatus /usr/bin/snmptable /usr/bin/snmptest /usr/bin/snmptranslate /usr/bin/snmptrap /usr/bin/snmpusm /usr/bin/snmpvacm /usr/bin/snmpwalk /usr/bin/encode_keychange /usr/bin/fixproc /usr/bin/traptoemail /usr/bin/snmpinform [email protected]:~$
sudo apt-get install snmp-mibs-downloader
# # As the snmp packages come without MIB files due to license reasons, loading # of MIBs is disabled by default. If you added the MIBs you can reenable # loaging them by commenting out the following line. # mibs :
[email protected]:~$ snmpwalk -Os -c public -v 2c localhost system sysDescr.0 = STRING: Linux ubuntu-baucells 2.6.35-32-generic #67-Ubuntu SMP Mon Mar 5 19:35:26 UTC 2012 i686 sysObjectID.0 = OID: netSnmpAgentOIDs.10 sysUpTimeInstance = Timeticks: (158170) 0:26:21.70 sysContact.0 = STRING: Me <[email protected]> sysName.0 = STRING: ubuntu-baucells sysLocation.0 = STRING: Sitting on the Dock of the Bay sysServices.0 = INTEGER: 72 sysORLastChange.0 = Timeticks: (0) 0:00:00.00 sysORID.1 = OID: snmpFrameworkMIBCompliance sysORID.2 = OID: snmpMPDCompliance sysORID.3 = OID: usmMIBCompliance sysORID.4 = OID: snmpMIB sysORID.5 = OID: tcpMIB sysORID.6 = OID: ip sysORID.7 = OID: udpMIB sysORID.8 = OID: vacmBasicGroup sysORDescr.1 = STRING: The SNMP Management Architecture MIB. sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching. sysORDescr.3 = STRING: The management information definitions for the SNMP User-based Security Model. sysORDescr.4 = STRING: The MIB module for SNMPv2 entities sysORDescr.5 = STRING: The MIB module for managing TCP implementations sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations sysORDescr.7 = STRING: The MIB module for managing UDP implementations sysORDescr.8 = STRING: View-based Access Control Model for SNMP. sysORUpTime.1 = Timeticks: (0) 0:00:00.00 sysORUpTime.2 = Timeticks: (0) 0:00:00.00 sysORUpTime.3 = Timeticks: (0) 0:00:00.00 sysORUpTime.4 = Timeticks: (0) 0:00:00.00 sysORUpTime.5 = Timeticks: (0) 0:00:00.00 sysORUpTime.6 = Timeticks: (0) 0:00:00.00 sysORUpTime.7 = Timeticks: (0) 0:00:00.00 sysORUpTime.8 = Timeticks: (0) 0:00:00.00 [email protected]:~$
[email protected]:~$ snmpwalk -Os -c public -v 2c 10.36.253.1 ifNumber ifNumber.0 = INTEGER: 16 [email protected]:~$
[email protected]:~$ snmpwalk -Os -c public -v 2c 10.36.253.1 mib-2 | more sysDescr.0 = STRING: RouterOS RB600A sysObjectID.0 = OID: enterprises.14988.1 sysUpTimeInstance = Timeticks: (191763200) 22 days, 4:40:32.00 sysContact.0 = STRING: [email protected] sysName.0 = STRING: TortosaINSEbreRd1 sysLocation.0 = STRING: TortosaINSEbre sysServices.0 = INTEGER: 78 ifNumber.0 = INTEGER: 16 ifIndex.1 = INTEGER: 1 ifIndex.2 = INTEGER: 2 ifIndex.3 = INTEGER: 3 ifIndex.4 = INTEGER: 4 ifIndex.5 = INTEGER: 5 ifIndex.6 = INTEGER: 6 . . .
sudo mkdir /usr/share/snmp/mibs/
sudo cp Mikrotik.mib /usr/share/snmp/mibs/
export MIBS=+MY-MIB
[email protected]:~$ dpkg -L mysql-server-5.1 /. /usr /usr/bin /usr/bin/myisamlog /usr/bin/mysqlbinlog /usr/bin/mysqld_multi /usr/bin/myisampack /usr/bin/mysql_convert_table_format /usr/bin/mysql_zap /usr/bin/mysql_fix_privilege_tables /usr/bin/mysql_setpermission /usr/bin/mysql_secure_installation /usr/bin/resolveip /usr/bin/perror /usr/bin/mysqlhotcopy /usr/bin/mysqltest /usr/bin/msql2mysql /usr/bin/mysqld_safe /usr/bin/myisamchk /usr/bin/replace /usr/bin/mysql_tzinfo_to_sql /usr/bin/resolve_stack_dump /usr/share /usr/share/mysql /usr/share/mysql/errmsg.txt /usr/share/mysql/config.small.ini /usr/share/mysql/ndb-config-2-node.ini /usr/share/mysql/config.huge.ini /usr/share/mysql/mysql_fix_privilege_tables.sql /usr/share/mysql/mysqld_multi.server /usr/share/mysql/mysql_test_data_timezone.sql /usr/share/mysql/debian-start.inc.sh /usr/share/mysql/config.medium.ini /usr/share/mysql/echo_stderr /usr/share/apport /usr/share/apport/package-hooks /usr/share/apport/package-hooks/source_mysql-dfsg-5.1.py /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/mysql-server-5.1 /usr/share/doc /usr/share/doc/mysql-server-5.1 /usr/share/doc/mysql-server-5.1/examples /usr/share/doc/mysql-server-5.1/examples/my-medium.cnf.gz /usr/share/doc/mysql-server-5.1/examples/my-huge.cnf.gz /usr/share/doc/mysql-server-5.1/examples/my-innodb-heavy-4G.cnf.gz /usr/share/doc/mysql-server-5.1/examples/my-small.cnf /usr/share/doc/mysql-server-5.1/examples/my-large.cnf.gz /usr/share/doc/mysql-server-5.1/README.Debian.gz /usr/share/doc/mysql-server-5.1/copyright /usr/share/doc/mysql-server-5.1/mysqld.sym.gz /usr/share/doc/mysql-server-5.1/NEWS.Debian.gz /usr/share/doc/mysql-server-5.1/changelog.Debian.gz /usr/share/man /usr/share/man/man1 /usr/share/man/man1/myisampack.1.gz /usr/share/man/man1/myisamlog.1.gz /usr/share/man/man1/mysql_convert_table_format.1.gz /usr/share/man/man1/replace.1.gz /usr/share/man/man1/resolveip.1.gz /usr/share/man/man1/mysqld_safe.1.gz /usr/share/man/man1/mysqltest.1.gz /usr/share/man/man1/perror.1.gz /usr/share/man/man1/mysqld_multi.1.gz /usr/share/man/man1/innochecksum.1.gz /usr/share/man/man1/mysqlbinlog.1.gz /usr/share/man/man1/mysql_tzinfo_to_sql.1.gz /usr/share/man/man1/mysql_setpermission.1.gz /usr/share/man/man1/mysql_zap.1.gz /usr/share/man/man1/mysqlhotcopy.1.gz /usr/share/man/man1/resolve_stack_dump.1.gz /usr/share/man/man1/myisamchk.1.gz /usr/share/man/man1/mysql_fix_privilege_tables.1.gz /usr/share/man/man1/msql2mysql.1.gz /usr/share/man/man1/mysql_secure_installation.1.gz /usr/lib /usr/lib/mysql /usr/lib/mysql/plugin /usr/lib/mysql/plugin/ha_innodb_plugin.so.0.0.0 /var /var/lib /var/lib/mysql-upgrade /etc /etc/mysql /etc/mysql/conf.d /etc/mysql/conf.d/mysqld_safe_syslog.cnf /etc/mysql/debian-start /etc/init.d /etc/init /etc/init/mysql.conf /etc/logcheck /etc/logcheck/ignore.d.paranoid /etc/logcheck/ignore.d.paranoid/mysql-server-5_1 /etc/logcheck/ignore.d.server /etc/logcheck/ignore.d.server/mysql-server-5_1 /etc/logcheck/ignore.d.workstation /etc/logcheck/ignore.d.workstation/mysql-server-5_1 /etc/logrotate.d /etc/logrotate.d/mysql-server /etc/apparmor.d /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/force-complain /usr/share/man/man1/mysqltest_embedded.1.gz /usr/lib/mysql/plugin/ha_innodb_plugin.so /usr/lib/mysql/plugin/ha_innodb_plugin.so.0 /etc/init.d/mysql [email protected]:~$
sudo apt-get install cacti
[email protected]:~$ dpkg -L cacti | grep etc /etc /etc/cacti /etc/logrotate.d /etc/logrotate.d/cacti /etc/cron.d /etc/cron.d/cacti [email protected]:~$
http://localhost/cacti