Nagios adds characters to SQL Data from VBS Script

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
warnox
Posts: 39
Joined: Thu Nov 20, 2014 5:22 am

Nagios adds characters to SQL Data from VBS Script

Post by warnox »

Hi,

I'm using a Backup Exec VBS script, http://exchange.nagios.org/directory/Pl ... ec/details, to query if a Backup Job has failed. The script works fine but the output from Nagios adds in extra characters wherever there is a space in the SQL output.

In the output below, the string 'Error on backup job' is inserted by the VBS script just as a string, while 'Job Failed' comes from a SQL query.

Running the script locally

Code: Select all

C:\Program Files\NSClient++\scripts>cscript be_test.vbs
Microsoft (R) Windows Script Host Version 5.8
Copyright (C) Microsoft Corporation. All rights reserved.

Error on backup job | Job Failed
Executing the script from Nagios

Code: Select all

[root@nagios sysadmin]# /usr/local/nagios/libexec/check_nrpe -H xx.xx.xx.xx -c be_test
Error on backup job |'Job'=0 'Failed'=0
It looks like when the script is executed from Nagios it adds ' '=0 around every word which is separated by a space. Although this is only for results which are returned from SQL.

Nagios Core 4.0.8
NSClient 0.4.1.105

Thanks for any help.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios adds characters to SQL Data from VBS Script

Post by abrist »

warnox wrote:Error on backup job | Job Failed
What is the intent of this output? As per the nagios plugin spec, anything after the pipe will be processed as performance data. Performance data has the format:
'label'=value[UOM];[warn];[crit];[min];[max]
From: https://nagios-plugins.org/doc/guidelines.html#AEN200

Essentially, "Job Failed" is not valid performance data.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
warnox
Posts: 39
Joined: Thu Nov 20, 2014 5:22 am

Re: Nagios adds characters to SQL Data from VBS Script

Post by warnox »

That was the issue!

The script has a line which separates some general text output using a pipe '|', which Nagios uses to separate performance data as you pointed out. I changed this to a hyphen '-' and now everything is fine. I will comment on the script page so the author can adjust it.

Code: Select all

txt = "Error on backup job | " & txt
Thanks for your help.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios adds characters to SQL Data from VBS Script

Post by abrist »

No problem. Happy Trails!
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked