19 lines
701 B
Bash
Executable File
19 lines
701 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# uncomment to test
|
|
#exit 0
|
|
|
|
# this is complex, we use cron to run stuff, but if cron fails, no script gets
|
|
# an update, BUT, as prometheus is just looking at the last state of the file,
|
|
# it would see the last values and think they are 'current'.
|
|
#
|
|
# SO, lets timestamp when we ran this, rather than give a 0 or 1, because if
|
|
# its running this will update the timestamp, if not, it wont anyway :)
|
|
|
|
log_file=/srv/docker/container/node-exporter/textfile_collector/cron.prom
|
|
|
|
echo "# HELP node_cron_is_running Check to tell us when Cron last ran" > $log_file
|
|
echo "# TYPE node_cron_is_running gauge" >> $log_file
|
|
|
|
echo "node_cron_is_running{what=\"last_in_secs\"} `date +%s`" >> $log_file
|