## 8.3.4  Example: Checking the Status on the Primary and Secondary Systems
Learn how to check the status on the primary and secondary systems with landscapeHostConfiguration.py , systemReplicationStatus.py , and getTakeoverRecommendation .
The examples below offer an overview of the outputs for the three scripts with and without "--sapcontrol=1". Use echo $? to receive the return code of the last executed script.
## Primary System
```
m13adm@ld2131:/usr/sap/M13/HDB13/exe/python_support> python systemReplicationStatus.py | Database | Host   | Port  | Service Name | Volume ID | Site ID | Site Name | Secondary | Secondary | Secondary | Secondary | Secondary     | Replication | Replication | Replication    | |          |        |       |              |           |         |           | Host      | Port      | Site ID   | Site Name | Active Status | Mode        | Status      | Status Details | | -------- | ------ | ----- | ------------ | --------- | ------- | --------- | --------- | --------- | --------- | --------- | ------------- | ----------- | ----------- | -------------- | | SYSTEMDB | ld2131 | 31301 | nameserver   |         1 |       1 | SiteA     | ld2132    |     31301 |         2 | SiteB2    | YES           | SYNCMEM     | ACTIVE      |                | | M13      | ld2131 | 31307 | xsengine     |         2 |       1 | SiteA     | ld2132    |     31307 |         2 | SiteB2    | YES           | SYNCMEM     | ACTIVE      |                | | M13      | ld2131 | 31303 | indexserver  |         3 |       1 | SiteA     | ld2132    |     31303 |         2 | SiteB2    | YES           | SYNCMEM     | ACTIVE      |                | status system replication site "2": ACTIVE overall system replication status: ACTIVE Local System Replication State ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mode: PRIMARY site id: 1 site name: SiteA
```
```
================================================================================= ================================================ m13adm@ld2131:/usr/sap/M13/HDB13/exe/python_support> python systemReplicationStatus.py --sapcontrol=1 SAPCONTROL-OK: <begin> service/ld2131/31301/SHIPPED_LOG_POSITION_TIME=2019-01-04 17:49:03.563462 service/ld2131/31301/LAST_LOG_POSITION_TIME=2019-01-04 17:49:03.563462 service/ld2131/31301/SHIPPED_FULL_REPLICA_DURATION=6191118 service/ld2131/31301/SHIPPED_LAST_DELTA_REPLICA_START_TIME=-service/ld2131/31301/SHIPPED_FULL_REPLICA_SIZE=1577443328 service/ld2131/31301/SITE_ID=1 service/ld2131/31301/LAST_LOG_POSITION=79676672 service/ld2131/31301/SECONDARY_ACTIVE_STATUS=YES service/ld2131/31301/LAST_SAVEPOINT_LOG_POSITION=79676418 service/ld2131/31301/FULL_SYNC=DISABLED service/ld2131/31301/OPERATION_MODE=logreplay_readaccess service/ld2131/31301/SHIPPED_LAST_FULL_REPLICA_START_TIME=2018-12-18 16:08:45.743753 service/ld2131/31301/LAST_SAVEPOINT_VERSION=6633 ... service/ld2131/31303/SITE_NAME=SiteA service/ld2131/31303/SECONDARY_SITE_NAME=SiteB2 service/ld2131/31303/REPLAYED_LOG_POSITION_TIME=2019-01-04 17:49:07.122280 service/ld2131/31303/SHIPPED_LAST_FULL_REPLICA_END_TIME=2018-12-18 16:09:07.125423 service/ld2131/31303/CREATION_TIME=2018-12-18 13:37:49.825044 service/ld2131/31303/HOST=ld2131 service/ld2131/31303/SHIPPED_SAVEPOINT_VERSION=71 service/ld2131/31303/SECONDARY_HOST=ld2132 service/ld2131/31303/VOLUME_ID=3 service/ld2131/31303/SHIPPED_LAST_FULL_REPLICA_SIZE=1678131200 service/ld2131/31303/SHIPPED_LOG_BUFFERS_SIZE=11519025152 service/ld2131/31303/REPLICATION_MODE=SYNCMEM service/ld2131/31303/DATABASE=M13 service/ld2131/31303/REPLAYED_LOG_POSITION=264306432 service/ld2131/31303/SECONDARY_RECONNECT_COUNT=1 service/ld2131/31303/SHIPPED_SAVEPOINT_START_TIME=2018-12-18 16:09:00.543785 service/ld2131/31303/SECONDARY_PORT=31303 service/ld2131/31303/SHIPPED_SAVEPOINT_LOG_POSITION=84321794 service/ld2131/31303/REPLICATION_STATUS=ACTIVE service/ld2131/31303/SECONDARY_CONNECT_TIME=2018-12-18 16:09:00.513111 service/ld2131/31303/SHIPPED_LOG_BUFFERS_COUNT=2395097 service/ld2131/31303/SECONDARY_SITE_ID=2 site/2/SITE_NAME=SiteB2 site/2/SOURCE_SITE_ID=1 site/2/REPLICATION_MODE=SYNCMEM site/2/REPLICATION_STATUS=ACTIVE overall_replication_status=ACTIVE site/1/REPLICATION_MODE=PRIMARY site/1/SITE_NAME=SiteA local_site_id=1 SAPCONTROL-OK: <end> ================================================================================= ================================================ m13adm@ld2131:/usr/sap/M13/HDB13/exe/python_support> echo $? 15 ********************************************************************************* ************************************************ ********************************************************************************* ************************************************ m13adm@ld2131:/usr/sap/M13/HDB13/exe/python_support> python landscapeHostConfiguration.py | Host   | Host   | Host   | Failover | Remove | Storage   | Storage   | Failover | Failover | NameServer | NameServer | IndexServer | IndexServer | Host   | Host   | Worker  | Worker  | |        | Active | Status | Status   | Status | Config    | Actual    | Config   | Actual   | Config     | Actual     | Config      | Actual      | Config | Actual | Config  | Actual  |
```
```
|        |        |        |          |        | Partition | Partition | Group    | Group    | Role       | Role       | Role        | Role        | Roles  | Roles  | Groups  | Groups  | | ------ | ------ | ------ | -------- | ------ | --------- | --------- | -------- | -------- | ---------- | ---------- | ----------- | ----------- | ------ | ------ | ------- | ------- | | ld2131 | yes    | ok     |          |        |         1 |         1 | default  | default  | master 1   | master     | worker      | master      | worker | worker | default | default | ================================================================================= ================================================ overall host status: ok m13adm@ld2131:/usr/sap/M13/HDB13/exe/python_support> python landscapeHostConfiguration.py --sapcontrol=1 SAPCONTROL-OK: <begin> hostActualRoles=worker removeStatus= nameServerConfigRole=master 1 failoverStatus= hostConfigRoles=worker failoverActualGroup=default storageConfigPartition=1 host=ld2131 indexServerConfigRole=worker failoverConfigGroup=default storageActualPartition=1 indexServerActualRole=master nameServerActualRole=master hostActive=yes workerActualGroups=default workerConfigGroups=default hostStatus=ok storagePartition=1 SAPCONTROL-OK: <end> ================================================================================= ================================================ m13adm@ld2131:/usr/sap/M13/HDB13/exe/python_support> echo $? 4
```
## Secondary System
```
m13adm@ld2132:/usr/sap/M13/HDB13/exe/python_support> python systemReplicationStatus.py this system is either not running or not the primary system replication site Local System Replication State ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ mode: SYNCMEM site id: 2 site name: SiteB2 active primary site: 1 primary masters: ld2131 ================================================================================= =============================================== m13adm@ld2132:/usr/sap/M13/HDB13/exe/python_support> python systemReplicationStatus.py --sapcontrol=1 SAPCONTROL-OK: <begin> site/2/REPLICATION_MODE=SYNCMEM site/2/SITE_NAME=SiteB2 site/2/SOURCE_SITE_ID=1 site/2/PRIMARY_MASTERS=ld2131 local_site_id=2 SAPCONTROL-OK: <end>
```
<!-- image -->
0