New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Python custom sensor incompatible with modules subprocess and os?

Votes:

0

Your Vote:

Up

Down

For some reason, when I try to add the following line of code, I get an error:

p = subprocess.Popen("df -Pk -m -xtmpfs -xdevtmpfs", stdout=PIPE, shell=True).stdout

I initially had code that used os instead, but that didn't work either.

As the code runs fine in the Interactive Shell, the only thing I could think of is that I'm importing the module incorrectly. I'm not entirely sure where this script is running from, but I'm importing normally with:

import os import subprocess from subprocess import Popen, PIPE, STDOUT

Should I try moving the modules to a different folder such as the paepy folder? Is it actually an import issue?

Also, I always get the PE233 error no matter what, syntax error, return error, print error. Does that hold some significance?

custom-sensor debug prtg-network-monitor python

Created on Jul 11, 2017 3:19:09 PM by  justinkae (0) 1



1 Reply

Votes:

0

Your Vote:

Up

Down

Dear justinkae

Since the import fails, no correct output is generated, hence the error. PRTG uses its own Python runtime ("C:\Program Files (x86)\PRTG Network Monitor\Python34"). Did you put the modules into the right place?

Created on Jul 12, 2017 2:18:45 PM by  Arne Seifert [Paessler Support]



Please log in or register to enter your reply.


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.