WAdama/nas_ab_status

Issues with Device showing in probe

wilcochris opened this issue · 23 comments

Hi WAdama,

I have managed to get the script up and running minus 1 part of it.

When I add my device as a parameter, this does not show up as a device in the Probe (it shows as unknown as I had to add an option for 0 as that gave errors also)

Adding the VM name in the sensor

prtg-abb-1

VM name not showing so pulls no info

prtg-abb-2

Device name as showing in ABB

prtg-abb-3

I'm pretty sure there is just something simple I am missing but I cannot see it and was wondering if you would be able to shed any light on it.

Thanks

Hi Chris,

certainly...

Just to be sure: I presume SSH connection from PRTG to Syno works and the script is located in the correct folder? But otherwise PRTG wouldn't find the script.

On first look it looks perfect for me, too...

Could you log onto your Syno with SSH and enter the following line:
sqlite3 /volume1/@ActiveBackup/activity.db "select device_name from device_result_table"
This should give you all the devices known to ABB.

Regards
Ingo

Hi Ingo,

Thanks for the reply.

I did put in incorrect credentials just to make sure the connection would break and it did until I put in the credentials I first tried.

I tried that command and it brought back so many duplicate items and the devices are of the naming convention I put in the parameters.

I put them again in PRTG and it just doesn’t bring back the device to give any info sadly.

Hi Chris,

then we at least know the name is correct.

It's maybe a dumb question but you're using "nas_ab_status.sh"? This is the one for a single device.

What's happening if you're run the script manually on your Syno? (nas_ab_status.sh <device_name>)

I am using the singular script.

If I run the script from the NAS and put in the device name it brings back the code and shows the device name in Device:

I used a couple of my devices and it pulled back the device name. It doesn’t bring back anything about the size of the data or anything else about it, just the name.

I put in a non-existent device and it errored which is good.

Now I'm confused...

If I'm doing that I've getting back the xml used by PRTG:

./nas_ab_status.sh <device_name>
<?xml version="10.0" encoding="UTF-8" ?><prtg><result><channel>Last Backup</channel><value>2</value><ValueLookup>prtg.standardlookups.nas.abstatus</ValueLookup><ShowChart>0</ShowChart></result><result><channel>Duration</channel><value>164</value><unit>TimeSeconds</unit></result><result><channel>Time passed</channel><value>42955</value><unit>TimeSeconds</unit><LimitMode>1</LimitMode><LimitMaxWarning>129600</LimitMaxWarning><LimitMaxError>216000</LimitMaxError></result><result><channel>Data transferred</channel><value>7700555264</value><unit>BytesDisk</unit><VolumeSize>GigaByte</VolumeSize></result> <text>Device: <device_name></text></prtg>

I've just run it again and get the following info

<?xml version="10.0" encoding="UTF-8" ?> <prtg> <result> <channel>Last Backup</channel> <value>2</value> <ValueLookup>prtg.standardlookups.nas.abstatus</ValueLookup> <ShowChart>0</ShowChart> </result> <result> <channel>Duration</channel> <value>1444</value> <unit>TimeSeconds</unit> </result> <result> <channel>Time passed</channel> <value>37858</value> <unit>TimeSeconds</unit> <LimitMode>1</LimitMode> <LimitMaxWarning>129600</LimitMaxWarning> <LimitMaxError>216000</LimitMaxError> </result> <result> <channel>Data transferred</channel> <value>8162541568</value> <unit>BytesDisk</unit> <VolumeSize>GigaByte</VolumeSize> </result> <text>Device: CW50PRINTER</text> </prtg>

I checked the probe in PRTG and it still isn't bringing back any info and doesn't recognise the device name from the parameters

I forgot to add also that when running the scripts directly from the NAS I have to use sudo. Is this is how it should be?

Okay, that shows us the script itself is working.

Yes, sudo is necessary otherwise you don't get access to the database.

It seems the screenshot for the SSH configuration showed this not clear enough...

It seems like everything is set up as it should be.

Thank you for your help so far.

Do you have any other suggestions on what I should check?

PRTG won’t support as it’s not an official probe.

If I remember correct you must restart the probe service after changing the credentials for SSH access. Or was it only when you use certificates and changed it?

