HOWTO retrieve replication_state

Version 1
    This document was generated from CDN thread

    Created by: Chester Rieman on 09-05-2011 06:49:54 AM
    IT took s bit of hammring at it but I finally got this.
    You need to send this XML:

    <?xml version="1.0" encoding="utf-8" ?>
    <soapenv:Envelope xmlns:soapenv=""
                            <Host xsi:type="xsd:string">x.x.x.x</Host>
                            <Object xsi:type="nslbjectNameType">Number of Replicates Created and State of Replication</Object>

    I use curl to send this to CUCM - seems to be the simplest way from a *nix machine.
    curl -s -k -u username:password -H 'Content-type: text/xml;' -H 'SOAPAction: "CUCMB ver=6.0"' -d @filename.xml https://x.x.x.x:/perfmonservice/services/PerfmonPort > resultfile.txt
    So here we are pulling system perfmon object for "Number of Replicates Created and State of Replication" by querying perfmonservice/services/PerfmonPort
    once run you can take resultfile.txt and extract the replicate_state value:
    awk -F '>'  '/Replicate_State/ { print "Replicate_State of SERVERNAME  " $18> "outfile.txt"}' resultfile.txt
    resultfile.txt contains the xml response from cucm
    outfile.txt will look like:
    Replicate_State of SERVERNAME  2
    You can string these together to create an output file with replication state for each server in the cluster and make the whole thing a cron job - I use CLI mutt to send myself a daily email with replication state for the cluster.
    You can use similar methods for any system or CUCM perfmon objects.