AWK Parser V2 ERROR - Couldn't compile source file -- WARN - Got Unhandled message in state

Here are the actual .ind, .input, and error msg:


show-system-resources.ind.txt

show-system-resources.input.txt

crerror.txt


First .ind script. It seems to run find under command-runner-5.2_43 -- no errors, produces .output file as expected.


Running under command-runner-5.9.3_0000, I get the following output:

2017-10-05 17:15:08,483 544 INFO - Starting command runner
2017-10-05 17:15:08,489 550 INFO - About to run parse-only on "show-system-resources.ind" with input from "show-system-resources.input"
2017-10-05 17:15:08,489 550 INFO - Reading input from show-system-resources.input
2017-10-05 17:15:08,499 560 INFO - Compiling "show-system-resources.ind"
2017-10-05 17:15:10,160 2221 ERROR - Couldn"t compile source file
2017-10-05 17:15:10,164 2225 INFO - Running "fortinet-get-system-performance-status"
[INFO] [10/05/2017 17:15:10.180] [Command-Runner-akka.actor.default-dispatcher-3] [akka://Command-Runner/user/CommandActor-Device:-Command:fortinet-get-system-performance-status] Executor on receive execute command fortinet-get-system-performance-status with operation Some(OperationRequest(DummyRemoteOperation: (get system performance status),fortinet-get-system-performance-status,Map(),Map())) 
[INFO] [10/05/2017 17:15:10.182] [Command-Runner-akka.actor.default-dispatcher-3] [akka://Command-Runner/user/CommandActor-Device:-Command:fortinet-get-system-performance-status] Executor sending to client $b request OperationRequest(DummyRemoteOperation: (get system performance status),fortinet-get-system-performance-status,Map(),Map()) 
[INFO] [10/05/2017 17:15:10.183] [Command-Runner-akka.actor.default-dispatcher-3] [akka://Command-Runner/user/CommandActor-Device:-Command:fortinet-get-system-performance-status] State changed from: Receive to Some(waitForCommandResponse)
[WARN] [10/05/2017 17:15:10.216] [Command-Runner-akka.actor.default-dispatcher-3] [akka://Command-Runner/user/CommandActor-Device:-Command:fortinet-get-system-performance-status] indeni.collector.actors.CommandActor Got Unhandled message in state: waitForCommandResponse, Message: OperationResponse(fortinet-get-system-performance-status,Success(CPU states: 3% user 5% system 0% nice 92% idle
CPU0 states: 0% user 0% system 0% nice 100% idle
CPU1 states: 0% user 6% system 0% nice 94% idle
CPU2 states: 0% user 0% system 0% nice 100% idle
CPU3 states: 12% user 14% system 0% nice 74% idle
Memory states: 66% used
Average network usage: 12083 / 12053 kbps in 1 minute, 13347 / 13294 kbps in 10 minutes, 13792 / 13769 kbps in 30 minutes
Average sessions: 619 sessions in 1 minute, 641 sessions in 10 minutes, 599 sessions in 30 minutes
Average session setup rate: 2 sessions per second in last 1 minute, 3 sessions per second in last 10 minutes, 3 sessions per second in last 30 minutes
Virus caught: 0 total in 1 minute
IPS attacks blocked: 0 total in 1 minute
Uptime: 3 days,  6 hours,  10 minutes),Map()), from: $b

The script then hangs. If I let it hang long enough, I get:

2017-10-05 16:38:50,282 ERROR -- Command execution failure Header = Command execution error,
Description = Command "fortinet-show-system-resources" failed to execute,
Message = Header = Execution Error,
Description = An unexpected error occurred,
Message = Futures timed out after [70000000000 nanoseconds],
...

Here's the script. Tried to make it as simple as I could (code block is not perserving my indents):

#! META
name: fortinet-get-system-performance-status
description: run "get system performance status"
type: monitoring
monitoring_interval: 1 minute
requires:
            vendor: fortinet
    os.name: FortiOS
    product: firewall

#! COMMENTS
memory-usage:
why: If the firewall memory becomes fully utilized, performance may be impacted and traffic may be dropped. It is critical to monitor the memory usage and handle the issue prior to full utilization.
how: indeni uses the built-in Fortigate “get system performance status” command to retreive the usage of the kernel memory.
without-indeni: An administrator could login and manually run the command.
can-with-snmp: false
can-with-syslog: false
vendor-provided-management: Listing the memory is only available from the command line interface.

#! REMOTE::SSH
get system performance status

#! PARSER::AWK

BEGIN {
}

/Memory states/ {
usage=substr($3, 1, length($3)-1)
writeDebug(usage)
writeDoubleMetric(“memory-usage”, null, “gauge”, “60”, usage)
}

END {
}



I pulled my command-runner from here: https://indeni.atlassian.net/wiki/pages/viewpageattachments.action?pageId=59342857

command-runner-awk-v2.zip is command-runner-5.9.3_0000

command-runner.zip is command-runner-5.9.2_43

I'm guessing some aspect of this code is in AWK v1, so you would need to use command-runner.zip / command-runner-5.9.2_43, check out https://indeni.atlassian.net/wiki/spaces/IKP/pages/85524481/AWK+Parser+V2 which may have hints as to what's causing it to fail.


Could also try the awk-dsl-upgrader located on the same download page: https://indeni.atlassian.net/wiki/pages/viewpageattachments.action?pageId=59342857


I also posted about combining these two into one application with an argument for version here: https://community.indeni.com/discussions/topics/38618?page=1

I wish the original format was kept, but here is a guess,

add "|" after "why:" "how:" " without-indeni:", like this:

why: |

....


how: |

....