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

Advanced ssh sensor failure - returning 4096 instead of value

Votes:

0

I have a perl script on a linux system that measures the sizes of various directories. The script is in /var/prtg/scriptsxml and is correctly found when adding a sensor.

PRTG runs the script without error, but the values returned are not what the script outputs and I'm confused why.

Script output:

{
 "prtg": {
  "result": [
             {
              "channel": "ThingOne",
              "value": "372005484",
              "VolumeSize": "GigaByte",
              "unit": "BytesFile"
             },
             {
              "channel": "Tester",
              "value": "85",
              "VolumeSize": "GigaByte",
              "unit": "BytesFile"
             }
           ]
          }
         }

In PRTG I've created a new "SSH Script Adanced" sensor on running, it reports ThingOne as 4096 and Tester as 20 bytes, rather than the value in json.

Eg:

Date Time 	Execution Time 	ThingOne   Tester 	Downtime 	Coverage 
  
07/01/2020 15:30:39 544 msec	4,096 Byte	20 Byte	0 %	100 %
07/01/2020 15:29:39 426 msec	4,096 Byte	20 Byte	0 %	100 %
07/01/2020 15:28:39 466 msec	4,096 Byte	20 Byte	0 %	100 %
07/01/2020 15:27:39 469 msec	4,096 Byte	20 Byte	0 %	100 %
07/01/2020 15:26:39 492 msec	4,096 Byte	20 Byte	0 %	100 %

perl ssh ssh-advanced

Created on Jan 7, 2020 4:02:17 PM

Last change on Jan 8, 2020 5:46:02 AM by  Sven Roggenhofer [Paessler Technical Support]



4 Replies

Votes:

0

Hi digdilem,

Thank you for the post!

Please let me know if you already used the option "Write Results To Disk" in the Sensor settings. If not, please enable this option. This will create additional log files in the "Logs (Sensors)" folder in the PRTG Data Directory (https://kb.paessler.com/en/topic/463).
In "Logs (Sensors)" there should be a file called "Result of Sensor XXXXX". Please post the content of this file. The output should be very similar to the json output you already posted.

Created on Jan 8, 2020 11:36:38 AM by  Moritz Heller [Paessler Support]



Votes:

0

Thanks for your response, Moritz.

I have tried this, and just re-tried this - creating the sensor again with write to file enabled, but no files are created in "C:\ProgramData\Paessler\PRTG Network Monitor\Logs (Sensors)" on the prtg server after several minutes of running.

I've searched the entire C: drive for "Result of*" and nothing's coming up, so now I'm wondering if there is a secondary issue with our PRTG installation where it's not creating these log files.

Additional to my original query: I've changed the output from my perl script to XML and it behaves the same as the json output.

Bizarrely, if I hardcode the values and just print that output (as opposed to programmatically generating the script), PRTG then graphs the correct results. I can't see anything wrong with the generated output (no strange characters) - the only thing that differs is that the perl program is calling a sub-shell using `du -s /path/to/dirs`

My current suspicion is that making this sub-shell is somehow breaking how PRTG's ssh monitor reads the perl's output....

Does this ring any bells?

Created on Jan 8, 2020 1:52:53 PM



Votes:

0

Thanks for your help - I have now resolved my problem and have the sensor working as expected.

For the benefit of you and others;

  • Issue 1: Script returning different values through prtg: Turned out to be a permissions issue. The directories that the script was checking were accessible to me running the script manually as root, but the prtg ssh user didn't have access. It's odd that it returned different values for the two directories rather than a failure, but that's definitely what the cause was. I rewrote the plugin to generate an xml file when supplied with a cron parameter, and scheduled that - and the same plugin just outputs that xml dropfile from an accessible location when prtg calls it.
  • Issue 2 Lack of logging: It seems that since prtg was installed, a previous admin had changed the ProgramData path it uses to the D: drive, so the location offered in your documentation only showed stuff from 2017.

    Glad to have resolved this now

Created on Jan 9, 2020 8:19:59 AM

Last change on Jan 9, 2020 2:31:47 PM by  Moritz Heller [Paessler Support]



Votes:

1

Hi digdilem,

Thank you for the update.

I'm glad the issue is solved and thank you to share the answer to our community.

Have a nice day!

Created on Jan 9, 2020 9:49:15 AM 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.