I am trying to configure an item in Zabbix to preprocessing some data collected and I need to work out a piece of Javascript code in order to loop through the result spit by Zabbix which is collected by an API CALL and count how many words "ERROR" and "WAITING" (just the ones in capital letter) it were found in the dump file.
Below is a snippet of the file to be looped through:
{"body":[{"entity":{"entityType":"xxx.xxx","id":"JA0483_APSDD285_log-sp2340L-dol-ss",
"name":"log-sp2340L-dol-ss","description":"","modifiedTime":1587753102338,"creationTime":1587769148481,
"displayName":"Log:_Dolomite","version":"1.0.0.669","drillHoleID":"APSDD285","type":"USRLOG",
"mode":"MOSAIC","layout":"STACKEDSECTION","categoryIds":["minerallogs"],"fileFormat":"CSV",
"compressionLevel":"NONE","pixelSize":0.0,"storeSize":7676,"generatedDate":1587753102338,
"depthFrom":0.0,"depthTo":0.0,"dataLength":0.0,"storePath":"ProcessedProducts/",
"entityType":"XXX.XXX"},"size":7676,"progress":3882,"status":"ERROR","message":"Server error response code 409:
Key JA0483_APSDD285_log-sp2340L-dol-ss already exists in the store. Use update instead","order":0,
"dateAdded":1587769395658,"dateTransferred":1587769443174,"nextRetryDate":1587769443166,"numRetries":1},
{"entity":{"entityType":"XXX.XXX","id":"JA0483_APSDD234_log-sp2350L-chl-fe-10cm","name":"log-sp2350L-chl-fe-10cm",
"description":"","modifiedTime":1587767851726,"creationTime":1587785977841,"displayName":"__Log: Fe-chlorite (2350nm)",
"version":"1.0.0.673","drillHoleID":"APSDD234","type":"USRLOG","mode":"MOSAIC","layout":"DOWNHOLE",
"categoryIds":["minerallogs"],"fileFormat":"CSV","compressionLevel":"NONE","pixelSize":0.0,"storeSize":39078,
"generatedDate":1587767851726,"depthFrom":0.0,"depthTo":0.0,"dataLength":0.0,"storePath":"ProcessedProducts/JA0483",
"entityType":"XXX.XXX"},"size":39078,"progress":3983,"status":"ERROR","message":"Server error response code 409:
Key JA0483_APSDD234_log-sp2350L-chl-fe-10cm already exists in the store. Use update instead"
The idea of the code is just to count the ERRORs and WAITINGs founds. E.g ERROR = 30, WAITING = 20 etc.
Is this possible? I Don't have experience with JavaScript at all but I do have a good knowledge of Python and Bash but Zabbix does not know these languages to do the preprocessing of a given item. So I am hoping to get some help from the community.