Skip to content

Commit

Permalink
return scimmonitor results as json
Browse files Browse the repository at this point in the history
  • Loading branch information
baszoetekouw committed Aug 14, 2024
1 parent d644466 commit be77f47
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion roles/scim_monitor/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,5 @@
dest: "/etc/zabbix/zabbix_agent2.d/{{item}}"
mode: "0644"
with_items:
- sram-scimmonitor.conf
- "sram-scimmonitor.conf"
notify: "restart zabbix-agent"
5 changes: 3 additions & 2 deletions roles/scim_monitor/templates/scimmonitor.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ DIFF=$(
)

# output to status file
date '+%s' > $STATUSFILE
echo -n "$DIFF" | wc -l >> $STATUSFILE
NOW=$(date '+%s')
DIFFNR=$(echo "$DIFF"| wc -l)
echo '{"time":'$NOW',"diff":'$DIFFNR'}' > $STATUSFILE
echo -n "$DIFF" >> $STATUSFILE

if [ -z "$DIFF" ]
Expand Down
7 changes: 3 additions & 4 deletions roles/scim_monitor/templates/sram-scimmonitor.conf.j2
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# two parameters:
# first is env name (tst, acc, prd) corresponding to statsu file
# second is line in file to request (1==timestamp, 2==diff lines)
UserParameter=sram.scimmonitor[*],cat {{scim_monitor_status_dir}}/status-$1 | head -n $2 | tail -n 1
# parameter is env name (tst, acc, prd) corresponding to status file
# returns json with data from status file
UserParameter=sram.scimmonitor[*],cat {{scim_monitor_status_dir}}/status-$1 | head -n 1

0 comments on commit be77f47

Please sign in to comment.