Re: [snmpsim-users] snmpsim 0.2.4rc1 with mysql
Brought to you by:
elie
|
From: Bhagat, Y. (Yateen) <yat...@al...> - 2013-08-28 07:33:45
|
Hi Ilya,
1. I am running the simulator and MySql Server on WindowsXP with MySql Server version: 5.5.32 (MySQL Community Server GPL).
2. The db table schema is as under:
mysql> describe maxnotifseqtable_87fa2144;
+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| oid | text | YES | | NULL | |
| tag | varchar(10) | YES | | NULL | |
| value | varchar(30) | YES | | NULL | |
| maxaccess | varchar(20) | YES | | NULL | |
+-----------+-------------+------+-----+---------+-------+
4 rows in set (0.08 sec)
The table contents are as under:
-----------------------------------------------------------------------------------------------------------------
| 1. 3. 6. 1. 4. 1. 637. 74. 1. 2. 2. 1. 1. 2. 2. 4. 0 | 66 | 14 | read-write |
-----------------------------------------------------------------------------------------------------------------
| 1. 3. 6. 1. 4. 1. 637. 74. 1. 2. 2. 1. 1. 2. 2. 5. 0 | 66 | 14 | read-write |
-----------------------------------------------------------------------------------------------------------------
3. No; I do not have duplicate entries for the OIDs in the table
4. I started the simulator in debug mode like this:
D:\snmpsim-0.2.4rc1\scripts>snmpsimd.py --variation-modules-dir=D:\snmpsim-0.2.4
rc1\variation --variation-module-options=sql:dbtype:mysql.connector,host:127.0.0
.1,port:3306,user:snmpsim,password:snmpsim,database:snmpsim --agent-udpv4-endpoi
nt=135.250.33.68 --v2c-arch --data-dir=\snmpsim-0.2.4rc1\1511 --debug=dsp
5. Then I queried one of the OIDs in the table using snmpget from Manager.
I got the oid value =13
The output on simulator console was like this:
Using \snmpsim-0.2.4rc1\1511\AdminAdmin123\1.3.6.1.6.1.1.0\135.250.18.151.snmpre
c controller selected by candidate AdminAdmin123/1.3.6.1.6.1.1.0/135.250.18.151;
transport ID 1.3.6.1.6.1.1.0, source address 135.250.18.151, community name "Ad
minAdmin123"
Opening \snmpsim-0.2.4rc1\1511\AdminAdmin123\1.3.6.1.6.1.1.0\135.250.18.151.snmp
rec controller
Request var-binds: 1.3.6.1.4.1.637.74.1.2.2.1.1.2.2.5.0=<>, flags: EXACT, GET
Response var-binds: 1.3.6.1.4.1.637.74.1.2.2.1.1.2.2.5.0=<13>
6. Then I changed the OID value in the db table to '14' and queried the OID again using snmpget:
The output is still shown as '13' instead of '14'
The output on simulator console was like this:
Using \snmpsim-0.2.4rc1\1511\AdminAdmin123\1.3.6.1.6.1.1.0\135.250.18.151.snmpre
c controller selected by candidate AdminAdmin123/1.3.6.1.6.1.1.0/135.250.18.151;
transport ID 1.3.6.1.6.1.1.0, source address 135.250.18.151, community name "Ad
minAdmin123"
Request var-binds: 1.3.6.1.4.1.637.74.1.2.2.1.1.2.2.5.0=<>, flags: EXACT, GET
Response var-binds: 1.3.6.1.4.1.637.74.1.2.2.1.1.2.2.5.0=<13>
Thanks
Yateen
-----Original Message-----
From: Ilya Etingof [mailto:il...@gl...]
Sent: Wednesday, August 28, 2013 3:45 AM
To: Bhagat, Yateen (Yateen)
Cc: snm...@li...
Subject: Re: snmpsim 0.2.4rc1 with mysql
Hi Yateen,
No, that should not be a problem UNLESS you have duplicate (e.g. non
unique) OIDs in the "oid" column. Could you check that?
I've tried your setup at my Linux workstation and could not reproduce your issue -- simulator reported value does actually change! What OS you are using on your simulator and mysql hosts? What mysql version you are running?
I don't see any caching in simulator code.
If above does not help, could you add the
--debug=dsp
flag to snmpsimd.py command-line and send me console output for two queries before and after value change in the backend database?
-ilya
On 08/27/2013 03:49 PM, Bhagat, Yateen (Yateen) wrote:
>
> Hi Ilya
>
> I my mysql table, “oid” has not been defined as primary key, could
> that be a problem?
>
> -Yateen
>
> *From:*Bhagat, Yateen (Yateen)
> *Sent:* Tuesday, August 27, 2013 12:27 PM
> *To:* 'Ilya Etingof'
> *Cc:* snm...@li...<mailto:snm...@li...>
> *Subject:* RE: snmpsim 0.2.4rc1 with mysql
>
> Hi Ilya,
>
> 1.I tried mysql commit, even then there is no success.
>
> 2.Format of the OID is correct (with padding spaces)
>
> 3.I tried querying the snmpsim with standard snmpget command, even
> this does not show updated OID value, old initial value is shown.
>
> 4.After updating the OID value (by changing the referred mysql table
> row) if I restart the snmpsim, then the updated value of the OID is
> visible.
>
> My suspect is somewhere snmpsim is caching the mysql referred values,
> and the cache is not updated.
>
> Please help !
>
> Regards
>
> Yateen
>
> *From:*Ilya Etingof [mailto:il...@gl...]
> *Sent:* Monday, August 26, 2013 7:27 PM
> *To:* Bhagat, Yateen (Yateen)
> *Cc:* snm...@li...<mailto:snm...@li...>
> <mailto:snm...@li...>
> *Subject:* Re: snmpsim 0.2.4rc1 with mysql
>
> Hi Yateen,
>
> Neither snmpsim nor SQL module does any caching of the values read
> from the database. So I suggest checking the following:
>
> 1. You do SQL commit upon value change (if applicable)
>
> 2. You read the same OID you modify. Note the format of the OID used
> by snmpsim includes padding spaces.
>
> 3. Your snmp manager does not do any caching by its own means.
>
> Let me know in case of further problems.
>
> -ilya
>
>
> On Aug 26, 2013, at 12:49, "Bhagat, Yateen (Yateen)"
> <yat...@al...
> <mailto:yat...@al...>> wrote:
>
> Hi Ilya,
>
> I have found an issue with 0.2.4rc1 (with mysql DB )
>
> My snmprec file has two oid’s referring to two rows in one
> single mysql table as given below:
>
> - - - - - - -
>
> - - - - - - -
>
> 1.3.6.1.4.1.637.74.1.2.2.1.1.2.2.2.0|66|10
>
> 1.3.6.1.4.1.637.74.1.2.2.1.1.2.2.3.0|2|1
>
>
> *1.3.6.1.4.1.637.74.1.2.2.1.1.2.2.4.0|:sql|maxNotifSeqTable_87fa2144*
>
>
> *1.3.6.1.4.1.637.74.1.2.2.1.1.2.2.5.0|:sql|maxNotifSeqTable_87fa2144*
>
> 1.3.6.1.4.1.637.74.1.2.2.1.1.2.2.6.0|66|2944
>
> 1.3.6.1.4.1.637.74.1.2.2.1.1.2.2.7.0|66|8017
>
> - - - - -
>
> - - - - - -
>
> The values for these two OIDs are being continuously changed every
> 1 sec ; by some script that modifies the “value” column in the in
> the mysql table.
>
> We have observed that when our snmp Manager queries these OID
> using “snmpget”, snmpsim always returns only the initial OID
> values that were present in the DB table at the startup of
> snmpsim. However, I could see the OID values getting changed in
> the backend DB, when queried using sql command.
>
> Please help
>
> *From:*Bhagat, Yateen (Yateen)
> *Sent:* Thursday, August 22, 2013 3:22 PM
> *To:* 'Ilya Etingof'
> *Cc:* Bhagat, Yateen (Yateen)
> *Subject:* RE: snmpsim with mysql
>
> Hi Ilya
>
> This issue is resolved, I realized later that another snmp daemon
> was already running on port 161.
>
> I have another issue, but before I report that just need quick info.
>
> I assume that in even in version 0.2.4rc1 (with mysql ) snmprec
> file can be hybrid, meaning some OIDs being static and other
> being referred from mysql tables.
>
> Thanks
>
> Yateen
>
> *From:*Bhagat, Yateen (Yateen)
> *Sent:* Tuesday, August 20, 2013 5:05 PM
> *To:* 'Ilya Etingof'
> *Subject:* snmpsim with mysql
>
> Hi Ilya
>
> I am trying to use snmpsim-0.2.4rc1 with mysql variation module,
>
> Getting following error:
>
> D:\snmpsim-0.2.4rc1\scripts>snmpsimd.py
> --variation-module-options=sql:dbtype:my
>
>
> sql.connector,host:127.0.0.1,port:3306,user:snmpsim,password:snmpsim,d
> atabase:sn
>
> mpsim --agent-udpv4-endpoint=135.250.33.68 --v2c-arch
>
> ERROR: bind() failed: [Errno 10048] Only one usage of each socket
> address (protocol/network address/port) is normally permitted
>
> Please help !
>
> Thanks
>
> Yateen ,
>
|