Get file ID in custom probe

System sends argument of file type in custom probes as JSON objects, that contains file’s name and ID:

{
  "name":"31097580.png",
  "type":"file",
  "id":"66bc9c6bafca18083717d2c4"
}

To display this information in the Data table, you can use the following script that outputs all arguments defined in a probe:

  • Script

  • Configuration

#!/bin/bash

i=0
for arg in $*
do
  i=$((i + 1))
  echo file$=$arg
done

if [ $i = 0 ]
then
  echo "No params"
  exit 2
fi
{
   "title": "Arguments output",
   "icon": "fa fa-folder-open fa-fw",
    "args": [
      {
        "name": "File",
        "type": "file"
      }
    ]
}

Custom probe file must be executable and accessible to the saymon user. If it isn’t, the Data table will contain error=13, Permission denied value.