Escape characters for NSCA passive check

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
Dearl1988
Posts: 4
Joined: Wed Oct 18, 2017 6:29 am

Escape characters for NSCA passive check

Post by Dearl1988 »

I'm running a powershell script to tell Nagios Core about an event using NSCA so it checks passively for the event.

This is the piece of code I'm running on my powershell script.

Code: Select all

nscp client --module NSCAClient host=serverIP port=5667 sender-host="WindowsServer_Name" encryption=XOR command="myService" result=1 message="somePowerShellVariable"
What I basically want is a kind of help on the command option "message"... I want it to accept escape characters such those used in C like \n or in powershell such as `n... I want to do a new line so it displays more information on that block.
Attachments
This is the message it displays on my nagios core
This is the message it displays on my nagios core
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Escape characters for NSCA passive check

Post by npolovenko »

Hello, @Dearl1988. As far as I know, Nagios should accept \n newline character in the status information field. Have you tried that? I think it's using PHP for the front end so most characters supported in PHP they should work in Nagios.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Dearl1988
Posts: 4
Joined: Wed Oct 18, 2017 6:29 am

Re: Escape characters for NSCA passive check

Post by Dearl1988 »

It was actually a lot easier than I thought, I asked my boss about it and he said it should accept HTML tags, so guess what?!

It worked with <br>

But, many characters were not acceptable as arguments passing through like \, _, -, |, "

Any guess how I can override this?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Escape characters for NSCA passive check

Post by npolovenko »

@Dearl1988 , Glad that worked for you. Yes, so basically those plugin output fields will accept most of the HTML characters. But I don't think it's possible to make special characters from C be recognized in that context. If your goal is just to be able to pass these characters as a string then you could try to use some standard escape characters like \, you could try wrapping your message in single quotes, etc. Or is there any way to configure your NSCA check to return the output without special characters?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked