|
|
| Author |
Message |
gthe Cacti User
Joined: 29 Jul 2006 Posts: 99 Location: RU
|
Posted: Thu Apr 03, 2008 9:24 am Post subject: SNMPTT viewer Plugin for Cacti. v 1.2.2rc (2008/11/18) extjs |
|
|
Hi All!
Here is my first plugin for Cacti.
Besides it is my first work on php
----[ Requirements:
- Cacti 0.8.7b
- Plugin Architecture v2.х for Cacti v0.8.7b
- NET-SNMP trapd
- SNMPTT from http://www.snmptt.org/
----[ Installation
IMPORTANT: This plugin ONLY show data from mysql. It does not accept snmp traps.
By analogy with syslog plugin:
syslog-ng => mysql => syslog plugin
snmptrapd => SNMPTT=> mysql => snmptt plugin
1. Install just like any other plugin, just throw it in the plugin directory, in a folder called snmptt.
Edit your includes/config.php and add it to your $plugins list, and you are rolling.
For PIA 2.0 and higher go to :
1.1 Console->Plugin Management->Uninstalled tab->snmptt -> install
1.2 Console->Plugin Management->Installed tab->snmptt -> enable
2. After that, change same setting in snmptt.ini:
| Code: | mibs_environment = ALL
date_time_format = %Y-%m-%d %H:%M:%S
unknown_trap_log_enable = 1
statistics_interval = 300
db_translate_enterprise = 1
mysql_dbi_enable = 1
mysql_dbi_table = plugin_snmptt
mysql_dbi_table_unknown = plugin_snmptt_unknown
mysql_dbi_table_statistics = plugin_snmptt_statistics
mysql_dbi_host = localhost # << CHANGE !
mysql_dbi_port = 3306 # << CHANGE !
mysql_dbi_database = cacti # << CHANGE !
mysql_dbi_username = cactiuser # << CHANGE !
mysql_dbi_password = cactipassword # << CHANGE !
mysql_ping_on_insert = 1
mysql_ping_interval = 300
date_time_format_sql = %Y-%m-%d %H:%M:%S
stat_time_format_sql = %Y-%m-%d %H:%M:%S |
----[ Changes
--- 0.0.16b ---
--- 0.1.21b ---
- Added alert rule do delete traps;;
- Show traps with alerted messages;
- Added some index to mysql tables;
- Change SQL query for some optimization;
- Fix bug with show traps;
- Fix bug with "&" in search URL in FF;
- Tree navbar headings for device type are hyperlinked;
- Stats moved from main Cacti page menu to snmptt tabs menu
- Truncate menu for snmptt tables deleted (You can truncate snmptt's tables by uninstall/install it plugin management);
- Added addons.rar with graphs for snmptt plugins stats and my snmptt.conf (for D-Link switches). If You have another snmptt.conf* files you may sent it to me - I add it to plugin.
For update to [0.1.21b] from [0.0.16b] without drop data (since PIA 2.2 don't allow update realms and hooks in "fly") you need:
1. Stop snmptt service
2. Copy new files to cacti/plugins/snmptt (with ovveride)
3. Open SNMPTT tab in cacti (it will autoupdate all tables)
4. Dump data from [plugin_snmptt] and [plugin_snmptt_unknown] (for example: mysqldump --opt -q -p cacti plugin_snmptt plugin_snmptt_unknown > ./cacti_snmptt_dump.sql)
5. Uninstall snmptt plugin by: Console -> Plugin Management -> snmptt -> uninstall.
6. Install snmptt plugin by: Console -> Plugin Management -> Uninstalled -> snmptt -> install; and enable it.
7. Import dumped data to mysql.
8. Open SNMPTT tab in cacti.
9. Start snmptt service.
--- 0.1.22b ---
- Fix one more bug with "&" in URL in FF;
--- 1.0.23b ---
- Added extjs interface. Speedup for big tables and new look ;
--- 0.1.24b ---
- Fix path bug;
- Fix for php without json;
- For Arch 2.x issue need run sql:
| Quote: | | update plugin_realms set file = 'snmptt_view.php,snmptt_db.php' where `file` like '%snmptt_view.php%' |
--- 1.0.25b ---
- Correct "messages", "formatline" and "notes" rule's labels;
--- 1.1.0rc ---
- Rebuild "Add/Edit rule" window;
- Ability to test rule (show traps which will be alerted);
- Create rule based on traps;
- "Show full traps info" window;
- Added patch to snmptt_create_where_sql (thanks computer_guru);
Minor updates:
- Correct tree state save again;
- Improve search filters;
- im Traps and UnkTraps grid add css to wrap FormatLine row;
- Maintain scroll position when store is reloaded;
- Added stripeRows for Grids;
- All actions column moved to left side of grid;
* after update delete /lib/snmptt_ext_functions.php file.
--- 1.2.2rc ---
- Rebuild "Add/Edit rule" window again. New system for creating filter - more powerfull.
This update DELETE ALL existinf rule, you need recreate it after;
- New rule's modes - "Mark rule" and "Execute user functions". User functions must be in snmptt/lib/
- "Show full unknown traps info" window;
- Deleted "Create rule based on traps";
- Fix bug for show stats if [plugin_snmptt_statistics] table is emty;
Minor updates:
- Constrain the window to the viewport;
- Just after create and save rule - auto reload grid, so deleting new rule work fine;
- Changed type formatline for unknown traps table from varchar(255) to text;
- ReFixed save/restore state (IE). Checked on IE, GC, FF.
| Description: |
| Create new rule and filter |
|
| Filesize: |
78.01 KB |
| Viewed: |
730 Time(s) |

|
| Description: |
AutoUpdate process lanch after: 1 - installing plugin; 2 - Updating by coping new version; and first time open snmptt tab in cacti. |
|
| Filesize: |
17.32 KB |
| Viewed: |
8275 Time(s) |

|
| Description: |
|
| Filesize: |
184.21 KB |
| Viewed: |
9094 Time(s) |

|
| Description: |
|
| Filesize: |
273.36 KB |
| Viewed: |
9094 Time(s) |

|
| Description: |
|
 Download |
| Filename: |
snmptt_1.2.2rc_ext.zip |
| Filesize: |
610.72 KB |
| Downloaded: |
419 Time(s) |
Last edited by gthe on Tue Nov 25, 2008 11:41 pm; edited 24 times in total |
|
| Back to top |
|
 |
eternal Cacti User
Joined: 14 Dec 2006 Posts: 57 Location: Kingsport TN
|
Posted: Thu Apr 03, 2008 11:11 am Post subject: |
|
|
this is SWEET
thanks
|
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9689 Location: MI, USA
|
Posted: Thu Apr 03, 2008 10:57 pm Post subject: |
|
|
Very nice!! More and more plugins every day. Give me joy to see this taking off this way.
TheWitness
|
|
| Back to top |
|
 |
corbin
Joined: 06 Mar 2008 Posts: 9 Location: Oregon
|
Posted: Wed Apr 09, 2008 1:27 pm Post subject: |
|
|
Sweet Plugin!!! Good work!!! A couple of questions though...
Ive been trying to get snmptrapd working with syslog-ng for a few days now to no avail. Do you have a process you used for setting up the Net-SNMP snmptrapd piece? Also do you have spine running with net-snmp and are there any conflicts? Any input would be appreciated.
Thanks
|
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2162 Location: United Kingdom
|
Posted: Wed Apr 09, 2008 4:35 pm Post subject: |
|
|
Nice plugin I'll be trying this one. I have had snmptt dumping data into a mysql database for ages now, but no nice way to look at it...
|
|
| Back to top |
|
 |
gthe Cacti User
Joined: 29 Jul 2006 Posts: 99 Location: RU
|
Posted: Thu Apr 10, 2008 12:27 am Post subject: |
|
|
| corbin wrote: | Sweet Plugin!!! Good work!!! A couple of questions though...
Ive been trying to get snmptrapd working with syslog-ng for a few days now to no avail. Do you have a process you used for setting up the Net-SNMP snmptrapd piece? Also do you have spine running with net-snmp and are there any conflicts? Any input would be appreciated.
Thanks |
Have you installed the program snmptt ?
Syslog-ng not needed for this.
|
|
| Back to top |
|
 |
corbin
Joined: 06 Mar 2008 Posts: 9 Location: Oregon
|
Posted: Fri Apr 18, 2008 1:13 pm Post subject: |
|
|
Sorry for the delay in my response... I installed snmptt and working on the configuration. Do you have an easy how to for installing snmptrapd with snmptt? Nothing i can find on the web seems clear.
Also. I tried to install your plugin like any other plugin but its not showing up in the realm permissions and there is no tab associated with it. But it does show up in the host info tab.
------------------------
Ubuntu 6.06
Cacti Version 0.8.7b
Plugin Architecture 2.0
Poller Type Cactid v
Server Info Linux 2.6.15-51-386
Web Server Apache/2.0.55 (Ubuntu) PHP/5.1.2
PHP Version 5.1.2
PHP Extensions xmlwriter, libxml, xml, wddx, tokenizer, sysvshm, sysvsem, sysvmsg, standard, SimpleXML, sockets, soap, SPL, shmop, session, Reflection, posix, mime_magic, mbstring, iconv, hash, gettext, ftp, filepro, exif, dom, dba, date, ctype, calendar, bz2, bcmath, zlib, pcre, openssl, xmlreader, apache2handler, mysql, mysqli, gd
MySQL Version 5.0.22-Debian_0ubuntu6.06.6-log
RRDTool Version 1.2.15
SNMP Version 5.2.1.2
Plugins Global Plugin Settings (settings - v0.3)
Thresholds (thold - v0.3.9)
Device Monitoring (monitor - v0.8.2)
Host Info (hostinfo - v0.2)
Network Tools (tools - v0.2)
PHP Network Weathermap (weathermap - v0.95b)
SNMPTT viewer for cacti (snmptt - v0.0.16b)
---------------------------------------------------
|
|
| Back to top |
|
 |
gthe Cacti User
Joined: 29 Jul 2006 Posts: 99 Location: RU
|
Posted: Sat Apr 19, 2008 12:56 am Post subject: |
|
|
| corbin wrote: | Sorry for the delay in my response... I installed snmptt and working on the configuration. Do you have an easy how to for installing snmptrapd with snmptt? Nothing i can find on the web seems clear.
|
from SNMPTT web:
| Code: | Installation - Unix
1. Read this entire file to understand how snmptt works
2. Copy snmptt to /usr/sbin/ and ensure it is executable (chmod +x snmptt)
3. Copy snmptthandler to /usr/sbin/ and ensure it is executable (chmod +x snmptthandler)
4. Copy snmptt.ini to /etc/snmp/ or /etc/ and edit the options inside the file.
5a. For standlone mode: Modify the Net-SNMP snmptrapd.conf file by adding the following line:
traphandle default /usr/sbin/snmptt
Note: It is possible to configure snmptrapd to execute snmptt based on the specific trap received, but using the default option is preferred
5b. For daemon mode: Modify the Net-SNMP snmptrapd.conf file by adding the following line:
traphandle default /usr/sbin/snmptthandler
Launch snmptt using:
snmptt --daemon
A startup script is included which can be used to start and stop snmptt on Mandrake, RedHat and other systems. Copy the script to the init.d directory (renaming the file during the copy):
cp snmptt.init.d to /etc/rc.d/init.d/snmptt
Add the service using chkconfig:
chkconfig --add snmptt
Configure the service to start at runlevel 2345:
chkconfig --level 2345 snmptt on
Snmptt will be started at the next reboot, or can be started immediately with:
service snmptt start
or
/etc/rc.d/init.d/snmptt start
6. Start snmptrapd using the command line: snmptrapd -On.
You should be able to edit the /etc/rc.d/init.d/snmptrapd script if you have one and change
the OPTIONS to "-On".
Note: The -On is recommended. This will make snmptrapd pass OIDs in numeric form and prevent SNMPTT from having to translate the symbolic name to numerical form. If the UCD-SNMP / Net-SNMP Perl module is not installed, then you MUST use the -On switch. Depending on the version of UCD-SNMP / Net-SNMP, some symbolic names may not translate correctly. See the FAQ for more info.
As an alternative, you can edit your snmp.conf file to include the line: printNumericOids 1. This setting will take effect no matter what is used on the command line.
7. See the Securing SNMPTT section. |
| corbin wrote: | Also. I tried to install your plugin like any other plugin but its not showing up in the realm permissions and there is no tab associated with it. But it does show up in the host info tab.
|
Do you install it like PIA 2.x plugin ?
| gthe wrote: |
For PIA 2.0 and higher go to :
1.1 Console->Plugin Management->Uninstalled tab->snmptt -> install
1.2 Console->Plugin Management->Installed tab->snmptt -> enable
|
|
|
| Back to top |
|
 |
corbin
Joined: 06 Mar 2008 Posts: 9 Location: Oregon
|
Posted: Mon Apr 21, 2008 1:09 pm Post subject: |
|
|
Thanks for the setup guide... I'll give it a shot.
I don't have the Plugin Mangement option. Do I have to do something special to enable that? The only way I see to enable plugins is through the Realm Permissions of the admin user. I am running PIA 2.0.
Thanks again.
|
|
| Back to top |
|
 |
niobe Cacti User
Joined: 10 Mar 2008 Posts: 125 Location: Australia
|
Posted: Mon Apr 21, 2008 1:30 pm Post subject: |
|
|
This looks fantastic - syslog-ng for snmp. I have had to take snmptrapd offline due to bugs in the Red Hat version, but looks like I can now workaround it.
Last edited by niobe on Tue Apr 22, 2008 2:02 am; edited 1 time in total |
|
| Back to top |
|
 |
gthe Cacti User
Joined: 29 Jul 2006 Posts: 99 Location: RU
|
Posted: Tue Apr 22, 2008 12:17 am Post subject: |
|
|
| corbin wrote: | Thanks for the setup guide... I'll give it a shot.
I don't have the Plugin Mangement option. Do I have to do something special to enable that? The only way I see to enable plugins is through the Realm Permissions of the admin user. I am running PIA 2.0.
Thanks again. |
Go to Console -> User management -> (you User Name or Admin) - check (enable) Realm Permission "Plugin Management"
|
|
| Back to top |
|
 |
niobe Cacti User
Joined: 10 Mar 2008 Posts: 125 Location: Australia
|
Posted: Wed Apr 23, 2008 12:00 am Post subject: |
|
|
gthe, can you tell me how to install the required perl modules?
I get this:
| Code: | [root@server snmp]# service snmptt start
Starting snmptt: Can't locate Config/IniFiles.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/sbin/snmptt line 3894.
BEGIN failed--compilation aborted at /usr/sbin/snmptt line 3894.
[FAILED]
|
Sorry being a TCL guy not much of a perl guy...
cheers,
N
|
|
| Back to top |
|
 |
gthe Cacti User
Joined: 29 Jul 2006 Posts: 99 Location: RU
|
Posted: Wed Apr 23, 2008 12:17 am Post subject: |
|
|
Try:
| Code: | | perl -MCPAN -e 'install Config::IniFiles' |
|
|
| Back to top |
|
 |
niobe Cacti User
Joined: 10 Mar 2008 Posts: 125 Location: Australia
|
Posted: Wed Apr 23, 2008 12:44 am Post subject: |
|
|
thanks for that, worked ok - probably my first experience with perl modules that has!
Another question. Is it actually necessary the build a massive snmptt.conf with all your MIB data if you don't want to actually do any text translations? I am hoping to use snmptt with cacti (obviously) but also to intelligently store the traps in text files. net-snmp is not so good at this compared to syslog-ng..
Edit: I have a problem getting snmptt working. I have followed the document but it seems snmptrapd is not passing logs to snmptt:
| Code: | [root@server snmp]# tail snmpttsystem.log
Wed Apr 23 17:22:40 2008 Finished loading 0 lines from /etc/snmp/snmptt.conf
Wed Apr 23 17:22:40 2008 Loading /etc/snmp/snmptt.conf.base
Wed Apr 23 17:22:40 2008 Finished loading 3458 lines from /etc/snmp/snmptt.conf.base
Wed Apr 23 17:28:35 2008 SNMPTT v1.2 shutdown
Wed Apr 23 17:28:35 2008 Total traps received=0,Total traps translated=0,Total traps ignored=0,Total unknown traps=0 |
Strange as snmptrapd itself is working - with or without snmptt enabled it is writing to it's own log file snmptrapd.log.
gthe what options do you use when starting snmptrapd? mine are:
| Code: | | OPTIONS="-c /etc/snmp/snmptrapd.conf -On -Lf /var/snmp/snmptrapd.log -p /var/run/snmptrapd.pid" |
What do you have in your snmptrapd.conf? Mine is simply:
| Code: | authCommunity log <my_com_str>
traphandle default /usr/sbin/snmptthandler
|
cheers,
N
|
|
| Back to top |
|
 |
gthe Cacti User
Joined: 29 Jul 2006 Posts: 99 Location: RU
|
Posted: Wed Apr 23, 2008 3:25 am Post subject: |
|
|
| niobe wrote: | thanks for that, worked ok - probably my first experience with perl modules that has!
Another question. Is it actually necessary the build a massive snmptt.conf with all your MIB data if you don't want to actually do any text translations? I am hoping to use snmptt with cacti (obviously) but also to intelligently store the traps in text files. net-snmp is not so good at this compared to syslog-ng..
|
Withous *.conf files all traps go to table plugin_snmptt_unknown.
Here is exapmle:
wo *.conf in plugin_snmptt_unknown, column formatline
| Code: | | \'des3526.2.7.1.1.1.5 ():5 des3526.2.15.3.1 ():192.168.0.27 des3526.2.15.3.2 ():00 1B 38 CB 6A 1E \' |
with *.conf in plugin_snmptt, column formatline
| Code: | | FORM: WARN: Unauthenticated IP-MAC address and discarded by ip mac port binding <br> (IP: 192.168.0.27, MAC: 00:1B:38:CB:6A:1E, Port: 5) |
and here is the part conf file for this trapoid:
| Code: |
EVENT swL2IpMacBindingViolationTrap .1.3.6.1.4.1.171.11.64.1.2.15.3.0.3 "Status Events" Normal
FORMAT FORM: When the IP-Mac Binging trap is enabled, if there's a new MAC that violates the pre-defined $+*
REGEX ((.*)des35[0-9]{2}.[0-9]{1,2}[\.0-9]{0,12}\:\ ?([0-9]{1,2})\ ?des35[0-9]{2}.[0-9]{1,2}[\.0-9]{0,12}\:([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})\ ?des35[0-9]{2}.[0-9]{1,2}[\.0-9]{0,12}\:\ ?([A-Z0-9]{2})\ ?([A-Z0-9]{2})\ ?([A-Z0-9]{2})\ ?([A-Z0-9]{2})\ ?([A-Z0-9]{2})\ ?([A-Z0-9]{2}))("FORM: WARN: Unauthenticated IP-MAC address and discarded by ip mac port binding <br> (IP: $3, MAC: $4:$5:$6:$7:$8:$9, Port: $2)")ige
SDESC
When the IP-Mac Binging trap is enabled, if there's a new MAC that violates the pre-defined
port security configuration, trap will be sent out
Variables:
1: swL2IpMacBindingPorts
Syntax="OCTETSTR"
Descr="The port members of this entry."
2: swL2IpMacBindingViolationIP
Syntax="OCTETSTR"
Descr="This object indicates the MAC address that violates the IP-Mac Binging configuration."
3: swL2IpMacBindingViolationMac
Syntax="OCTETSTR"
Descr="This object indicates the IP address that violates the IP-Mac Binging configuration."
EDESC
|
note* REGEX row is created by myself
| niobe wrote: |
gthe what options do you use when starting snmptrapd? mine are:
| Code: | | OPTIONS="-c /etc/snmp/snmptrapd.conf -On -Lf /var/snmp/snmptrapd.log -p /var/run/snmptrapd.pid" |
|
In my snmptrapd:
| Code: | | OPTIONS="-On -Lf /var/log/snmptrapd.log -p /var/run/snmptrapd.pid" |
| niobe wrote: |
What do you have in your snmptrapd.conf? Mine is simply:
| Code: | authCommunity log <my_com_str>
traphandle default /usr/sbin/snmptthandler
|
cheers,
N |
Try :
| Code: |
authCommunity log,execute,net <my_com_str>
traphandle default /usr/sbin/snmptthandler
|
please check:
| Code: | tail /var/log/snmptrapd.log
grep -m 30 snmpt /var/log/messages
ls -1l /var/spool/snmptt |
and post result.
Sorry for my English.
|
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|