Changind SNMP community in database

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
Guest

Changind SNMP community in database

Post by Guest »

Due to an issue with our SNMP communities which contain a \ character i have to go through and manually change the snmp community on the dat source. I have worked out that this is stored as a blob in the mysql database and was wondering if anyone has a script that will go through and modify it straight into the database.

Jon

P.S Other than that it's a great program
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

I'm not sure if it is saved as a blob. I would do it in this way:

Code: Select all

[root@host]# mysql -D cacti
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 31534 to server version: 3.23.49

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select * from snmp_hosts;
+----+-----------------+-------------+
| ID | Hostname        | Community   |
+----+-----------------+-------------+
|  2 | 10.1.1.1        | prevcomm    |
+----+-----------------+-------------+
1 row in set (0.00 sec)

mysql> UPDATE snmp_hosts SET Community="newpub" WHERE Hostname="10.1.1.1";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from snmp_hosts;                                                
+----+-----------------+-----------+
| ID | Hostname        | Community |
+----+-----------------+-----------+
|  2 | 10.1.1.1        | newpub    |
+----+-----------------+-----------+
1 row in set (0.00 sec)
Guest

Post by Guest »

It's actually entered OK into that table it's in the rrd data source configuration that it seems to initially strip the `\` character out. hence if the switch has 24 ports I have to edit 48 data sources.
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

I see... then it is src_data table and you have to change "Value" column for selected records.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests