Skip to content
官方QQ交流群
技术交流1:87208295   点此加入
技术交流2:787747122   点此加入
官网
云控制台
开放平台
关注微信公众号
代码仓库: 码云

RPC监控统计

简要

  • 统计服务端使用

统计模块, 权限验证

  • 管理员用户名密码默认都为空,即不需要登录就可以查看监控数据
  • 如果需要登录验证,在applications/Statistics/Config/Config.php里面设置管理员密码

启动

在项目根目录新建 statistic 启动文件

php
#!/usr/bin/env php
<?php
require_once __DIR__.'/vendor/autoload.php';
$worker = new \shiyunWorker\process\StatisticsServer();
$worker->start();
#!/usr/bin/env php
<?php
require_once __DIR__.'/vendor/autoload.php';
$worker = new \shiyunWorker\process\StatisticsServer();
$worker->start();

启动服务

sh
# 启动
php statistic start 
# 守护进程启动
php statistic start -d
# 重启启动
php statistic restart
# 平滑重启/重新加载配置
php statistic reload
# 查看服务状态
php statistic status
# 停止
php statistic stop
# 启动
php statistic start 
# 守护进程启动
php statistic start -d
# 重启启动
php statistic restart
# 平滑重启/重新加载配置
php statistic reload
# 查看服务状态
php statistic status
# 停止
php statistic stop

统计服务端配置

统计服务端配置文件为/config/shiyun/rpc_server_statistics.php,内容如下:

php
<?php
//统计服务端配置
return [
    //web页面端口
    'web_port'        => 55757,
    //接收统计数据端口
    'statistics_port' => 9200,
    //web页面域名配置
    'host'            => '',
    // 账号
    'account'         => 'admin',
    // 密码
    'password'        => 'admin',
];
<?php
//统计服务端配置
return [
    //web页面端口
    'web_port'        => 55757,
    //接收统计数据端口
    'statistics_port' => 9200,
    //web页面域名配置
    'host'            => '',
    // 账号
    'account'         => 'admin',
    // 密码
    'password'        => 'admin',
];

实例化 new \shiyunWorker\process\StatisticsServer();
对象时可以传入自定义的配置文件绝对路径,或者直接传入一个数组。

php
#!/usr/bin/env php
<?php
require_once __DIR__.'/vendor/autoload.php';

/**
 * 配置方式:默认读取
 */
$worker = new \shiyunWorker\process\StatisticsServer();
$worker->start();

/**
 * 配置方式:传入绝对路径
 */
$worker = new \shiyunWorker\process\StatisticsServer("/www/xxx/config.php");
$worker->start();

/**
 * 配置方式:传入数组
 */
$config = [
    ...
];
$worker = new \shiyunWorker\process\StatisticsServer($config);
$worker->start();
#!/usr/bin/env php
<?php
require_once __DIR__.'/vendor/autoload.php';

/**
 * 配置方式:默认读取
 */
$worker = new \shiyunWorker\process\StatisticsServer();
$worker->start();

/**
 * 配置方式:传入绝对路径
 */
$worker = new \shiyunWorker\process\StatisticsServer("/www/xxx/config.php");
$worker->start();

/**
 * 配置方式:传入数组
 */
$config = [
    ...
];
$worker = new \shiyunWorker\process\StatisticsServer($config);
$worker->start();

统计监控页面

监控页面地址(端口为配置文件中的web页面端口):

  • http://127.0.0.1:55757
  • http://localhost:55757
  • http://10yun.host:55757

Copyright © 2017 10yun.com | 十云提供计算服务-IPV6 | ctocode组开发