PRTG / PythonMiniProbe

MiniProbe for PRTG Network Monitor written in Python
BSD 3-Clause "New" or "Revised" License
73 stars 50 forks source link

Disk Space and External IP sensors failed #52

Open sardjono opened 8 years ago

sardjono commented 8 years ago

PythonMiniProbe installed on Ubuntu 14.04LTS.Installation went smoothly.

The following sensors are working: CPU Load, Memory, Probe Health. The following sensors failed: DIsk Space, External IP

Debug log shows the following:

07/03/2016 20:34:57 - INFO - Starting new HTTPS connection (1): 192.168.1.121 07/03/2016 20:34:57 - INFO - tasks request successfully sent to PRTG Core Server at 192.168.1.121:443. 07/03/2016 20:34:57 - DEBUG - Connecting to 192.168.1.121:443 07/03/2016 20:34:57 - DEBUG - Status Code: 200 | Message: [{"sensorid":"2016","kind":"mpcpuload","host":"127.0.0.1"},{"sensorid":"2017","kind":"mpmemory","host":"127.0.0.1"},{"sensorid":"2018","kind":"mpdiskspace","host":"127.0.0.1"},{"sensorid":"2019","maxtemp":"45","kind":"mpprobehealth","host":"127.0.0.1","celfar":"C"},{"sensorid":"2020","kind":"mpexternalip","host":"127.0.0.1"}] 07/03/2016 20:34:57 - INFO - Task success. 07/03/2016 20:34:57 - DEBUG - Task success. HTTP Status 200, Message: [{"sensorid":"2016","kind":"mpcpuload","host":"127.0.0.1"},{"sensorid":"2017","kind":"mpmemory","host":"127.0.0.1"},{"sensorid":"2018","kind":"mpdiskspace","host":"127.0.0.1"},{"sensorid":"2019","maxtemp":"45","kind":"mpprobehealth","host":"127.0.0.1","celfar":"C"},{"sensorid":"2020","kind":"mpexternalip","host":"127.0.0.1"}] 07/03/2016 20:34:57 - DEBUG - JSON response: [{u'sensorid': u'2016', u'kind': u'mpcpuload', u'host': u'127.0.0.1'}, {u'sensorid': u'2017', u'kind': u'mpmemory', u'host': u'127.0.0.1'}, {u'sensorid': u'2018', u'kind': u'mpdiskspace', u'host': u'127.0.0.1'}, {u'sensorid': u'2019', u'kind': u'mpprobehealth', u'maxtemp': u'45', u'host': u'127.0.0.1', u'celfar': u'C'}, {u'sensorid': u'2020', u'kind': u'mpexternalip', u'host': u'127.0.0.1'}] 07/03/2016 20:34:57 - DEBUG - {u'sensorid': u'2016', u'kind': u'mpcpuload', u'host': u'127.0.0.1'} 07/03/2016 20:34:57 - DEBUG - Spawning sensor mpcpuload. 07/03/2016 20:34:57 - DEBUG - Running sensor: mpcpuload 07/03/2016 20:34:57 - DEBUG - {u'sensorid': u'2017', u'kind': u'mpmemory', u'host': u'127.0.0.1'} 07/03/2016 20:34:57 - DEBUG - Spawning sensor mpmemory. 07/03/2016 20:34:57 - DEBUG - Running sensor: mpmemory 07/03/2016 20:34:57 - DEBUG - {u'sensorid': u'2018', u'kind': u'mpdiskspace', u'host': u'127.0.0.1'} 07/03/2016 20:34:57 - DEBUG - Spawning sensor mpdiskspace. 07/03/2016 20:34:57 - ERROR - Ooops Something went wrong with 'mpdiskspace' sensor 2018. Error: invalid literal for int() with base 10: 'TB' 07/03/2016 20:34:57 - DEBUG - {u'sensorid': u'2019', u'kind': u'mpprobehealth', u'maxtemp': u'45', u'host': u'127.0.0.1', u'celfar': u'C'} 07/03/2016 20:34:57 - DEBUG - Spawning sensor mpprobehealth. 07/03/2016 20:34:57 - DEBUG - Current Health: 100 percent 07/03/2016 20:34:57 - DEBUG - Running sensor: mpprobehealth 07/03/2016 20:34:57 - DEBUG - {u'sensorid': u'2020', u'kind': u'mpexternalip', u'host': u'127.0.0.1'} 07/03/2016 20:34:57 - DEBUG - Spawning sensor mpexternalip. 07/03/2016 20:34:57 - DEBUG - Running sensor: mpexternalip 07/03/2016 20:34:57 - DEBUG - IP-Address: [{'kind': 'Custom', 'name': 'IP-Address', 'ShowTable': 0, 'ShowChart': 0, 'value': 1, 'customunit': '', 'mode': 'integer'}] 07/03/2016 20:34:57 - ERROR - Ooops Something went wrong with 'mpexternalip' sensor 2020. Error: [Errno 19] No such device 07/03/2016 20:34:57 - INFO - Starting new HTTPS connection (1): 192.168.1.121 07/03/2016 20:34:57 - INFO - data request successfully sent to PRTG Core Server at 192.168.1.121:443. 07/03/2016 20:34:57 - DEBUG - Connecting to 192.168.1.121:443 07/03/2016 20:34:57 - DEBUG - Status Code: 200 | Message: Done 07/03/2016 20:34:57 - INFO - Data success. 07/03/2016 20:34:57 - DEBUG - Data success. Details: HTTP Status 200, Message: Done

