ConfigStore Plugin

Announcements concerning Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
User avatar
zgamer
Cacti User
Posts: 86
Joined: Sat Sep 23, 2006 7:50 pm
Location: WI, USA

Post by zgamer »

with telnet or ssh on any of the newer Nortel code with the CLI as the native cli interface.

1) ctrl+y
2) username + enter
3) password + enter
4) copy config tftp address 192.168.1.50 filename my_switch_backup.cfg + enter
...wait until prompt
5) exit + enter (closes the connection)
Current cacti install
-------------------------
Hardware: ESXi 5.1 VM
Software Load: FreeBSD 9.0 + Lighttpd + MySQL + Cacti 0.8.7
Plug-ins loaded: aggregate, flowview, monitor, realtime, rrdclean, syslog, spikekill, settings, thold, weathermap, and uptime.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

zgamer wrote:with telnet or ssh on any of the newer Nortel code with the CLI as the native cli interface.

1) ctrl+y
2) username + enter
3) password + enter
4) copy config tftp address 192.168.1.50 filename my_switch_backup.cfg + enter
...wait until prompt
5) exit + enter (closes the connection)
1.) Would you like me to add Telnet and SSH for Nortel to these specs?
2.) If so, how would you attempt to get the "last change/changed by" info? Is it part of the config, or would you have to parse the log, or what?

Let me know.
User avatar
zgamer
Cacti User
Posts: 86
Joined: Sat Sep 23, 2006 7:50 pm
Location: WI, USA

Post by zgamer »

1) Both would be great but right now we only use telnet
2) The last changed-by information is available with the "show logging informational" command and parsing the screen while looking for:

Code: Select all

I    2010-08-19 01:32:50 GMT+00:00 134      #1 Connection closed (lost connection), IP address: 192.168.5.205



#1 is really #n, 1 happens to be for the 1st concurrent connection
While parsing the screen there is a space/return toggle to show more log information, you'll be looking for the last occurrence of the above syntax to get the IP and timestamp of the last user to be in the switch. However this information is stored in memory with a periodic write to flash so the switch was reset without the typical save command the log entry will not be present locally but will only be there via syslog.
Current cacti install
-------------------------
Hardware: ESXi 5.1 VM
Software Load: FreeBSD 9.0 + Lighttpd + MySQL + Cacti 0.8.7
Plug-ins loaded: aggregate, flowview, monitor, realtime, rrdclean, syslog, spikekill, settings, thold, weathermap, and uptime.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Post by chadd »

zgamer wrote:1) Both would be great but right now we only use telnet
2) The last changed-by information is available with the "show logging informational" command and parsing the screen while looking for:

Code: Select all

I    2010-08-19 01:32:50 GMT+00:00 134      #1 Connection closed (lost connection), IP address: 192.168.5.205



#1 is really #n, 1 happens to be for the 1st concurrent connection
While parsing the screen there is a space/return toggle to show more log information, you'll be looking for the last occurrence of the above syntax to get the IP and timestamp of the last user to be in the switch. However this information is stored in memory with a periodic write to flash so the switch was reset without the typical save command the log entry will not be present locally but will only be there via syslog.
In the code you posted, the IP address is the "last user" to modify the config?
Is the "last change" at the top of the screen, or do you have to page to the bottom to get the last thing?
Does the log always look the same, or if you set the time different, does the format change?

I have a pretty busy schedule the remainder of this week, but will try to get you some code to test soon. Like I said, I have no equipment like this to test on, so it may take a few attempts..
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re: ConfigStore version 0.1 beta

Post by chadd »

I posted a new file, as I found a few bugs in the existing one - as well as some slacking ;)

Here is the change log from the README:

--- Beta Fixes ---
Fixed typo in lib/cisco-ios.php
Corrected for weird IOS prompts in lib/cisco_ios-telnet.php
Corrected for weird IOS prompts in lib/cisco_ios-ssh.php
Updated configstore_poller.php to format run time in Hours, Minutes, Seconds instead of just Seconds
Corrected problem with configstore_poller.php that kept email from being formatted correctly under certain conditions
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re:

Post by chadd »

chadd wrote:
zgamer wrote:1) Both would be great but right now we only use telnet
2) The last changed-by information is available with the "show logging informational" command and parsing the screen while looking for:

Code: Select all

I    2010-08-19 01:32:50 GMT+00:00 134      #1 Connection closed (lost connection), IP address: 192.168.5.205



#1 is really #n, 1 happens to be for the 1st concurrent connection
While parsing the screen there is a space/return toggle to show more log information, you'll be looking for the last occurrence of the above syntax to get the IP and timestamp of the last user to be in the switch. However this information is stored in memory with a periodic write to flash so the switch was reset without the typical save command the log entry will not be present locally but will only be there via syslog.
In the code you posted, the IP address is the "last user" to modify the config?
Is the "last change" at the top of the screen, or do you have to page to the bottom to get the last thing?
Does the log always look the same, or if you set the time different, does the format change?

