File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -520,6 +520,36 @@ monitor_journals () {
520520 mv " $tmpfname " " $fname "
521521}
522522
523+ monitor_checkpoint_nosdp () {
524+ # Metric for when checkpoint last ran and how long it took.
525+
526+ [[ $UseSDP -eq 1 ]] && return # Not valid if SDP in use
527+
528+ fname=" $metrics_root /p4_checkpoint-${SERVER_ID} .prom"
529+ tmpfname=" $fname .$$ "
530+
531+ rm -f " $tmpfname "
532+ echo " #HELP p4_checkpoint_log_time Time of last checkpoint log" >> " $tmpfname "
533+ echo " #TYPE p4_checkpoint_log_time gauge" >> " $tmpfname "
534+
535+ # Look for latest checkpoint log which has Start/End (avoids run in progress and rotate_journal logs)
536+ ckp_md5=` find -L ${P4ROOT} -maxdepth 1 -type f -name ' checkpoint.*.md5' -exec ls -t {} + | head -n1`
537+ ckp_log=` echo $ckp_md5 | sed ' s/\.md5$//' `
538+
539+ ckp_starttime=` stat -c " %W" " $ckp_log " `
540+ ckp_endtime=` stat -c " %Y" " $ckp_log " `
541+ ckp_duration=$(( $ckp_endtime - $ckp_starttime ))
542+
543+ echo " p4_checkpoint_log_time{${serverid_label} } $ckp_starttime " >> " $tmpfname "
544+
545+ echo " #HELP p4_checkpoint_duration Time taken for last checkpoint/restore action" >> " $tmpfname "
546+ echo " #TYPE p4_checkpoint_duration gauge" >> " $tmpfname "
547+ echo " p4_checkpoint_duration{${serverid_label} } $ckp_duration " >> " $tmpfname "
548+
549+ chmod 644 " $tmpfname "
550+ mv " $tmpfname " " $fname "
551+ }
552+
523553monitor_replicas () {
524554 # Metric for server replicas
525555 fname=" $metrics_root /p4_replication${sdpinst_suffix} -${SERVER_ID} .prom"
@@ -848,4 +878,5 @@ monitor_versions
848878monitor_ssl
849879monitor_checkpoint
850880monitor_journals
881+ monitor_checkpoint_nosdp
851882monitor_errors
You can’t perform that action at this time.
0 commit comments