Goro2030 commented 6 years ago

externalip.py is not working because it's quering http://icanhasip.com/ that is no longer available. It has to be changed to another service and recompiled. Anyone, suggestions?

tabascoterrier commented 6 years ago

https://www.ipify.org/ is a favourite of mine - no limits and either text, json, or jsonp output

Goro2030 commented 6 years ago

@tabascoterrier , can you adapt the code and push it so we can use the probe again??

tabascoterrier commented 6 years ago

@Goro2030 Looking at the externalip.py code, while the sensor description says http://icanhasip.com (with an 's'), the actual check is done against http://icanhazip.com (with a 'z'), which seems to be working - so it looks like the problem lies elsewhere.

I see that externalip.py has a hard coded 'eth0' for it's local IP address check, so that might well be the cause of the Error: [Errno 19] No such device in the original issue if there's no eth0 device available.

Is that the same error that you're getting?

tabascoterrier commented 6 years ago

Looking further, that does indeed seem to be the problem - I've created pull request https://github.com/PRTG/PythonMiniProbe/pull/57 with a fix.

Goro2030 commented 6 years ago

Thanks @tabascoterrier ... will check now and let you know if this worked to close this issue

Goro2030 commented 6 years ago

I see that you've merged, but it's not in the main repository yet? I've reinstalled the probe using the install.sh, and it downloaded the old version :(

tabascoterrier commented 6 years ago

Someone from PRTG will have to merge my pull request into the main repository I'm afraid @Goro2030 - I'm just a customer 😃 In the meantime, if you replace the miniprobe/sensors/externalip.py file on your probe with this one and restart the mini probe service, that'll give you the fix.

Goro2030 commented 6 years ago

Thanks @tabascoterrier ! Let's wait for the merge then ... I did replace the externalip.py file in the /miniprobe/sensors folder, but it still doesn't work. Don't I need to "recompile" it somehow? I've run python setup.py configure, and python setup.py install to no avail...

EDIT: It worked now!!! Just had to wait :)

Goro2030 commented 6 years ago

Since you seem to be an awesome expert on PRTG ... let me ask you a follow up question on this probe. Now that I've got the externalIP that I was looking for, can I create another monitor that will look for, let's say, PING to this external IP?

tabascoterrier commented 6 years ago

Good to hear that worked for you @Goro2030 :)

Hmm, I can't immediately think of a way of pinging the address that sensor returns I'm afraid. If you were just after down notifications, you could set a notification on the miniprobe sensor. If you were after response times and things, perhaps you could use a dynamic DNS service like noip.com, get whatever is running the miniprobe to update that, and then ping the DNS name from the regular PRTG probe instead? The DNS name would always reflect the current IP then.

Goro2030 commented 6 years ago

My guru, thanks for the ideas .... let me explain the situation, and you may think of something :)

I have a linux machine behind a router at a remote location. I run the linux miniprobe in that linux machine, and i'm monitoring it , that's ok.

That miniprobe returns me the external IP, which is the IP of the router for that location.

I want to monitor that router, but i can't install something like noip.com at that router since I don't control the router. I could install no-ip client in my linux machine that I do control, but i'm so newbie that i wouldn't know how ...

On Fri, Jun 1, 2018 at 3:05 AM, tabascoterrier notifications@github.com wrote:

Good to hear that worked for you @Goro2030 https://github.com/Goro2030 :)

Hmm, I can't immediately think of a way of pinging the address that sensor returns I'm afraid. If you were just after down notifications, you could set a notification on the miniprobe sensor. If you were after response times and things, perhaps you could use a dynamic DNS service like noip.com, get whatever is running the miniprobe to update that, and then ping the DNS name from the regular PRTG probe instead? The DNS name would always reflect the current IP then.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PRTG/PythonMiniProbe/issues/52#issuecomment-393784135, or mute the thread https://github.com/notifications/unsubscribe-auth/AKXxmrNAbg2A_GFsfxzWLGuh_NsSV9Smks5t4OfOgaJpZM4JD3Kz .

tabascoterrier commented 6 years ago

If it were me doing it, I'd get something like a no-ip client running on the box running the miniprobe, and then just monitor the no-ip hostname - there are instructions here, but I'm afraid I won't be able to help you with it; if you run into any problems you could always try asking on superuser.com though :)

Goro2030 commented 6 years ago

Thanks , I'll follow the instructions, seems easy enough ;)

On Tue, Jun 5, 2018 at 5:28 AM tabascoterrier notifications@github.com wrote:

If it were me doing it, I'd get something like a no-ip client running on the box running the miniprobe, and then just monitor the no-ip hostname - there are instructions here https://www.noip.com/support/knowledgebase/installing-the-linux-dynamic-update-client/, but I'm afraid I won't be able to help you with it; if you run into any problems you could always try asking on superuser.com though :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/PRTG/PythonMiniProbe/issues/52#issuecomment-394643894, or mute the thread https://github.com/notifications/unsubscribe-auth/AKXxmiRmsqohYYer6jDOWaGyzvL9R_2qks5t5k8igaJpZM4JD3Kz .