I have changed the SSH authentication on my Syno to certificate authentication and added this line to sudoers:
%administrators ALL = NOPASSWD: ALL
So all members of administrators don't need a password for sudo.

By the way: You can ask questions in the knowledge base of Paessler even if you're using the free license and they did answer...

Hi Ingo,

Whenever I made a change to the creds in PRTG I had only refreshed the custom lookups.

I have just restarted the probe service and no change to what is displayed. It still isn't recognising what i've put in the parameter field.

I only use password to access it. Linux is not my thing at all and most of it is over my head i'm afraid

Did you configure the access based on this manual?
https://www.paessler.com/manuals/prtg/device_settings#cred_linux

The problem is without root access we don't come much further...

The account I am using has root access to the NAS.

It's ok. We tried. I like the idea of it though as it saves a lot of time.

At least I know my script is not faulty... ;-)

Then I will close this. Maybe you will get it to work at some point, I hope...

Hi Ingo,

I have been having a look into this some more and I am getting the following error in PRTG

Warning by lookup value 'Undefined lookup value (0)' in channel 'Last Backup' (Device:)

It would appear that it can't pull the correct value from that channel despite it showing as correct when running it in the terminal on the NAS

Running the script with the VM name in the terminal brings this back for that channel

<channel>Last Backup</channel><value>2</value><ValueLookup>prtg.standardlookups.nas.abstatus</ValueLookup>

The user/password combination is working in PRTG as it just errors out if I use anything different.

I think it's still the "sudo" thing...

You can activate the result handling in "SSH Specific" part of the sensor. This will write log files in C:\ProgramData\Paessler\PRTG Network Monitor\Logs\sensors

I have turned logging on and it appears the command is not being run by sudo despite me putting in the username and password of an account that can use sudo when SSH'd into the NAS.

I have also added the no password line to the sudoers file but this still doesn't seem to work either.

I am at a loss as to what to do now with it as it appears everything is as it should be

Hi Ingo

This is the following output from the error file

[INFO][02/03/2021 20:09:14] Opening Connection
[INFO][02/03/2021 20:09:14] Shell: $SHELL = /bin/sh
26271 pts/17 00:00:00 sh

[INFO][02/03/2021 20:09:14] Sending command /var/prtg/scriptsxml/nas_ab_status.sh CW50WSUS
[INFO][02/03/2021 20:09:15] Sending EOF
[INFO][02/03/2021 20:09:15] Reading PaeSSH result
[INFO][02/03/2021 20:09:21] [STDOUT] Error: unable to open database file
Error: unable to open database file
Error: unable to open database file
Error: near "and": syntax error
/var/prtg/scriptsxml/nas_ab_status.sh: line 14: - : syntax error: operand expected (error token is "- ")
/var/prtg/scriptsxml/nas_ab_status.sh: line 15: 1614715718 - : syntax error: operand expected (error token is "- ") Last Backup</channel><value></value><ValueLookup>prtg.standardlookups.nas.abstatus</ValueLookup><ShowChart>0</ShowChart></result><result><channel>Duration</channel><value></value><unit>TimeSeconds</unit></result><result><channel>Time passed</channel><value></value><unit>TimeSeconds</unit><LimitMode>1</LimitMode><LimitMaxWarning>129600</LimitMaxWarning><LimitMaxError>216000</LimitMaxError></result><result><channel>Data transferred</channel><value></value><unit>BytesDisk</unit><VolumeSize>GigaByte</VolumeSize></result> <text>Device: </text></prtg>

[INFO][02/03/2021 20:09:21] [STDERR]
[INFO][02/03/2021 20:09:21] Sending exit
[INFO][02/03/2021 20:09:21] Sending EOF

If I SSH to the NAS and then run the script as the user I have added in the sensor I can run it without an issue.

Do you have any other suggestions as to what may be causing this?

Sorry to be a pain.

Hi Chris,
you have quoted only one log. There should be two to three files per sensor.
The content of the other files may as well important...

Hi Ingo,

This is the output from the other file. I hadn't seen that it had created it

