[root@yyjk rex]#curl http://1.1.1.1:9000/check_oracle_service/
{"connectinfo":{"uacdb1":{"dbstatus":"open","AVAILABILITY_STATUS":"green","systag":"4A数据库","dbip":"1.1.120.181"},"esbdb1":{"dbip":"1.1.120.141","AVAILABILITY_STATUS":"green","systag":"ESB数据库","dbstatus":"open"},"uacdb3":{"dbstatus":"died","AVAILABILITY_STATUS":"red","systag":"4A数据库","dbip":"1.1.120.192"},"esbdb2":{"dbip":"1.1.120.142","dbstatus":"open","systag":"ESB数据库","AVAILABILITY_STATUS":"green"},"uacdb2":{"dbip":"1.1.120.182","AVAILABILITY_STATUS":"green","systag":"4A数据库","dbstatus":"open"},"esbdb3":{"dbstatus":"died","systag":"ESB数据库","AVAILABILITY_STATUS":"red","dbip":"1.1.120.150"}},"waitevent":[{"events":"SQL*Net message from client","systag":"ESB数据库","cnt":"113","AVAILABILITY_STATUS":"red","dbip":"1.1.120.141","EVENTTHRESHOLD":"2"},{"AVAILABILITY_STATUS":"red","events":"rdbms ipc message","systag":"ESB数据库","cnt":"35","dbip":"1.1.120.141","EVENTTHRESHOLD":"2"},{"systag":"ESB数据库","events":"gcs remote message","cnt":"5","AVAILABILITY_STATUS":"red","dbip":"1.1.120.141","EVENTTHRESHOLD":"2"},{"AVAILABILITY_STATUS":"red","events":"rdbms ipc message","systag":"ESB数据库","cnt":"35","EVENTTHRESHOLD":"2","dbip":"1.1.120.142"},{"cnt":"6","systag":"ESB数据库","events":"SQL*Net message from client","AVAILABILITY_STATUS":"red","EVENTTHRESHOLD":"2","dbip":"1.1.120.142"},{"events":"gcs remote message","systag":"ESB数据库","cnt":"5","AVAILABILITY_STATUS":"red","EVENTTHRESHOLD":"2","dbip":"1.1.120.142"},{"EVENTTHRESHOLD":"2","dbip":"1.1.120.181","events":"rdbms ipc message","systag":"4A数据库","cnt":"24","AVAILABILITY_STATUS":"red"},{"cnt":"7","systag":"4A数据库","events":"SQL*Net message from client","AVAILABILITY_STATUS":"red","EVENTTHRESHOLD":"2","dbip":"1.1.120.181"},{"cnt":"3","systag":"4A数据库","events":"gcs remote message","AVAILABILITY_STATUS":"red","dbip":"1.1.120.181","EVENTTHRESHOLD":"2"},{"AVAILABILITY_STATUS":"green","cnt":"24","events":"rdbms ipc message","systag":"4A数据库","EVENTTHRESHOLD":"100","dbip":"1.1.120.182"},{"AVAILABILITY_STATUS":"green","cnt":"3","events":"SQL*Net message from client","systag":"4A数据库","EVENTTHRESHOLD":"100","dbip":"1.1.120.182"},{"AVAILABILITY_STATUS":"green","events":"gcs remote message","systag":"4A数据库","cnt":"3","dbip":"1.1.120.182","EVENTTHRESHOLD":"100"}],"sessioninfo":{"uacdb2":{"systag":"4A数据库","AVAILABILITY_STATUS":"green","SESSIONTHRESHOLD":"70","dbip":"1.1.120.182","sessioncount":"43"},"esbdb2":{"SESSIONTHRESHOLD":"70","AVAILABILITY_STATUS":"green","systag":"ESB数据库","dbip":"1.1.120.142","sessioncount":"68"},"esbdb1":{"SESSIONTHRESHOLD":"70","AVAILABILITY_STATUS":"red","systag":"ESB数据库","dbip":"1.1.120.141","sessioncount":"176"},"uacdb1":{"sessioncount":"48","dbip":"1.1.120.181","SESSIONTHRESHOLD":"70","AVAILABILITY_STATUS":"green","systag":"4A数据库"}}}You have mail in /var/spool/mail/root


[root@yyjk ~]#curl http://1.1.1.1:9000/check_oracle_service/
[2018-12-21 15:28:32] INFO - Rexfile is in use by 11975.
You have new mail in /var/spool/mail/root

[root@yyjk ~]#curl http://1.1.1.1:9000/check_oracle_service/
[root@yyjk ~]#

[root@yyjk rex]#cat rex_check_db.sh 
. ~/.bash_profile
cd /root/rex
/usr/local/perl/bin/rex -q check_oracle

[root@yyjk ~]#cd /home/oracle/sbin/
[root@yyjk sbin]#cat check_oracle_json.sh 
. ~/.bash_profile
perl /home/oracle/sbin/check_oracle_json.pl

def check_oracle_service(req):
    #output=commands.getoutput("perl /home/oracle/sbin/check_oracle_json.pl");
   
    output=commands.getoutput("sh /root/rex/rex_check_db.sh");
    return HttpResponse(output, content_type="application/json")