正在显示
10 个修改的文件
包含
157 行增加
和
97 行删除
| @@ -241,6 +241,7 @@ Supported operating systems and hardware: | @@ -241,6 +241,7 @@ Supported operating systems and hardware: | ||
| 241 | * 2013-10-17, Created.<br/> | 241 | * 2013-10-17, Created.<br/> |
| 242 | 242 | ||
| 243 | ## History | 243 | ## History |
| 244 | +* v1.0, 2014-06-23, support report summaries in heartbeat. 0.9.132 | ||
| 244 | * v1.0, 2014-06-22, performance refine, support [3k+](https://github.com/winlinvip/simple-rtmp-server/wiki/Performance#%E6%80%A7%E8%83%BD%E4%BE%8B%E8%A1%8C%E6%8A%A5%E5%91%8A4k) connections(270kbps). 0.9.130 | 245 | * v1.0, 2014-06-22, performance refine, support [3k+](https://github.com/winlinvip/simple-rtmp-server/wiki/Performance#%E6%80%A7%E8%83%BD%E4%BE%8B%E8%A1%8C%E6%8A%A5%E5%91%8A4k) connections(270kbps). 0.9.130 |
| 245 | * v1.0, 2014-06-21, support edge [token traverse](https://github.com/winlinvip/simple-rtmp-server/wiki/DRM#tokentraverse), fix [#104](https://github.com/winlinvip/simple-rtmp-server/issues/104). 0.9.129 | 246 | * v1.0, 2014-06-21, support edge [token traverse](https://github.com/winlinvip/simple-rtmp-server/wiki/DRM#tokentraverse), fix [#104](https://github.com/winlinvip/simple-rtmp-server/issues/104). 0.9.129 |
| 246 | * v1.0, 2014-06-19, add connections count to api summaries. 0.9.127 | 247 | * v1.0, 2014-06-19, add connections count to api summaries. 0.9.127 |
| @@ -61,6 +61,17 @@ heartbeat { | @@ -61,6 +61,17 @@ heartbeat { | ||
| 61 | url http://127.0.0.1:8085/api/v1/servers; | 61 | url http://127.0.0.1:8085/api/v1/servers; |
| 62 | # the id of devide. | 62 | # the id of devide. |
| 63 | device_id "my-srs-device"; | 63 | device_id "my-srs-device"; |
| 64 | + # the index of device ip. | ||
| 65 | + # we may retrieve more than one network device. | ||
| 66 | + # default: 0 | ||
| 67 | + device_index 0; | ||
| 68 | + # whether report with summaries | ||
| 69 | + # if true, put /api/v1/summaries to the request data: | ||
| 70 | + # { | ||
| 71 | + # "summaries": summaries object. | ||
| 72 | + # } | ||
| 73 | + # default: off | ||
| 74 | + summaries off; | ||
| 64 | } | 75 | } |
| 65 | 76 | ||
| 66 | ############################################################################################# | 77 | ############################################################################################# |
| @@ -2869,6 +2869,38 @@ string SrsConfig::get_heartbeat_device_id() | @@ -2869,6 +2869,38 @@ string SrsConfig::get_heartbeat_device_id() | ||
| 2869 | return conf->arg0(); | 2869 | return conf->arg0(); |
| 2870 | } | 2870 | } |
| 2871 | 2871 | ||
| 2872 | +int SrsConfig::get_heartbeat_device_index() | ||
| 2873 | +{ | ||
| 2874 | + SrsConfDirective* conf = get_heartbeart(); | ||
| 2875 | + | ||
| 2876 | + if (!conf) { | ||
| 2877 | + return SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX; | ||
| 2878 | + } | ||
| 2879 | + | ||
| 2880 | + conf = conf->get("device_index"); | ||
| 2881 | + if (!conf || conf->arg0().empty()) { | ||
| 2882 | + return SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX; | ||
| 2883 | + } | ||
| 2884 | + | ||
| 2885 | + return ::atoi(conf->arg0().c_str()); | ||
| 2886 | +} | ||
| 2887 | + | ||
| 2888 | +bool SrsConfig::get_heartbeat_summaries() | ||
| 2889 | +{ | ||
| 2890 | + SrsConfDirective* conf = get_heartbeart(); | ||
| 2891 | + | ||
| 2892 | + if (!conf) { | ||
| 2893 | + return SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES; | ||
| 2894 | + } | ||
| 2895 | + | ||
| 2896 | + conf = conf->get("summaries"); | ||
| 2897 | + if (!conf || conf->arg0() != "on") { | ||
| 2898 | + return SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES; | ||
| 2899 | + } | ||
| 2900 | + | ||
| 2901 | + return true; | ||
| 2902 | +} | ||
| 2903 | + | ||
| 2872 | bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b) | 2904 | bool srs_directive_equals(SrsConfDirective* a, SrsConfDirective* b) |
| 2873 | { | 2905 | { |
| 2874 | // both NULL, equal. | 2906 | // both NULL, equal. |
| @@ -71,6 +71,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -71,6 +71,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 71 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED false | 71 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_ENABLED false |
| 72 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL 9.9 | 72 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INTERVAL 9.9 |
| 73 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL "http://127.0.0.1:8085/api/v1/servers" | 73 | #define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_URL "http://127.0.0.1:8085/api/v1/servers" |
| 74 | +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_INDEX 0 | ||
| 75 | +#define SRS_CONF_DEFAULT_HTTP_HEAETBEAT_SUMMARIES false | ||
| 74 | 76 | ||
| 75 | #define SRS_STAGE_PLAY_USER_INTERVAL_MS 10000 | 77 | #define SRS_STAGE_PLAY_USER_INTERVAL_MS 10000 |
| 76 | #define SRS_STAGE_PUBLISH_USER_INTERVAL_MS 10000 | 78 | #define SRS_STAGE_PUBLISH_USER_INTERVAL_MS 10000 |
| @@ -297,6 +299,8 @@ public: | @@ -297,6 +299,8 @@ public: | ||
| 297 | virtual int64_t get_heartbeat_interval(); | 299 | virtual int64_t get_heartbeat_interval(); |
| 298 | virtual std::string get_heartbeat_url(); | 300 | virtual std::string get_heartbeat_url(); |
| 299 | virtual std::string get_heartbeat_device_id(); | 301 | virtual std::string get_heartbeat_device_id(); |
| 302 | + virtual int get_heartbeat_device_index(); | ||
| 303 | + virtual bool get_heartbeat_summaries(); | ||
| 300 | }; | 304 | }; |
| 301 | 305 | ||
| 302 | /** | 306 | /** |
| @@ -61,26 +61,30 @@ void SrsHttpHeartbeat::heartbeat() | @@ -61,26 +61,30 @@ void SrsHttpHeartbeat::heartbeat() | ||
| 61 | 61 | ||
| 62 | vector<string>& ips = srs_get_local_ipv4_ips(); | 62 | vector<string>& ips = srs_get_local_ipv4_ips(); |
| 63 | if (!ips.empty()) { | 63 | if (!ips.empty()) { |
| 64 | - ip = ips[0]; // TODO: FIXME: maybe need to config it. | 64 | + ip = ips[_srs_config->get_heartbeat_device_index() % (int)ips.size()]; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | std::stringstream ss; | 67 | std::stringstream ss; |
| 68 | ss << JOBJECT_START | 68 | ss << JOBJECT_START |
| 69 | << JFIELD_STR("device_id", device_id) << JFIELD_CONT | 69 | << JFIELD_STR("device_id", device_id) << JFIELD_CONT |
| 70 | - << JFIELD_STR("ip", ip) | ||
| 71 | - << JOBJECT_END; | 70 | + << JFIELD_STR("ip", ip); |
| 71 | + if (_srs_config->get_heartbeat_summaries()) { | ||
| 72 | + ss << JFIELD_CONT << JFIELD_ORG("summaries", ""); | ||
| 73 | + srs_api_dump_summaries(ss); | ||
| 74 | + } | ||
| 75 | + ss << JOBJECT_END; | ||
| 72 | std::string data = ss.str(); | 76 | std::string data = ss.str(); |
| 73 | std::string res; | 77 | std::string res; |
| 74 | 78 | ||
| 75 | SrsHttpClient http; | 79 | SrsHttpClient http; |
| 76 | if ((ret = http.post(&uri, data, res)) != ERROR_SUCCESS) { | 80 | if ((ret = http.post(&uri, data, res)) != ERROR_SUCCESS) { |
| 77 | - srs_error("http post hartbeart uri failed. " | 81 | + srs_info("http post hartbeart uri failed. " |
| 78 | "url=%s, request=%s, response=%s, ret=%d", | 82 | "url=%s, request=%s, response=%s, ret=%d", |
| 79 | url.c_str(), data.c_str(), res.c_str(), ret); | 83 | url.c_str(), data.c_str(), res.c_str(), ret); |
| 80 | return; | 84 | return; |
| 81 | } | 85 | } |
| 82 | 86 | ||
| 83 | - srs_trace("http hook hartbeart success. " | 87 | + srs_info("http hook hartbeart success. " |
| 84 | "url=%s, request=%s, response=%s, ret=%d", | 88 | "url=%s, request=%s, response=%s, ret=%d", |
| 85 | url.c_str(), data.c_str(), res.c_str(), ret); | 89 | url.c_str(), data.c_str(), res.c_str(), ret); |
| 86 | 90 |
| @@ -382,96 +382,7 @@ bool SrsApiSummaries::can_handle(const char* path, int length, const char** /*pc | @@ -382,96 +382,7 @@ bool SrsApiSummaries::can_handle(const char* path, int length, const char** /*pc | ||
| 382 | int SrsApiSummaries::do_process_request(SrsSocket* skt, SrsHttpMessage* req) | 382 | int SrsApiSummaries::do_process_request(SrsSocket* skt, SrsHttpMessage* req) |
| 383 | { | 383 | { |
| 384 | std::stringstream ss; | 384 | std::stringstream ss; |
| 385 | - | ||
| 386 | - SrsRusage* r = srs_get_system_rusage(); | ||
| 387 | - SrsProcSelfStat* u = srs_get_self_proc_stat(); | ||
| 388 | - SrsProcSystemStat* s = srs_get_system_proc_stat(); | ||
| 389 | - SrsCpuInfo* c = srs_get_cpuinfo(); | ||
| 390 | - SrsMemInfo* m = srs_get_meminfo(); | ||
| 391 | - SrsPlatformInfo* p = srs_get_platform_info(); | ||
| 392 | - SrsNetworkDevices* n = srs_get_network_devices(); | ||
| 393 | - SrsNetworkRtmpServer* nrs = srs_get_network_rtmp_server(); | ||
| 394 | - | ||
| 395 | - float self_mem_percent = 0; | ||
| 396 | - if (m->MemTotal > 0) { | ||
| 397 | - self_mem_percent = (float)(r->r.ru_maxrss / (double)m->MemTotal); | ||
| 398 | - } | ||
| 399 | - | ||
| 400 | - int64_t now = srs_get_system_time_ms(); | ||
| 401 | - double srs_uptime = (now - p->srs_startup_time) / 100 / 10.0; | ||
| 402 | - | ||
| 403 | - bool n_ok = false; | ||
| 404 | - int64_t n_sample_time = 0; | ||
| 405 | - int64_t nr_bytes = 0; | ||
| 406 | - int64_t ns_bytes = 0; | ||
| 407 | - int nb_n = srs_get_network_devices_count(); | ||
| 408 | - for (int i = 0; i < nb_n; i++) { | ||
| 409 | - SrsNetworkDevices& o = n[i]; | ||
| 410 | - | ||
| 411 | - // ignore the lo interface. | ||
| 412 | - std::string inter = o.name; | ||
| 413 | - if (!o.ok || inter == "lo") { | ||
| 414 | - continue; | ||
| 415 | - } | ||
| 416 | - | ||
| 417 | - n_ok = true; | ||
| 418 | - nr_bytes += o.rbytes; | ||
| 419 | - ns_bytes += o.sbytes; | ||
| 420 | - n_sample_time = o.sample_time; | ||
| 421 | - } | ||
| 422 | - | ||
| 423 | - ss << JOBJECT_START | ||
| 424 | - << JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT | ||
| 425 | - << JFIELD_ORG("data", JOBJECT_START) | ||
| 426 | - << JFIELD_ORG("rusage_ok", (r->ok? "true":"false")) << JFIELD_CONT | ||
| 427 | - << JFIELD_ORG("self_cpu_stat_ok", (u->ok? "true":"false")) << JFIELD_CONT | ||
| 428 | - << JFIELD_ORG("system_cpu_stat_ok", (s->ok? "true":"false")) << JFIELD_CONT | ||
| 429 | - << JFIELD_ORG("cpuinfo_ok", (c->ok? "true":"false")) << JFIELD_CONT | ||
| 430 | - << JFIELD_ORG("meminfo_ok", (m->ok? "true":"false")) << JFIELD_CONT | ||
| 431 | - << JFIELD_ORG("platform_ok", (p->ok? "true":"false")) << JFIELD_CONT | ||
| 432 | - << JFIELD_ORG("network_ok", (n_ok? "true":"false")) << JFIELD_CONT | ||
| 433 | - << JFIELD_ORG("network_srs_ok", (nrs->ok? "true":"false")) << JFIELD_CONT | ||
| 434 | - << JFIELD_ORG("now_ms", now) << JFIELD_CONT | ||
| 435 | - << JFIELD_ORG("self", JOBJECT_START) | ||
| 436 | - << JFIELD_ORG("pid", getpid()) << JFIELD_CONT | ||
| 437 | - << JFIELD_ORG("ppid", u->ppid) << JFIELD_CONT | ||
| 438 | - << JFIELD_STR("argv", _srs_config->argv()) << JFIELD_CONT | ||
| 439 | - << JFIELD_STR("cwd", _srs_config->cwd()) << JFIELD_CONT | ||
| 440 | - << JFIELD_ORG("mem_kbyte", r->r.ru_maxrss) << JFIELD_CONT | ||
| 441 | - << JFIELD_ORG("mem_percent", self_mem_percent) << JFIELD_CONT | ||
| 442 | - << JFIELD_ORG("cpu_percent", u->percent) << JFIELD_CONT | ||
| 443 | - << JFIELD_ORG("srs_uptime", srs_uptime) | ||
| 444 | - << JOBJECT_END << JFIELD_CONT | ||
| 445 | - << JFIELD_ORG("system", JOBJECT_START) | ||
| 446 | - << JFIELD_ORG("cpu_percent", s->percent) << JFIELD_CONT | ||
| 447 | - << JFIELD_ORG("mem_ram_kbyte", m->MemTotal) << JFIELD_CONT | ||
| 448 | - << JFIELD_ORG("mem_ram_percent", m->percent_ram) << JFIELD_CONT | ||
| 449 | - << JFIELD_ORG("mem_swap_kbyte", m->SwapTotal) << JFIELD_CONT | ||
| 450 | - << JFIELD_ORG("mem_swap_percent", m->percent_swap) << JFIELD_CONT | ||
| 451 | - << JFIELD_ORG("cpus", c->nb_processors) << JFIELD_CONT | ||
| 452 | - << JFIELD_ORG("cpus_online", c->nb_processors_online) << JFIELD_CONT | ||
| 453 | - << JFIELD_ORG("uptime", p->os_uptime) << JFIELD_CONT | ||
| 454 | - << JFIELD_ORG("ilde_time", p->os_ilde_time) << JFIELD_CONT | ||
| 455 | - << JFIELD_ORG("load_1m", p->load_one_minutes) << JFIELD_CONT | ||
| 456 | - << JFIELD_ORG("load_5m", p->load_five_minutes) << JFIELD_CONT | ||
| 457 | - << JFIELD_ORG("load_15m", p->load_fifteen_minutes) << JFIELD_CONT | ||
| 458 | - << JFIELD_ORG("net_sample_time", n_sample_time) << JFIELD_CONT | ||
| 459 | - << JFIELD_ORG("net_recv_bytes", nr_bytes) << JFIELD_CONT | ||
| 460 | - << JFIELD_ORG("net_send_bytes", ns_bytes) << JFIELD_CONT | ||
| 461 | - << JFIELD_ORG("srs_sample_time", nrs->sample_time) << JFIELD_CONT | ||
| 462 | - << JFIELD_ORG("srs_recv_bytes", nrs->rbytes) << JFIELD_CONT | ||
| 463 | - << JFIELD_ORG("srs_recv_kbps", nrs->rkbps) << JFIELD_CONT | ||
| 464 | - << JFIELD_ORG("srs_send_bytes", nrs->sbytes) << JFIELD_CONT | ||
| 465 | - << JFIELD_ORG("srs_send_kbps", nrs->skbps) << JFIELD_CONT | ||
| 466 | - << JFIELD_ORG("conn_sys", nrs->nb_conn_sys) << JFIELD_CONT | ||
| 467 | - << JFIELD_ORG("conn_sys_et", nrs->nb_conn_sys_et) << JFIELD_CONT | ||
| 468 | - << JFIELD_ORG("conn_sys_tw", nrs->nb_conn_sys_tw) << JFIELD_CONT | ||
| 469 | - << JFIELD_ORG("conn_sys_ls", nrs->nb_conn_sys_ls) << JFIELD_CONT | ||
| 470 | - << JFIELD_ORG("conn_srs", nrs->nb_conn_srs) | ||
| 471 | - << JOBJECT_END | ||
| 472 | - << JOBJECT_END | ||
| 473 | - << JOBJECT_END; | ||
| 474 | - | 385 | + srs_api_dump_summaries(ss); |
| 475 | return res_json(skt, req, ss.str()); | 386 | return res_json(skt, req, ss.str()); |
| 476 | } | 387 | } |
| 477 | 388 |
| @@ -64,7 +64,7 @@ int SrsHttpClient::post(SrsHttpUri* uri, string req, string& res) | @@ -64,7 +64,7 @@ int SrsHttpClient::post(SrsHttpUri* uri, string req, string& res) | ||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | if ((ret = connect(uri)) != ERROR_SUCCESS) { | 66 | if ((ret = connect(uri)) != ERROR_SUCCESS) { |
| 67 | - srs_error("http connect server failed. ret=%d", ret); | 67 | + srs_warn("http connect server failed. ret=%d", ret); |
| 68 | return ret; | 68 | return ret; |
| 69 | } | 69 | } |
| 70 | 70 |
| @@ -35,6 +35,7 @@ using namespace std; | @@ -35,6 +35,7 @@ using namespace std; | ||
| 35 | #include <srs_kernel_utility.hpp> | 35 | #include <srs_kernel_utility.hpp> |
| 36 | #include <srs_kernel_error.hpp> | 36 | #include <srs_kernel_error.hpp> |
| 37 | #include <srs_app_kbps.hpp> | 37 | #include <srs_app_kbps.hpp> |
| 38 | +#include <srs_app_json.hpp> | ||
| 38 | 39 | ||
| 39 | #define SRS_LOCAL_LOOP_IP "127.0.0.1" | 40 | #define SRS_LOCAL_LOOP_IP "127.0.0.1" |
| 40 | 41 | ||
| @@ -731,3 +732,96 @@ string srs_get_peer_ip(int fd) | @@ -731,3 +732,96 @@ string srs_get_peer_ip(int fd) | ||
| 731 | 732 | ||
| 732 | return ip; | 733 | return ip; |
| 733 | } | 734 | } |
| 735 | + | ||
| 736 | +void srs_api_dump_summaries(std::stringstream& ss) | ||
| 737 | +{ | ||
| 738 | + SrsRusage* r = srs_get_system_rusage(); | ||
| 739 | + SrsProcSelfStat* u = srs_get_self_proc_stat(); | ||
| 740 | + SrsProcSystemStat* s = srs_get_system_proc_stat(); | ||
| 741 | + SrsCpuInfo* c = srs_get_cpuinfo(); | ||
| 742 | + SrsMemInfo* m = srs_get_meminfo(); | ||
| 743 | + SrsPlatformInfo* p = srs_get_platform_info(); | ||
| 744 | + SrsNetworkDevices* n = srs_get_network_devices(); | ||
| 745 | + SrsNetworkRtmpServer* nrs = srs_get_network_rtmp_server(); | ||
| 746 | + | ||
| 747 | + float self_mem_percent = 0; | ||
| 748 | + if (m->MemTotal > 0) { | ||
| 749 | + self_mem_percent = (float)(r->r.ru_maxrss / (double)m->MemTotal); | ||
| 750 | + } | ||
| 751 | + | ||
| 752 | + int64_t now = srs_get_system_time_ms(); | ||
| 753 | + double srs_uptime = (now - p->srs_startup_time) / 100 / 10.0; | ||
| 754 | + | ||
| 755 | + bool n_ok = false; | ||
| 756 | + int64_t n_sample_time = 0; | ||
| 757 | + int64_t nr_bytes = 0; | ||
| 758 | + int64_t ns_bytes = 0; | ||
| 759 | + int nb_n = srs_get_network_devices_count(); | ||
| 760 | + for (int i = 0; i < nb_n; i++) { | ||
| 761 | + SrsNetworkDevices& o = n[i]; | ||
| 762 | + | ||
| 763 | + // ignore the lo interface. | ||
| 764 | + std::string inter = o.name; | ||
| 765 | + if (!o.ok || inter == "lo") { | ||
| 766 | + continue; | ||
| 767 | + } | ||
| 768 | + | ||
| 769 | + n_ok = true; | ||
| 770 | + nr_bytes += o.rbytes; | ||
| 771 | + ns_bytes += o.sbytes; | ||
| 772 | + n_sample_time = o.sample_time; | ||
| 773 | + } | ||
| 774 | + | ||
| 775 | + ss << JOBJECT_START | ||
| 776 | + << JFIELD_ERROR(ERROR_SUCCESS) << JFIELD_CONT | ||
| 777 | + << JFIELD_ORG("data", JOBJECT_START) | ||
| 778 | + << JFIELD_ORG("rusage_ok", (r->ok? "true":"false")) << JFIELD_CONT | ||
| 779 | + << JFIELD_ORG("self_cpu_stat_ok", (u->ok? "true":"false")) << JFIELD_CONT | ||
| 780 | + << JFIELD_ORG("system_cpu_stat_ok", (s->ok? "true":"false")) << JFIELD_CONT | ||
| 781 | + << JFIELD_ORG("cpuinfo_ok", (c->ok? "true":"false")) << JFIELD_CONT | ||
| 782 | + << JFIELD_ORG("meminfo_ok", (m->ok? "true":"false")) << JFIELD_CONT | ||
| 783 | + << JFIELD_ORG("platform_ok", (p->ok? "true":"false")) << JFIELD_CONT | ||
| 784 | + << JFIELD_ORG("network_ok", (n_ok? "true":"false")) << JFIELD_CONT | ||
| 785 | + << JFIELD_ORG("network_srs_ok", (nrs->ok? "true":"false")) << JFIELD_CONT | ||
| 786 | + << JFIELD_ORG("now_ms", now) << JFIELD_CONT | ||
| 787 | + << JFIELD_ORG("self", JOBJECT_START) | ||
| 788 | + << JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << JFIELD_CONT | ||
| 789 | + << JFIELD_ORG("pid", getpid()) << JFIELD_CONT | ||
| 790 | + << JFIELD_ORG("ppid", u->ppid) << JFIELD_CONT | ||
| 791 | + << JFIELD_STR("argv", _srs_config->argv()) << JFIELD_CONT | ||
| 792 | + << JFIELD_STR("cwd", _srs_config->cwd()) << JFIELD_CONT | ||
| 793 | + << JFIELD_ORG("mem_kbyte", r->r.ru_maxrss) << JFIELD_CONT | ||
| 794 | + << JFIELD_ORG("mem_percent", self_mem_percent) << JFIELD_CONT | ||
| 795 | + << JFIELD_ORG("cpu_percent", u->percent) << JFIELD_CONT | ||
| 796 | + << JFIELD_ORG("srs_uptime", srs_uptime) | ||
| 797 | + << JOBJECT_END << JFIELD_CONT | ||
| 798 | + << JFIELD_ORG("system", JOBJECT_START) | ||
| 799 | + << JFIELD_ORG("cpu_percent", s->percent) << JFIELD_CONT | ||
| 800 | + << JFIELD_ORG("mem_ram_kbyte", m->MemTotal) << JFIELD_CONT | ||
| 801 | + << JFIELD_ORG("mem_ram_percent", m->percent_ram) << JFIELD_CONT | ||
| 802 | + << JFIELD_ORG("mem_swap_kbyte", m->SwapTotal) << JFIELD_CONT | ||
| 803 | + << JFIELD_ORG("mem_swap_percent", m->percent_swap) << JFIELD_CONT | ||
| 804 | + << JFIELD_ORG("cpus", c->nb_processors) << JFIELD_CONT | ||
| 805 | + << JFIELD_ORG("cpus_online", c->nb_processors_online) << JFIELD_CONT | ||
| 806 | + << JFIELD_ORG("uptime", p->os_uptime) << JFIELD_CONT | ||
| 807 | + << JFIELD_ORG("ilde_time", p->os_ilde_time) << JFIELD_CONT | ||
| 808 | + << JFIELD_ORG("load_1m", p->load_one_minutes) << JFIELD_CONT | ||
| 809 | + << JFIELD_ORG("load_5m", p->load_five_minutes) << JFIELD_CONT | ||
| 810 | + << JFIELD_ORG("load_15m", p->load_fifteen_minutes) << JFIELD_CONT | ||
| 811 | + << JFIELD_ORG("net_sample_time", n_sample_time) << JFIELD_CONT | ||
| 812 | + << JFIELD_ORG("net_recv_bytes", nr_bytes) << JFIELD_CONT | ||
| 813 | + << JFIELD_ORG("net_send_bytes", ns_bytes) << JFIELD_CONT | ||
| 814 | + << JFIELD_ORG("srs_sample_time", nrs->sample_time) << JFIELD_CONT | ||
| 815 | + << JFIELD_ORG("srs_recv_bytes", nrs->rbytes) << JFIELD_CONT | ||
| 816 | + << JFIELD_ORG("srs_recv_kbps", nrs->rkbps) << JFIELD_CONT | ||
| 817 | + << JFIELD_ORG("srs_send_bytes", nrs->sbytes) << JFIELD_CONT | ||
| 818 | + << JFIELD_ORG("srs_send_kbps", nrs->skbps) << JFIELD_CONT | ||
| 819 | + << JFIELD_ORG("conn_sys", nrs->nb_conn_sys) << JFIELD_CONT | ||
| 820 | + << JFIELD_ORG("conn_sys_et", nrs->nb_conn_sys_et) << JFIELD_CONT | ||
| 821 | + << JFIELD_ORG("conn_sys_tw", nrs->nb_conn_sys_tw) << JFIELD_CONT | ||
| 822 | + << JFIELD_ORG("conn_sys_ls", nrs->nb_conn_sys_ls) << JFIELD_CONT | ||
| 823 | + << JFIELD_ORG("conn_srs", nrs->nb_conn_srs) | ||
| 824 | + << JOBJECT_END | ||
| 825 | + << JOBJECT_END | ||
| 826 | + << JOBJECT_END; | ||
| 827 | +} |
| @@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -32,6 +32,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 32 | 32 | ||
| 33 | #include <vector> | 33 | #include <vector> |
| 34 | #include <string> | 34 | #include <string> |
| 35 | +#include <sstream> | ||
| 35 | 36 | ||
| 36 | #include <sys/resource.h> | 37 | #include <sys/resource.h> |
| 37 | 38 | ||
| @@ -439,4 +440,6 @@ std::string srs_get_local_ip(int fd); | @@ -439,4 +440,6 @@ std::string srs_get_local_ip(int fd); | ||
| 439 | // where peer ip is the client public ip which connected to server. | 440 | // where peer ip is the client public ip which connected to server. |
| 440 | std::string srs_get_peer_ip(int fd); | 441 | std::string srs_get_peer_ip(int fd); |
| 441 | 442 | ||
| 443 | +void srs_api_dump_summaries(std::stringstream& ss); | ||
| 444 | + | ||
| 442 | #endif | 445 | #endif |
| @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
| 31 | // current release version | 31 | // current release version |
| 32 | #define VERSION_MAJOR "0" | 32 | #define VERSION_MAJOR "0" |
| 33 | #define VERSION_MINOR "9" | 33 | #define VERSION_MINOR "9" |
| 34 | -#define VERSION_REVISION "131" | 34 | +#define VERSION_REVISION "132" |
| 35 | #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION | 35 | #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION |
| 36 | // server info. | 36 | // server info. |
| 37 | #define RTMP_SIG_SRS_KEY "SRS" | 37 | #define RTMP_SIG_SRS_KEY "SRS" |
-
请 注册 或 登录 后发表评论