ikzelf / zbxdb

Zabbix database monitoring, the easy and extendable way
GNU General Public License v3.0
94 stars 45 forks source link

tnslsnr-ping.py error #58

Closed rmdolezal closed 4 years ago

rmdolezal commented 4 years ago

Hi Roland, I`m trying to implement tnslsnr-ping.py. zabbix_agent.com was updated at zabbix proxy server to userparam UserParameter = tnsping[*],/etc/zabbix/lsnrping.py -s $1 -p $2 When I try to run lsnrping.py from cmd line I have got error: [root@proxy-test-final zabbix]# ./lsnrping.py -s zbxdb -p 1521 (does not matter what the params is) Traceback (most recent call last): File "./lsnrping.py", line 103, in vsnnum, err, version, ela = getVersion(versioncmd) File "./lsnrping.py", line 54, in getVersion cmdl = len(cmd).to_bytes(2, byteorder='big')

Regards

Marek

ikzelf commented 4 years ago

Hi Marek, do you know the version of the listener that should answer? is it actually running? I did a tiny modification to return the expected # of results also in the case of an exception.

rmdolezal commented 4 years ago

Hi Ronald, Yes the listner is up and running, LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 30-OCT-2020 13:07:55 When I try test with telnet 1521, it is ok. But as I wrote – does not matter what i wrote as params, I can wrote -s xxx and the result is same.

Regards

Marek

[root@proxy-test-final zabbix]# ./lsnrping.py -s 10.126.192.32 -p 1521 Traceback (most recent call last): File "./lsnrping.py", line 103, in vsnnum, err, version, ela = getVersion(versioncmd) File "./lsnrping.py", line 54, in getVersion cmdl = len(cmd).to_bytes(2, byteorder='big') AttributeError: 'int' object has no attribute 'to_bytes' [root@proxy-test-final zabbix]# ./lsnrping.py -s xxx -p 1521 Traceback (most recent call last): File "./lsnrping.py", line 103, in vsnnum, err, version, ela = getVersion(versioncmd) File "./lsnrping.py", line 54, in getVersion cmdl = len(cmd).to_bytes(2, byteorder='big') AttributeError: 'int' object has no attribute 'to_bytes' [root@proxy-test-final zabbix]# telnet 10.126.192.32 1521 Trying 10.126.192.32... Connected to 10.126.192.32. Escape character is '^]'. }}^] telnet> quit Connection closed.

From: Ronald Rood notifications@github.com Sent: Friday, October 30, 2020 11:23 AM To: ikzelf/zbxdb zbxdb@noreply.github.com Cc: Doležal Marek mdolezal@totalservice.cz; Author author@noreply.github.com Subject: Re: [ikzelf/zbxdb] tnslsnr-ping.py error (#58)

Hi Marek, do you know the version of the listener that should answer? is it actually running? I did a tiny modification to return the expected # of results also in the case of an exception.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ikzelf/zbxdb/issues/58#issuecomment-719469719, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM27LRXWLC6SYQYVQFOZX6TSNKHYNANCNFSM4TEZCGUA.

ikzelf commented 4 years ago

Ah, I see, you are using python v2 and apparently I made this for v3.

rmdolezal commented 4 years ago

Hi Ronald,

After python upgrade to 3.6.8 is looks little bit better, if the lister is running at 1521

[root@proxy-test-final zabbix]# ./lsnrping.py -s srvZPSdb01 -p 1521 7 [root@proxy-test-final zabbix]# ./lsnrping.py -s srvZPSdb01 -p 1521 6 [root@proxy-test-final zabbix]# ./lsnrping.py -s srvZPSdb01 -p 1521 6 [root@proxy-test-final zabbix]# ./lsnrping.py -s srvZPSdb01 -p 1521 5 [root@proxy-test-final zabbix]# ./lsnrping.py -s srvZPSdb01 -p 1521 19 [root@proxy-test-final zabbix]# ./lsnrping.py -s srvZPSdb01 -p 1521 6

But the returned value looks like random number. It is ok ?

If listener is not running at 1522

[root@proxy-test-final zabbix]# ./lsnrping.py -s 10.126.192.32 -p 1522 Traceback (most recent call last): File "./lsnrping.py", line 103, in vsnnum, err, version, ela = getVersion(versioncmd) ValueError: not enough values to unpack (expected 4, got 3)

Regards

Marek

rom: Ronald Rood notifications@github.com Sent: Friday, October 30, 2020 2:40 PM To: ikzelf/zbxdb zbxdb@noreply.github.com Cc: Doležal Marek mdolezal@totalservice.cz; Author author@noreply.github.com Subject: Re: [ikzelf/zbxdb] tnslsnr-ping.py error (#58)

Ah, I see, you are using python v2 and apparently I made this for v3.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ikzelf/zbxdb/issues/58#issuecomment-719558207, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM27LRWZZQWFVOEZ27HI7E3SNK63TANCNFSM4TEZCGUA.

ikzelf commented 4 years ago

I just pushed a version that should work for python v2 also. Try it.

rmdolezal commented 4 years ago

Tryed the latest version

Now works fine for no listener

[root@proxy-test-final zabbix]# ./lsnrping.py -s srvZPSdb01 -p 1525 TNS-12541:no listener on srvZPSdb01 port 1525

But for listener :

[root@proxy-test-final zabbix]# ./lsnrping.py -s srvZPSdb01 -p 1521 ['DESCRIPTION=(TMP=)(VSNNUM=203424000)(ERR=1189)(ERROR_STACK=(ERROR=(CODE=1189)(EMFI=4)))'] 6

Marek

From: Ronald Rood notifications@github.com Sent: Friday, October 30, 2020 4:10 PM To: ikzelf/zbxdb zbxdb@noreply.github.com Cc: Doležal Marek mdolezal@totalservice.cz; Author author@noreply.github.com Subject: Re: [ikzelf/zbxdb] tnslsnr-ping.py error (#58)

I just pushed a version that should work for python v2 also. Try it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ikzelf/zbxdb/issues/58#issuecomment-719609477, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM27LRUSNUJ3ETOE3BPCECTSNLJK7ANCNFSM4TEZCGUA.

rmdolezal commented 4 years ago

Hi Ronald, now it looks working good. Thank you. Best regards Marek

ikzelf commented 4 years ago

glad to see that it is better now Marek, I will close this issue, thanks for helping making it better.