Data['donotcheckshell'].asString := ''; Data['elevationkind'].asString := 'sudo'; Data['fastcount'].asString := '0'; Data['resultfile'].asString := 'Result of Sensor 2292.txt'; Data['hostv6'].asString := ''; Data['blockedsens'].asString := ''; Data['tlsexplicit_default'].asString := ''; Data['channelnames'].asString := 'Execution Time'#$D#$A + '1'#$D#$A + 'Last Backup'#$D#$A + '2'#$D#$A + 'Duration'#$D#$A + '3'#$D#$A + 'Time passed'#$D#$A + '4'#$D#$A + 'Data transferred'#$D#$A + '5'#$D#$A + ''; Data['isexesensor'].asString := '0'; Data['privatekey'].asString := ''; Data['port'].asString := '55522'; Data['sshversion_sensor'].asString := '0'; Data['reboot'].asString := '44256.8825664583'; Data['command'].asString := '/var/prtg/scriptsxml/nas_ab_status.sh CW50WSUS'; Data['tlsexplicit_port'].asString := ''; Data['ssh_linuxshell'].asString := '$SHELL = /bin/sh'#$D#$A + '10231 pts/20 00:00:00 sh'#$D#$A + ''; Data['inerror'].asString := '0'; Data['host'].asString := 'CW50SRS812'; Data['tlsexplicit_ftp'].asString := ''; Data['timeout'].asString := '60'; Data['elevationpass'].asString := ''; Data['deviceid'].asString := '2190'; Data['notonpod'].asString := '0'; Data['momopersistent'].asString := ''; Data['lastuptime'].asString := '0'; Data['writeresult'].asString := '2'; Data['checkflavor'].asString := ''; Data['reqmsginterval'].asString := '60'; Data['usedsha2'].asString := '1'; Data['tlsexplicit_imap'].asString := ''; Data['scriptparams'].asString := 'CW50WSUS'; Data['canlinux'].asString := '0'; Data['channelinfos'].asString := '{"1":{"Unit":"oukTimeResponse","CustomUnit":"","ValueLookupName":"","LimitMode":"0","LimitMinError":"","LimitMinWarning":"","LimitMaxError":"","LimitMaxWarning":""},"2":{"Unit":"oukCustom","CustomUnit":"","ValueLookupName":"prtg.standardlookups.nas.abstatus","LimitMode":"0","LimitMinError":"","LimitMinWarning":"","LimitMaxError":"","LimitMaxWarning":""},"3":{"Unit":"oukTimeSeconds","CustomUnit":"#","ValueLookupName":"","LimitMode":"0","LimitMinError":"","LimitMinWarning":"","LimitMaxError":"","LimitMaxWarning":""},"4":{"Unit":"oukTimeSeconds","CustomUnit":"#","ValueLookupName":"","LimitMode":"1","LimitMinError":"","LimitMinWarning":"","LimitMaxError":"216000","LimitMaxWarning":"129600"},"5":{"Unit":"oukBytesDisk","CustomUnit":"#","ValueLookupName":"","LimitMode":"0","LimitMinError":"","LimitMinWarning":"","LimitMaxError":"","LimitMaxWarning":""}}'; Data['scriptfile'].asString := 'nas_ab_status.sh'; Data['uptimecount'].asString := '0'; Data['mutexname'].asString := ''; Data['usednstime'].asString := '0'; Data['elevationname'].asString := 'PRTG'; Data['sshversion_devicegroup'].asString := '2'; Data['ipversion'].asString := '0'; Data['sensorid'].asString := '2292'; Data['tlsexplicit_smtp'].asString := ''; Data['password'].asString := '***'; Data['shelltimeout'].asString := '10'; Data['user'].asString := 'PRTG'; Data['simulate'].asString := '0'; Data['timeoutdegradation'].asString := '1'; Data['lastmsg'].asString := 'Device:'; Data['elevation'].asString := '1'; Data['tlsexplicit_pop3'].asString := '';

Normally I've got three files if I'm activating this. But I don't know if a third file will help any further. I'm out of ideas.
Maybe one thing: Do you by any chance using the beta version of Active Backup?

The only other file I have in there is an empty file

I am using the latest version that is provided with DSM

I am not sure why PRTG isn't running the file as sudo even though I have specified a user than can use sudo on the NAS

Thank you for looking, I really appreciate it.

I was going to try the passphrase option but I really am at a loss about generating keys and such as Linux is way over my head

The last tip I can give is to open a question in the knowledge base from Paessler. You can do this even you use the free license and they answer. I've done this myself several times.
https://kb.paessler.com/en/
Maybe you also find there a hint for your problem.