Re: [p4] Monitor P4D with Datadog
Matt Janulewicz <[email protected]>
| Newsgroups | gmane.comp.version-control.perforce |
|---|---|
| Message-ID | <[email protected]> |
Posted on behalf of forum user 'Matt Janulewicz'.
We use Zabbix for monitoring but the idea is probably the same. Here's a
smattering of commands we run on our hosts to produce values that are sent to
the Zabbix server each minute.
The quickest and dirtiest way to get basic info is by parsing the output of
'p4 info'. If the server is not up, no output. And you don't need a
login ticket to run that.
We are in a commit/edge architecture so we collect info about journals and
whatnot this way:
journal_raw_output=`/p4/common/bin/p4master_run 1 /p4/1/bin/p4_1 pull -l -j`
archive_raw_output=`/p4/common/bin/p4master_run 1 /p4/1/bin/p4_1 pull -l -s`
Then parse that output into a bunch of data points:
journal_update=`echo $journal_raw_output | awk -v RS='' '{
print $25,$26 }' | sed 's/\.//' | xargs -n1 -I{} date +%s
-d"{}"`
master_journal_update=`echo $journal_raw_output | awk -v RS=''
'{ print $33,$34 }' | xargs -n1 -I{} date +%s
-d"{}"`
journal_counter=`echo $journal_raw_output | awk '{ print $7 }'
| sed 's/\,$//'`
master_journal_counter=`echo $journal_raw_output | awk '{ print
$16 }' | sed 's/\,$//'`
journal_sequence=`echo $journal_raw_output | awk '{ print $9
}' | sed 's/\.$//'`
master_journal_sequence=`echo $journal_raw_output | awk '{ print
$18 }' | sed 's/\.$//'`
active_archive_transfers=`echo $archive_raw_output | awk '{ print
$3 }'`
queued_archive_transfers=`echo $archive_raw_output | awk '{ print
$4 }' | sed 's/active\///'`
journal_update_delay=$(($master_journal_update-$journal_update))
journal_counter_offset=$(($master_journal_counter-$journal_counter))
journal_sequence_offset=$(($master_journal_sequence-$journal_sequence))
Uptime and p4d version are easily parseable from 'p4 info' output:
uptime=`/p4/common/bin/p4master_run 1 /p4/1/bin/p4_1 info | /bin/grep
'uptime' | /bin/awk '{print $3}'`
version=`/p4/common/bin/p4master_run 1 /p4/1/bin/p4_1 info | /bin/grep
'version' | /bin/awk '{print $3}'`
As well as license info from our commit server:
users=`/p4/common/bin/p4master_run 1 /p4/1/bin/p4_1 users | /usr/bin/wc -l`
licenses=`/p4/common/bin/p4master_run 1 /p4/1/bin/p4_1 info | /bin/grep
'Server license:' | /bin/awk '{print $6}'`
We don't collect any performance stats from Perforce in general, we're
mostly concerned about that journal delay as well as general filesystem
churning, CPU overload, number of p4d processes, stuff like that, but 'p4
-ztag info' might give some interesting stats to track. It's all Greek
to me but maybe there's something useful in there, no idea. :)
--
Please click here to see the post in its original format:
http://forums.perforce.com/index.php?/topic/5439-monitor-p4d-with-datadog
_______________________________________________
perforce-user mailing list - [email protected]
http://maillist.perforce.com/mailman/listinfo/perforce-user