The User Scripts Collector runs external scripts and collects their output for you to view in CloudWisdom.
/opt/netuitive-agent/conf/collectors
.True
./opt/netuitive-agent/
).For the collector to work properly, your monitored scripts must be executable and should output metrics in the form of:
metric.path.a value
metric.path.b value
metric.path.c value
Value
can be a static integer or the value stored in a variable;only numerical values are valid.
This example checks for total running processes and total running threads every 60 seconds.
#!/bin/sh
PROCTOTAL=`ps -A --no-headers | wc -l`
PROCTHREADS=`ps -AL --no-headers | wc -l`
echo processes.total_processes.count.value $PROCTOTAL
echo processes.total_threads.count.value $PROCTHREADS
This example acknowledges a log every 60 seconds and count how many times a string shows in a log. This script is used to count log occurrences and converts that number into a metric.
#!/bin/sh
CHECKCOUNT=(awk -v d1="$(date --date="-1 min" "+%b %_d %H:%M")" -v d2="$(date "+%b %_d %H:%M")" '$0 > d1 && $0 < d2 || $0 ~ d2' /var/log/secure
| grep -ci "POSSIBLE BREAK-IN ATTEMPT")
echo possible_sudo_hacks.count.value $CHECKCOUNT
Option | Default | Description |
---|---|---|
enabled | False | Enable collecting User Scripts metrics. |
scripts_path | /opt/netuitive-agent/user-scripts | Path used to find scripts to run |
byte_unit | Default numeric output(s). | |
measure_collector_time | Measure the collector’s run time in milliseconds. | |
metrics_blacklist | Regex list to match metrics to block. Mutually exclusive with metrics_whitelist option. | |
metrics_whitelist | Regex list to match metrics to transmit. Mutually exclusive with metrics_blacklistoption. |