Re: [p4] Monitor P4D with Datadog

P4Reg <[email protected]>
Newsgroups gmane.comp.version-control.perforce
Message-ID <[email protected]>
Posted on behalf of forum user 'P4Reg'.

Just adding a couple of extra comments here about parsing output (it won't
add anything extra to what Matt said, but can make for shorter code)

The -F formatting option that p4 has can streamline a command and often removes
the need to parse the standard output of p4 commands using sed/awk etc.

..So
uptime=`/p4/common/bin/p4master_run 1 /p4/1/bin/p4_1 info | /bin/grep
'uptime' | /bin/awk '{print $3}'

..shortens to:
uptime=`p4 -ztag -F %serverUptime% info`

..and
version=`/p4/common/bin/p4master_run 1 /p4/1/bin/p4_1 info | /bin/grep
'version' | /bin/awk '{print $3}'`

..shortens to 

p4 -ztag -F %serverVersion% info

You can read more about the -F option in    
https://www.perforce.com/blog/130826/fun-formatting  and in this Knowledge Base
article  Formatting p4 command output using the -F global option with examples
[http://answers.perforce.com/articles/KB/15148/?q=Formatting+p4+command+output+using+the+-F+global+option+with+examples&l=en_US&fs=Search&pn=1]

Equally useful for simplified on the fly replacement of fields in forms is the
--field client side option (rather than the more traditional " p4 user -o |
sed "s/some item on the form/to something else/" | p4 user -i  ) :

     https://www.perforce.com/blog/160428/20161-command-line-roundup



--
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.