I have a pretty busy schedule the remainder of this week, but will try to get you some code to test soon. Like I said, I have no equipment like this to test on, so it may take a few attempts..
With your newer code, after you do the CRTL-Y and enter you username and password, does it take you to a menu system? Then you choose command line to get to the command line? I ask, because that is what mine do (old code). If you could work with me a little on this, I might have the code for you today.

-chadd.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re: ConfigStore Plugin

Post by chadd »

Latest version is 0.3 and is updated on the first post. Here is the change log:

----[ Changelog

--- 0.1 ---
Initial Beta Release

--- 0.2 ---
- Fixed typo in lib/cisco-ios.php
- Corrected for wierd IOS prompts in lib/cisco_ios-telnet.php
- Corrected for wierd IOS prompts in lib/cisco_ios-ssh.php
- Updated configstore_poller.php to format run time in Hours, Minutes, Seconds instead of just Seconds
- Corrected problem with configstore_poller.php that kept email from being formatted correctly under certain conditions

--- 0.3 ---
- Fixed account to device filter so that when you click on the number of devices that belong to an account on the account page
it actually filters the device list correctly.
- Added new device type for Cisco ASA.
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re: ConfigStore Plugin

Post by chadd »

Latest version is 0.4 and is updated on the first post. Here is the change log:

----[ Changelog

--- 0.1 ---
Initial Beta Release

--- 0.2 ---
- Fixed typo in lib/cisco-ios.php
- Corrected for wierd IOS prompts in lib/cisco_ios-telnet.php
- Corrected for wierd IOS prompts in lib/cisco_ios-ssh.php
- Updated configstore_poller.php to format run time in Hours, Minutes, Seconds instead of just Seconds
- Corrected problem with configstore_poller.php that kept email from being formatted correctly under certain conditions

--- 0.3 ---
- Fixed account to device filter so that when you click on the number of devices that belong to an account on the account page
it actually filters the device list correctly.
- Added new device type for Cisco ASA.

--- 0.4 ---
- Fixed color change to active tab.
- Added Device Type manager, to make it easier to add your own backup scripts.
- Added Sites to help organize devices by physical location.
- Added the ability to do a mass change of devices to a new site, or authentication account.
annapatil
Posts: 35
Joined: Wed Oct 13, 2010 3:22 am

Re: ConfigStore Plugin

Post by annapatil »

Hi i m getting below error while running backup

10/21/2010 01:22:42 PM - CMDPHP: Poller[0] ERROR: SQL Row Failed!, Error:'1064', SQL:"SELECT * FROM plugin_configstore_backups WHERE id = "
10/21/2010 01:22:42 PM - CMDPHP: Poller[0] ERROR: SQL Row Failed!, Error:'1064', SQL:"SELECT * FROM plugin_configstore_backups WHERE id = "
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re: ConfigStore Plugin

Post by chadd »

annapatil wrote:Hi i m getting below error while running backup

10/21/2010 01:22:42 PM - CMDPHP: Poller[0] ERROR: SQL Row Failed!, Error:'1064', SQL:"SELECT * FROM plugin_configstore_backups WHERE id = "
10/21/2010 01:22:42 PM - CMDPHP: Poller[0] ERROR: SQL Row Failed!, Error:'1064', SQL:"SELECT * FROM plugin_configstore_backups WHERE id = "

Question(s):

- Are you running the backup on device(s) manually, or is this via the poller?
- The only place (I believe) that line of code exists, is configstore_compare.php, which should not be involved at all in the backup process. So, are you positive it only happens when you run a backup?

Here are a list of all the tables that should be in your database for ConfigStore. Do you have all of these?

mysql> show tables like 'plugin_configstore_%';
+----------------------------------------+
| Tables_in_cacti (plugin_configstore_%) |
+----------------------------------------+
| plugin_configstore_accounts |
| plugin_configstore_archive |
| plugin_configstore_backups |
| plugin_configstore_device_types |
| plugin_configstore_devices |
| plugin_configstore_sites |
| plugin_configstore_templates |
+----------------------------------------+
7 rows in set (0.00 sec)

mysql> describe plugin_configstore_accounts;
+----------------------+----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+----------------------+------+-----+---------+----------------+
| id | int(12) | NO | PRI | NULL | auto_increment |
| name | varchar(64) | NO | | NULL | |
| account_type | tinyint(11) unsigned | NO | | 0 | |
| backup_protocol | tinyint(11) unsigned | NO | | 1 | |
| snmp_version | varchar(100) | NO | | | |
| snmp_writestring | varchar(100) | NO | | NULL | |
| snmp_port | int(10) | NO | | 161 | |
| snmp_timeout | int(10) unsigned | NO | | 500 | |
| snmp_retries | tinyint(11) unsigned | NO | | 3 | |
| snmp_username | varchar(50) | YES | | NULL | |
| snmp_password | varchar(50) | YES | | NULL | |
| snmp_auth_protocol | char(5) | YES | | | |
| snmp_priv_passphrase | varchar(200) | YES | | | |
| snmp_priv_protocol | char(6) | YES | | | |
| snmp_context | varchar(64) | YES | | | |
| username | varchar(64) | NO | | NULL | |
| password | varchar(256) | YES | | NULL | |
| enablepw | varchar(256) | YES | | NULL | |
| private_key_path | varchar(128) | YES | | | |
+----------------------+----------------------+------+-----+---------+----------------+
19 rows in set (0.01 sec)

mysql> describe plugin_configstore_archive;
+------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+----------------+
| id | int(12) | NO | PRI | NULL | auto_increment |
| btime | int(18) | NO | MUL | NULL | |
| device_hostname | varchar(255) | NO | MUL | NULL | |
| device_ipaddress | varchar(128) | NO | | NULL | |
| filename | varchar(255) | NO | | NULL | |
| config | longtext | NO | | NULL | |
| lastchange | int(24) | NO | MUL | NULL | |
| username | varchar(128) | NO | | NULL | |
| atime | int(18) | NO | MUL | NULL | |
+------------------+--------------+------+-----+---------+----------------+
9 rows in set (0.01 sec)

mysql> describe plugin_configstore_backups;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(12) | NO | PRI | NULL | auto_increment |
| btime | int(18) | NO | MUL | NULL | |
| device | int(12) | NO | MUL | NULL | |
| directory | varchar(255) | NO | MUL | NULL | |
| filename | varchar(255) | NO | | NULL | |
| config | longtext | NO | | NULL | |
| lastchange | int(24) | NO | MUL | NULL | |
| username | varchar(128) | NO | | NULL | |
+------------+--------------+------+-----+---------+----------------+
8 rows in set (0.00 sec)

mysql> describe plugin_configstore_device_types;
+---------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+----------------+
| id | int(12) | NO | PRI | NULL | auto_increment |
| name | varchar(64) | NO | | NULL | |
| vendor | varchar(64) | NO | | NULL | |
| models | varchar(128) | NO | | | |
| backup_script | varchar(128) | NO | | | |
+---------------+--------------+------+-----+---------+----------------+
5 rows in set (0.01 sec)

mysql> describe plugin_configstore_devices
-> ;
+--------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+----------------+
| id | int(12) | NO | PRI | NULL | auto_increment |
| enabled | varchar(2) | NO | MUL | on | |
| ipaddress | varchar(128) | NO | MUL | NULL | |
| hostname | varchar(255) | NO | | NULL | |
| site | int(12) unsigned | NO | | 0 | |
| directory | varchar(255) | NO | | NULL | |
| account | int(12) | NO | MUL | NULL | |
| lastchange | int(24) | NO | MUL | NULL | |
| username | varchar(128) | NO | | NULL | |
| schedule | int(6) | NO | MUL | 1 | |
| lastbackup | int(18) | NO | MUL | NULL | |
| lastattempt | int(18) | NO | MUL | NULL | |
| backupresult | int(1) | NO | MUL | NULL | |
| failedcount | int(1) | NO | | NULL | |
| devicetype | int(12) | NO | MUL | NULL | |
| debug | text | NO | | NULL | |
+--------------+------------------+------+-----+---------+----------------+
16 rows in set (0.01 sec)

mysql> describe plugin_configstore_sites;
+--------------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------------+--------------+------+-----+---------+----------------+
| id | int(12) | NO | PRI | NULL | auto_increment |
| site_id | varchar(12) | NO | MUL | NULL | |
| name | varchar(128) | NO | MUL | NULL | |
| address | varchar(128) | NO | | NULL | |
| suite | varchar(12) | NO | | NULL | |
| city | varchar(128) | NO | | NULL | |
| state | varchar(128) | NO | | NULL | |
| zip | varchar(12) | NO | | NULL | |
| facility_contact_name | varchar(128) | NO | | | |
| facility_contact_number | varchar(64) | NO | | | |
| facility_contact_email | varchar(128) | NO | | | |
| technical_contact_name | varchar(128) | NO | | | |
| technical_contact_number | varchar(64) | NO | | | |
| technical_contact_email | varchar(128) | NO | | | |
| site_information | varchar(255) | NO | | | |
+--------------------------+--------------+------+-----+---------+----------------+
15 rows in set (0.00 sec)

mysql> describe plugin_configstore_templates;
+------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+------------+--------------+------+-----+---------+----------------+
| id | int(12) | NO | PRI | NULL | auto_increment |
| name | varchar(128) | NO | MUL | NULL | |
| filename | varchar(255) | NO | MUL | NULL | |
| lastchange | int(24) | NO | MUL | NULL | |
| username | varchar(128) | NO | MUL | NULL | |
| config | longtext | NO | | NULL | |
+------------+--------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

mysql>


I will look into this more, but if you could help me out with some of this info, I'd appreciate it. Thanks,

-chadd.
hmorandell
Cacti User
Posts: 73
Joined: Mon May 03, 2010 11:48 am

Re: ConfigStore Plugin

Post by hmorandell »

hi,

there must be some probs with the function "send_mail":

Code: Select all

[Mon Nov 29 11:47:19 2010] [error] [client xx.xx.xx.xx] PHP Fatal error:  Cannot redeclare send_mail() (previously declared in /srv/www/htdocs/cacti/plugins/settings/include/functions.php:25) in /srv/www/htdocs/cacti/plugins/configstore/functions.php on line 573, referer: http://xxx.xxxxxxxx.xx/cacti/plugins.php
[Mon Nov 29 11:47:23 2010] [error] [client xx.xx.xx.xx] PHP Fatal error:  Cannot redeclare send_mail() (previously declared in /srv/www/htdocs/cacti/plugins/settings/include/functions.php:25) in /srv/www/htdocs/cacti/plugins/configstore/functions.php on line 573, referer: http://xxx.xxxxxxxx.xx/cacti/plugins.php
_________________
Cacti - 1.2.14
Poller Type - SPINE 1.2.14
Devices 3,892
Graphs 21,483
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re: ConfigStore Plugin

Post by chadd »

hmorandell wrote:hi,

there must be some probs with the function "send_mail":

Code: Select all

[Mon Nov 29 11:47:19 2010] [error] [client xx.xx.xx.xx] PHP Fatal error:  Cannot redeclare send_mail() (previously declared in /srv/www/htdocs/cacti/plugins/settings/include/functions.php:25) in /srv/www/htdocs/cacti/plugins/configstore/functions.php on line 573, referer: http://xxx.xxxxxxxx.xx/cacti/plugins.php
[Mon Nov 29 11:47:23 2010] [error] [client xx.xx.xx.xx] PHP Fatal error:  Cannot redeclare send_mail() (previously declared in /srv/www/htdocs/cacti/plugins/settings/include/functions.php:25) in /srv/www/htdocs/cacti/plugins/configstore/functions.php on line 573, referer: http://xxx.xxxxxxxx.xx/cacti/plugins.php

Not sure where that error is coming from, but I suspect that you have another plugin (or something), which also has a function called "send_mail".. I could be wrong of course, but try renaming the function and all references to it to something like "configstore_sendmail" (something unique) and see if that fixes it.

Also, does sending mail always fail, or is this error just hitting your log after the email is sent? Which log is this? Any more info you can provide would be great. Let me know how it goes. I may just rename that function anyway, as I can see possible problems with that name.. Thanks.
aocampo
Posts: 15
Joined: Wed Sep 29, 2010 11:03 am

Re: ConfigStore Plugin

Post by aocampo »

Hi Chadd!!

When I put the configstore directory in cacti/plugins, I can see the same trouble in my browser.

Please, could you help me?

Thanks in advance!!
chadd
Cacti User
Posts: 382
Joined: Thu Mar 24, 2005 3:53 pm
Location: Ocoee, Florida

Re: ConfigStore Plugin

Post by chadd »

aocampo wrote:Hi Chadd!!

When I put the configstore directory in cacti/plugins, I can see the same trouble in my browser.

Please, could you help me?

Thanks in advance!!

Sure. Can you give me a list of all the other plugins you have? Also, keep sending updates if you can today, and we will get the problem resolved. Thanks.
aocampo
Posts: 15
Joined: Wed Sep 29, 2010 11:03 am

Re: ConfigStore Plugin

Post by aocampo »

chadd wrote:
aocampo wrote:Hi Chadd!!

When I put the configstore directory in cacti/plugins, I can see the same trouble in my browser.

Please, could you help me?

Thanks in advance!!

Sure. Can you give me a list of all the other plugins you have? Also, keep sending updates if you can today, and we will get the problem resolved. Thanks.
Of course chadd! I have these plugins:

Monitor 1.2
Mactrack 2.9
Settings 0.7
Weathermap 0.97a
Superlinks 0.8
Thold 0.4.2

My Cacti version is 0.8.7g and my Plugin Architecture is 2.9.

Thanks for your prompt response!
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests