Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Windows Alert Command Adding Double and Single quotes.
#1
To make a long story short, I am working on PagerDuty integration.
To do this it calls a perl script with parameters passed to it in the alert command.
I got it to work, kind of, but as there are spaces in the variables the information is not handed to PagerDuty correctly.
Examples below:
Code:
# This is the "working" command.
perl.exe C:\PandoraFMS\Pandora_Server\util\pagerduty\pandorafmsalert2pagerduty.pl _field8_ _id_alert_ _field9_ _module_ _timestamp_ _alert_text_severity_ _agent_ _module_ _data_
Output from it:
Code:
2017-10-12 10:43:03 MONITOR-PHX [V8] Command 'C:\PandoraFMS\Pandora_Server\bin\pandora_exec.exe 15 perl.exe C:\PandoraFMS\Pandora_Server\util\pagerduty\pandorafmsalert2pagerduty.pl 12345678 3 trigger HostAlive 2017-10-12 10:43:02 Critical SQL01 HostAlive N/A' for action 'PagerDuty Alert' alert 'PagerDuty alert of Critical condition' agent 'SQL01' returned with errorlevel 0
Because of the spaces, in things like the timestamp, when it goes into PagerDuty the timestamp has the date and the severity has the time. Obviously first thing I tried was to add quotes. 
Code:
perl.exe C:\PandoraFMS\Pandora_Server\util\pagerduty\pandorafmsalert2pagerduty.pl "_field8_" "_id_alert_" "_field9_" "_module_" "_timestamp_" "_alert_text_severity_" "_agent_" "_module_" "_data_"
Output from this:
Code:
2017-10-12 10:43:03 MONITOR-PHX [V8] Command 'C:\PandoraFMS\Pandora_Server\bin\pandora_exec.exe 15 perl.exe C:\PandoraFMS\Pandora_Server\util\pagerduty\pandorafmsalert2pagerduty.pl ""'12345678'"" ""'3'"" ""'trigger'"" ""'HostAlive'"" ""'2017-10-12 10:43:02'"" ""'Critical'"" ""'SQL01'"" ""'HostAlive'"" ""'N/A'""' for action 'PagerDuty Alert' alert 'PagerDuty alert of Critical condition' agent 'SQL01' returned with errorlevel 1
Now I am trying to figure out if this a bug, known issue, or if I am doing something wrong.
I have since tried single quotes, grave, even on quoting the ones that have spaces in them, all with no luck and the same basic weird "' injected to the command.
Any help would be appreciated.
 Reply
#2
Hi Devok,

When you enter the data, you have to put the fields like this, "_field1_" "_field2_", etc ...
There must be as many "_fieldX_" fields as arguments.

Example:
perl fullpluginpath "_field1_" "_field2_" "_field3_" "_field4_" "_field5_" "_field6_" "_field7_" "_field8_" "_field8_"

If the actual values within each field contain spaces, the Pandora server will take them as separate fields.

Best regards,

vic.
 Reply


Users browsing this thread: 1 Guest(s)


(c) 2006-2017 Artica Soluciones Tecnológicas. Contents of this wiki are under Create Common Attribution v3 licence. | pandorafms.com | pandorafms.org

Theme © MyBB Themes