What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Python script not updating text message

Votes:

0

Hi,

I'm using python script to create json output for a custom sensor. In the json output I set 'text' field and this works ok for most of my devices, most of the time. However sometimes the value of the 'text' field is ignored and set to 'OK'.

Can you help me troubleshoot the problem?

Below is the output of the script as created by PRTG (text value is 'Unit (76) connected to Hulk NW AP' but in PRTG I only get 'OK'):

2/06/2020 8:47:14 PM Script File: radio_sensor.py
2/06/2020 8:47:14 PM Script Parameters: {"tlsexplicit_pop3":"","fastcount":"10","esxpassword":"","hostv6":"","blockedsens":"","secretaccesskeyid":"","tlsexplicit_default":"","isexesensor":"0","windowsloginpassword":"","privatekey":"","secret":"","interfacenumber":"","resttoken":"","reboot":"43975.9130191435","pop3password":"","pythonscript":"radio_sensor.py","tlsexplicit_port":"","inerror":"0","smspassword":"","params":"","host":"10.99.4.76","mailpassword":"","tlsexplicit_ftp":"","timeout":"59","elevationpass":"","momopersistent":"","notonpod":"0","linuxloginpassword":"","smtppassword2":"","smtppassword":"","lastuptime":"0","writeresult":"1","reqmsginterval":"60","socksproxypass":"","prtg_linuxpassword":"","tlsexplicit_imap":"","sshelevationpass":"","uptimecount":"0","canlinux":"0","proxypassword":"","proxypass":"","mutexname":"","snmpencpass":"","authuserpwd":"","usednstime":"0","restpassword":"","httppassword":"","addomainpass":"","authtoken":"","oauthrefreshtoken":"","evapassword":"","oauthtoken":"","inum":"","snmpcommv1":"","sensorid":"23293","ipversion":"0","accesskey":"","xmlhttppassword":"","tlsexplicit_smtp":"","password":"","snmpcommv2":"","snmpauthpass":"","awssk":"","dbpassword":"","pingdompassword":"","prtg_windowspassword":"","usewindowsauthentication":"0","simulate":"0","lastmsg":"Unit (76) connected to Hulk NW AP","imappassword":"","ftppassword":""}
2/06/2020 8:47:14 PM Script Parameters (escaped): {\"tlsexplicit_pop3\":\"\",\"fastcount\":\"10\",\"esxpassword\":\"\",\"hostv6\":\"\",\"blockedsens\":\"\",\"secretaccesskeyid\":\"\",\"tlsexplicit_default\":\"\",\"isexesensor\":\"0\",\"windowsloginpassword\":\"\",\"privatekey\":\"\",\"secret\":\"\",\"interfacenumber\":\"\",\"resttoken\":\"\",\"reboot\":\"43975.9130191435\",\"pop3password\":\"\",\"pythonscript\":\"radio_sensor.py\",\"tlsexplicit_port\":\"\",\"inerror\":\"0\",\"smspassword\":\"\",\"params\":\"\",\"host\":\"10.99.4.76\",\"mailpassword\":\"\",\"tlsexplicit_ftp\":\"\",\"timeout\":\"59\",\"elevationpass\":\"\",\"momopersistent\":\"\",\"notonpod\":\"0\",\"linuxloginpassword\":\"\",\"smtppassword2\":\"\",\"smtppassword\":\"\",\"lastuptime\":\"0\",\"writeresult\":\"1\",\"reqmsginterval\":\"60\",\"socksproxypass\":\"\",\"prtg_linuxpassword\":\"\",\"tlsexplicit_imap\":\"\",\"sshelevationpass\":\"\",\"uptimecount\":\"0\",\"canlinux\":\"0\",\"proxypassword\":\"\",\"proxypass\":\"\",\"mutexname\":\"\",\"snmpencpass\":\"\",\"authuserpwd\":\"\",\"usednstime\":\"0\",\"restpassword\":\"\",\"httppassword\":\"\",\"addomainpass\":\"\",\"authtoken\":\"\",\"oauthrefreshtoken\":\"\",\"evapassword\":\"\",\"oauthtoken\":\"\",\"inum\":\"\",\"snmpcommv1\":\"\",\"sensorid\":\"23293\",\"ipversion\":\"0\",\"accesskey\":\"\",\"xmlhttppassword\":\"\",\"tlsexplicit_smtp\":\"\",\"password\":\"\",\"snmpcommv2\":\"\",\"snmpauthpass\":\"\",\"awssk\":\"\",\"dbpassword\":\"\",\"pingdompassword\":\"\",\"prtg_windowspassword\":\"\",\"usewindowsauthentication\":\"0\",\"simulate\":\"0\",\"lastmsg\":\"Unit (76) connected to Hulk NW AP\",\"imappassword\":\"\",\"ftppassword\":\"\"}
2/06/2020 8:47:14 PM Script Path: C:\Program Files (x86)\PRTG Network Monitor\custom sensors\python\radio_sensor.py
2/06/2020 8:47:14 PM Command Line: "C:\Program Files (x86)\PRTG Network Monitor\Python34\python.exe" -E "C:\Program Files (x86)\PRTG Network Monitor\custom sensors\python\radio_sensor.py" "{\"tlsexplicit_pop3\":\"\",\"fastcount\":\"10\",\"esxpassword\":\"\",\"hostv6\":\"\",\"blockedsens\":\"\",\"secretaccesskeyid\":\"\",\"tlsexplicit_default\":\"\",\"isexesensor\":\"0\",\"windowsloginpassword\":\"\",\"privatekey\":\"\",\"secret\":\"\",\"interfacenumber\":\"\",\"resttoken\":\"\",\"reboot\":\"43975.9130191435\",\"pop3password\":\"\",\"pythonscript\":\"radio_sensor.py\",\"tlsexplicit_port\":\"\",\"inerror\":\"0\",\"smspassword\":\"\",\"params\":\"\",\"host\":\"10.99.4.76\",\"mailpassword\":\"\",\"tlsexplicit_ftp\":\"\",\"timeout\":\"59\",\"elevationpass\":\"\",\"momopersistent\":\"\",\"notonpod\":\"0\",\"linuxloginpassword\":\"\",\"smtppassword2\":\"\",\"smtppassword\":\"\",\"lastuptime\":\"0\",\"writeresult\":\"1\",\"reqmsginterval\":\"60\",\"socksproxypass\":\"\",\"prtg_linuxpassword\":\"\",\"tlsexplicit_imap\":\"\",\"sshelevationpass\":\"\",\"uptimecount\":\"0\",\"canlinux\":\"0\",\"proxypassword\":\"\",\"proxypass\":\"\",\"mutexname\":\"\",\"snmpencpass\":\"\",\"authuserpwd\":\"\",\"usednstime\":\"0\",\"restpassword\":\"\",\"httppassword\":\"\",\"addomainpass\":\"\",\"authtoken\":\"\",\"oauthrefreshtoken\":\"\",\"evapassword\":\"\",\"oauthtoken\":\"\",\"inum\":\"\",\"snmpcommv1\":\"\",\"sensorid\":\"23293\",\"ipversion\":\"0\",\"accesskey\":\"\",\"xmlhttppassword\":\"\",\"tlsexplicit_smtp\":\"\",\"password\":\"\",\"snmpcommv2\":\"\",\"snmpauthpass\":\"\",\"awssk\":\"\",\"dbpassword\":\"\",\"pingdompassword\":\"\",\"prtg_windowspassword\":\"\",\"usewindowsauthentication\":\"0\",\"simulate\":\"0\",\"lastmsg\":\"Unit (76) connected to Hulk NW AP\",\"imappassword\":\"\",\"ftppassword\":\"\"}"
2/06/2020 8:47:17 PM Script Output (OEMCP Encoding): {"prtg": {"result": [{"Channel": "Signal", "Value": -59, "CustomUnit": "dBm"}, {"Channel": "Uplink Capacity", "Value": 144.444, "DecimalMode": "Auto", "Float": 1, "CustomUnit": "Mbit/s"}, {"Channel": "Downlink Capacity", "Value": 144.444, "DecimalMode": "Auto", "Float": 1, "CustomUnit": "Mbit/s"}, {"Channel": "RX Throughput", "Value": 2037354966, "Unit": "BytesBandwidth", "Mode": "Difference", "DecimalMode": "Auto"}, {"Channel": "TX Throughput", "Value": 2213351836, "Unit": "BytesBandwidth", "Mode": "Difference", "DecimalMode": "Auto"}, {"Channel": "Device Uptime", "Value": 190.91694444444445, "Unit": "TimeHours", "Float": 1, "DecimalMode": "Auto"}, {"Channel": "Link Uptime", "Value": 190.90166666666667, "Unit": "TimeHours", "Float": 1, "DecimalMode": "Auto"}, {"Channel": "Distance", "Value": 300, "CustomUnit": "m"}, {"Channel": "CPU", "Value": 89, "Unit": "CPU"}, {"Channel": "Frequency", "Value": 5580, "CustomUnit": "Mhz"}, {"Channel": "Unit", "Value": 76, "Unit": "Custom"}, {"Channel": "Longitude", "Value": 147.438953, "Unit": "Custom", "Float": 1, "DecimalMode": "All"}, {"Channel": "Latitude", "Value": -43.167585, "Unit": "Custom", "Float": 1, "DecimalMode": "All"}, {"Channel": "Match", "Value": 0, "Unit": "Custom"}], "text": "Unit (76) connected to Hulk NW AP"}}[CR][LF]
2/06/2020 8:47:17 PM Exit Code: 0
2/06/2020 8:47:17 PM RawStream Size: 1288
2/06/2020 8:47:17 PM OutputStream Size: 1288
2/06/2020 8:47:17 PM Script Output (UTF8 Encoding): {"prtg": {"result": [{"Channel": "Signal", "Value": -59, "CustomUnit": "dBm"}, {"Channel": "Uplink Capacity", "Value": 144.444, "DecimalMode": "Auto", "Float": 1, "CustomUnit": "Mbit/s"}, {"Channel": "Downlink Capacity", "Value": 144.444, "DecimalMode": "Auto", "Float": 1, "CustomUnit": "Mbit/s"}, {"Channel": "RX Throughput", "Value": 2037354966, "Unit": "BytesBandwidth", "Mode": "Difference", "DecimalMode": "Auto"}, {"Channel": "TX Throughput", "Value": 2213351836, "Unit": "BytesBandwidth", "Mode": "Difference", "DecimalMode": "Auto"}, {"Channel": "Device Uptime", "Value": 190.91694444444445, "Unit": "TimeHours", "Float": 1, "DecimalMode": "Auto"}, {"Channel": "Link Uptime", "Value": 190.90166666666667, "Unit": "TimeHours", "Float": 1, "DecimalMode": "Auto"}, {"Channel": "Distance", "Value": 300, "CustomUnit": "m"}, {"Channel": "CPU", "Value": 89, "Unit": "CPU"}, {"Channel": "Frequency", "Value": 5580, "CustomUnit": "Mhz"}, {"Channel": "Unit", "Value": 76, "Unit": "Custom"}, {"Channel": "Longitude", "Value": 147.438953, "Unit": "Custom", "Float": 1, "DecimalMode": "All"}, {"Channel": "Latitude", "Value": -43.167585, "Unit": "Custom", "Float": 1, "DecimalMode": "All"}, {"Channel": "Match", "Value": 0, "Unit": "Custom"}], "text": "Unit (76) connected to Hulk NW AP"}}[CR][LF]

custom-python-script custom-sensor json python

Created on Jun 2, 2020 8:59:22 PM



3 Replies

Votes:

0

Hi there,

Please note that we cannot support custom scripts. However, if the issue occurs did you run the script manually to validate the text output?

Created on Jun 3, 2020 9:14:17 AM by  Moritz Heller [Paessler Support]



Votes:

0

This script has been tested and is in production environment, so I'm not asking for support in regards to the custom script. It works on 100+ devices most of the time.

All I'm reporting is that under some circumstances it returns 'OK' in the status message instead of what I supplied in 'text' field.

I have just noticed that when I restarted the probe yesterday, all devices started to return the correct message status which I supplied in the 'text' field of the script. Perhaps all I needed was to do just that - restart the probe after setting up devices.

It will be interesting to see if this issue resurfaces, in which case I will have to restart the probe service daily.

Thank you for your time.

Created on Jun 3, 2020 11:07:45 PM



Votes:

0

Thank you for the feedback.

I would recommend to write an email to [email protected] if the issue occurs next time since it's easier to share log files and screenshots via email.

Created on Jun 4, 2020 1:41:05 PM by  Moritz Heller [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.