Coder Social home page Coder Social logo

Comments (7)

okand avatar okand commented on June 30, 2024

That error is way too vague for me to say anything I'm afraid.

Edit: Can you uncomment the print statements at the very end of the script and run it manually in the terminal once? Then paste the output here, that might give us something.

from zabbix-whois-expiry.

burnout-champion avatar burnout-champion commented on June 30, 2024

Hi and thanks for the quick reply!

I think it is this part of your .py script:

except:
print("Error occurred while executing whois() for %s." % domain)

It happens while running the script on cli:

Edit: this is the output with the last parts uncommented:

root@zabbix:/usr/lib/zabbix/externalscripts# ./zabbix-whois-check.py domain-expiry-check
Error occurred while executing whois() for domain1.com.
Error occurred while executing whois() for domain2.com.
Error occurred while executing whois() for domain3.com.
{
"domain_name": null,
"registrar": null,
"whois_server": null,
"referral_url": null,
"updated_date": null,
"creation_date": null,
"expiration_date": null,
"name_servers": null,
"status": null,
"emails": null,
"dnssec": null,
"name": null,
"org": null,
"address": null,
"city": null,
"state": null,
"zipcode": null,
"country": null
}
None None
Traceback (most recent call last):
File "./zabbix-whois-check.py", line 34, in
print(packet)
NameError: name 'packet' is not defined

Thanks,
Mike

from zabbix-whois-expiry.

okand avatar okand commented on June 30, 2024

Could you try with the old version that just crashes when something goes wrong instead of gracefully telling zabbix that something went wrong?

I don't use this script or even zabbix myself anymore but for example, I just tried it in WSL and it behaves like yours. When trying the old version it instead helpfully tells me that it can't find the zabbix_agent config for zabbix_sender to use, which is correct as I don't have it installed. That might tell us something useful from your end.

https://github.com/okand/zabbix-whois-expiry/blob/d67283a5604b36a3b8e0f9b502b8a2f3a5f83968/zabbix-whois-check.py

from zabbix-whois-expiry.

burnout-champion avatar burnout-champion commented on June 30, 2024

Hi, I will give it a go and let you know, thanks.

Do you have the command that does the whois check for the script so I can test it on it's own?

It's a brand new linux server so there might be something missing in its general configuration as I am not a linux admin.

from zabbix-whois-expiry.

okand avatar okand commented on June 30, 2024

That is done with one of the python modules you install at the start. It happens by importing whois on line 10 and then naming and running it on line 21. You then view its result by printing the variable called w by removing the leading # sign on line 32 before running the script. The way it is structured it will only print the last domain listed in your json-file since print(w) comes after the for-loop has already ended.

If you use that old commit of the script that doesn't have the try: except: parts to more gracefully handle errors python will try to print to you exactly what goes wrong instead.

from zabbix-whois-expiry.

burnout-champion avatar burnout-champion commented on June 30, 2024

Hi again, I think I found the error,

I tried a whois command for my domain (.gr) and it gives me this:
This TLD has no whois server, but you can access the whois database at
https://grweb.ics.forth.gr/public/whois

while it gives me a proper result when trying google.com

I also put google.com on the json file and it is reported in Zabbix with no issues, so the problem seems to be with the .gr domains in general (all that I have tried).

If I find a way to get a correct result with a simple whois command, would I be able to modify the code a bit to add that and have the result reported to zabbix as well?

Thanks a lot for you help!
Mike

from zabbix-whois-expiry.

okand avatar okand commented on June 30, 2024

It appears to be exactly the same problem I had with .no domains when I first wrote this script years ago (.no works now I noticed though, I should update the readme file). It just lists null for the values we want from the returned results. Code-wise the issue lies somewhere in python-whois instead then which is beyond my control but appears to be handled over here: https://github.com/richardpenman/whois

I can see there are issues about various other TLDs already but I suspect .gr will be more complicated or perhaps not even possible since they appear to not provide standardized whois information at all. You can try this yourself by just running whois example.com and whois forth.gr then compare the results.

alexander@IVER-PF26FMWH:~/code/zabbix-whois-expiry$ whois example.com
   Domain Name: EXAMPLE.COM
   Registry Domain ID: 2336799_DOMAIN_COM-VRSN
   Registrar WHOIS Server: whois.iana.org
   Registrar URL: http://res-dom.iana.org
   Updated Date: 2021-08-14T07:01:44Z
   Creation Date: 1995-08-14T04:00:00Z
   Registry Expiry Date: 2022-08-13T04:00:00Z
   Registrar: RESERVED-Internet Assigned Numbers Authority
   Registrar IANA ID: 376
   Registrar Abuse Contact Email:
   Registrar Abuse Contact Phone:
   Domain Status: clientDeleteProhibited https://icann.org/epp#clientDeleteProhibited
   Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
   Domain Status: clientUpdateProhibited https://icann.org/epp#clientUpdateProhibited
   Name Server: A.IANA-SERVERS.NET
   Name Server: B.IANA-SERVERS.NET
   DNSSEC: signedDelegation
   DNSSEC DS Data: 31589 8 1 3490A6806D47F17A34C29E2CE80E8A999FFBE4BE
   DNSSEC DS Data: 31589 8 2 CDE0D742D6998AA554A92D890F8184C698CFAC8A26FA59875A990C03E576343C
   DNSSEC DS Data: 43547 8 1 B6225AB2CC613E0DCA7962BDC2342EA4F1B56083
   DNSSEC DS Data: 43547 8 2 615A64233543F66F44D68933625B17497C89A70E858ED76A2145997EDF96A918
   DNSSEC DS Data: 31406 8 1 189968811E6EBA862DD6C209F75623D8D9ED9142
   DNSSEC DS Data: 31406 8 2 F78CF3344F72137235098ECBBD08947C2C9001C7F6A085A17F518B5D8F6B916D
   URL of the ICANN Whois Inaccuracy Complaint Form: https://www.icann.org/wicf/
>>> Last update of whois database: 2021-09-28T12:04:11Z <<<

For more information on Whois status codes, please visit https://icann.org/epp

NOTICE: **bunch of extra output removed**

alexander@IVER-PF26FMWH:~/code/zabbix-whois-expiry$ whois forth.gr
This TLD has no whois server, but you can access the whois database at
https://grweb.ics.forth.gr/public/whois

from zabbix-whois-expiry.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.