ADC

指标

指标是指 NetScaler 跟踪的数据片段。指标提供了有意义的见解,可用于跟踪 NetScaler 和 NetScaler 处理的应用程序的运行状况。

时间序列是在特定时间间隔内出现的连续数据点序列。NetScaler 支持配置分析时间序列配置文件以向服务发送指标。

配置指标

您可以在 NetScaler 上启用指标,以收集指标并将其从 NetScaler 导出到各种终端节点。您可以导出以下格式的指标:Avro、Prometheus 和 JSON。可以对导出的指标进行处理和可视化,以获得有意义的见解。默认情况下,指标支持每 30 秒导出一次时间序列分析数据。但是,您可以根据需要将其配置为 30 到 300 秒之间的值。

要使用 NetScaler CLI 配置指标,请执行以下操作。

  1. 使用以下命令使用 IP 地址、协议和端口配置服务:

    add service <metrics_service_name> <ip-address> <protocol> <port>
    <!--NeedCopy-->
    

    示例:

    add service metrics_service1 192.168.1.1 HTTP 5563
    <!--NeedCopy-->
    
  2. 配置分析时间序列配置文件以向服务发送指标。指定服务、导出指标的频率和输出模式。

    set analytics profile ns_analytics_time_series_profile -collectors <metrics_service_name> -type timeseries -metrics ENABLED metricsExportFrequency <30-300> -outputMode <avro/prometheus>
    <!--NeedCopy-->
    

    示例:

    set analytics profile ns_analytics_time_series_profile -collectors metrics_service1 -type timeseries -metrics Enabled metricsExportFrequency 90 -outputMode prometheus --serveMode PUSH
    <!--NeedCopy-->
    

    注意:

    此示例使用默认的时间序列配置文件 ns_analytics_time_series_profile。如果要创建时间序列配置文件,则可以使用 add analytics profile 命令。

    在此示例中,指标导出频率设置为 90 秒,将导出模式指定为 Prometheus。

    请使用 show analytics profile <analytics-profile-name> 命令验证指标配置:

    show analytics profile ns_analytics_time_series_profile
    
        Name: ns_analytics_time_series_profile
        Collector: metrics_service1
        Profile-type: timeseries
            Output Mode: Prometheus
            Metrics: ENABLED
                Schema File: schema.json
                Metrics Export Frequency: 90
            Events: DISABLED
            Auditlog: DISABLED
            Serve mode: Pull
        Reference Count: 0
    <!--NeedCopy-->
    

指标文件生成

这些 metrics_<format>_log.* 文件是在 /var/nslog/ 文件夹位置下生成的。

动态架构支持

从 NetScaler 版本 13.1 版本 24.38 开始,支持动态架构计数器。在动态架构计数器的支持下,可以根据要求在运行时更新包含计数器列表的架构文件。默认情况下, /var/metrics_conf/schema.json 文件使用计数器列表进行配置。

注意:

  • 指标默认架构文件 /var/metrics_conf/schema.json 可以按 installns 过程安装在 NetScaler 设备上。有关 installns 过程的信息,请参阅升级和降级 NetScaler 设备
  • 默认架构文件 /var/metrics_conf/schema.json 由一些不属于 reference_schema.json 的实体和计数器组成。出于向后兼容的原因,将这些计数器保留在 schema.json 中,因为它们是支持静态架构的旧版本指标的一部分。

使用 CLI 配置指标以订阅计数器

通过配置服务开始指标导出。

在命令提示符下,键入:


set analytics profile ns_analytics_time_series_profile -metrics ENABLED -collectors <collector_name> -schemaFile  schema.json -outputMode <avro | prometheus>

<!--NeedCopy-->

注意:

schema.json 是默认的 schemaFile 配置。

可以使用 CLI 命令配置具有所需计数器集的新架构文件,以便导出指标。架构文件必须存在于 /var/metrics_conf/ 位置。

包含统计信息下文支持的所有计数器列表 (reference_schema.json) 的架构文件位于 /var/metrics_conf/ 位置。此文件可用作构建计数器自定义列表的参考。

使用 CLI 配置架构文件

set analytics profile ns_analytics_time_series_profile -metrics ENABLED -collectors <collector name> -schemaFile <schema file_name> -outputMode <avro | prometheus>

<!--NeedCopy-->

可以使用前面的 CLI 命令添加和配置具有所需计数器的新架构文件以导出指标。

包含统计信息支持的所有计数器列表(reference_schema.json)的参考架构文件存在于 /var/metrics_conf/ 位置。此文件可用作构建计数器自定义列表的参考。

在命令提示符下检查 CLI 配置输出:


show analytics profile ns_analytics_time_series_profile

    Name: ns_analytics_time_series_profile
    Collector: <collector_name>
    Profile-type: timeseries
    Output Mode: avro
    Metrics: ENABLED
    Schema File: schema.json
    Events: ENABLED
    Auditlog: DISABLED
    Serve mode: Push
    Reference Count: 0

<!--NeedCopy-->

更新导出的计数器列表的步骤

执行以下步骤以更新导出的计数器列表:

  1. 更新自定义/新架构文件。
  2. 使用 CLI 配置中显示的 -metrics 选项禁用和启用指标,以便使用更新后的架构文件。

多时间序列配置文件支持

从 NetScaler 版本 13.1 Build 33.47 开始,NetScaler 最多支持三种时间序列配置文件配置。

您可以将每个时间序列配置为具有以下内容:

  • 收集器。

  • 包含要导出的所需计数器集的架构文件。

  • 要导出指标的数据格式。

  • 启用或禁用指标审核日志和事件的选项。

借助多时间序列配置文件支持,这些指标可以将一组不同的指标(基于配置的架构文件)以不同的格式(Avro、Prometheus、Influx)同时导出到不同的收集器。

注意:

尽管可以在所有配置的时间序列配置文件上启用指标,但只能在一个配置文件上启用事件和审核日志。

使用 CLI 添加时间序列配置文件

在命令提示符下,键入:

add analytics profile <profile_name> -type timeseries
<!--NeedCopy-->

使用 CLI 配置时间序列配置文件

在命令提示符下,键入:

set analytics profile <profile_name> -metrics <DISABLED|ENABLED> -auditlogs <DISABLED|ENABLED> -events <DISABLED|ENABLED> -collectors <collector_name> -schemaFile schema.json -outputMode <avro | influx | prometheus>

<!--NeedCopy-->

支持多个时间序列配置文件的日志文件命名惯例

  • Avro 日志文件生成为 metrics_avro_<profile_name>_log.*
  • Prometheus 日志文件生成为 metrics_prom_<profile_name>.log

配置特定用例的指标导出

通过创建架构文件,您只能导出与特定用例相关的指标。例如,如果您只想查看与 TCP 流量相关的指标,则可以创建一个 tcptrafficschema.json 文件来仅导出与 TCP 流量相关的指标。通过导出特定用例的指标,可以更轻松地找到所需的指标。

NetScaler 支持导出以下用例的指标:

  • 虚拟服务器
  • 应用程序安全性
  • SSL 流量
  • TCP 流量
  • HTTP 流量
  • 系统概述

虚拟服务器

要仅查看与虚拟服务器相关的指标,请执行以下步骤:

  1. 登录 NetScaler CLI 并导航到 /var/metrics_conf/ 文件夹。
  2. 创建架构文件。例如,vserver_metrics.json

    set analytics profile ns_analytics_time_series_profile -schemaFile vserver_metrics.json
    <!--NeedCopy-->
    
  3. 添加以下内容并保存更改:

    {
        "server_svc_cfg":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"},
            {"name":"si_cur_Clients","rate":"False"},
            {"name":"si_cur_Servers","rate":"False"}
        ],
        "server_serviceGroup":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"},
            {"name":"si_cur_Clients","rate":"False"},
            {"name":"si_cur_Servers","rate":"False"}
        ],
        "vserver_authn":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "vserver_cr":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "vserver_cs":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"},
            {"name":"si_cur_Clients","rate":"False"},
            {"name":"si_cur_Servers","rate":"False"}
        ],
        "gslb_server":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "gslb_vserver":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "server_gslb_serviceGroup":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "vserver_lb":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"},
            {"name":"si_cur_Clients","rate":"False"},
            {"name":"si_cur_Servers","rate":"False"}
        ],
        "vserver_vpn":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "vserver_user":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"},
            {"name":"si_cur_Clients","rate":"False"},
            {"name":"si_cur_Servers","rate":"False"}
        ]
    }
    <!--NeedCopy-->
    

应用程序安全性

要仅查看与应用程序安全相关的指标,请执行以下步骤:

  1. 登录 NetScaler CLI 并导航到 /var/metrics_conf/ 文件夹。
  2. 创建架构文件。例如,appsec_metrics.json

    set analytics profile ns_analytics_time_series_profile -schemaFile appsec_metrics.json
    <!--NeedCopy-->
    
  3. 添加以下内容并保存更改:

    {
        "netscaler":
        [
            {"name":"as_viol_starturl","rate":"True"},
            {"name":"as_viol_denyurl","rate":"True"},
            {"name":"as_viol_referer_header","rate":"True"},
            {"name":"as_viol_bufferoverflow","rate":"True"},
            {"name":"as_viol_grpc","rate":"True"},
            {"name":"as_viol_postbodylimit","rate":"True"},
            {"name":"as_viol_cookie","rate":"True"},
            {"name":"as_viol_cookie_hijack","rate":"True"},
            {"name":"as_viol_csrf_tag","rate":"True"},
            {"name":"as_viol_xss","rate":"True"},
            {"name":"as_viol_sql","rate":"True"},
            {"name":"as_viol_fldfmt","rate":"True"},
            {"name":"as_viol_fldconsistency","rate":"True"},
            {"name":"as_viol_fileuploadtypes","rate":"True"},
            {"name":"as_viol_infer_ctype_xml","rate":"True"},
            {"name":"as_viol_safecommerce","rate":"True"},
            {"name":"as_viol_safeobject","rate":"True"},
            {"name":"as_viol_signature","rate":"True"},
            {"name":"as_viol_content_type","rate":"True"},
            {"name":"as_viol_cmd","rate":"True"},
            {"name":"as_viol_json_dos","rate":"True"},
            {"name":"as_viol_json_sql","rate":"True"},
            {"name":"as_viol_json_xss","rate":"True"},
            {"name":"as_viol_json_cmd","rate":"True"},
            {"name":"as_viol_sql_gram","rate":"True"},
            {"name":"as_viol_json_sql_gram","rate":"True"},
            {"name":"as_viol_sql_comb","rate":"True"},
            {"name":"as_viol_xxe_comb","rate":"True"},
            {"name":"as_viol_xss_comb","rate":"True"},
            {"name":"as_viol_owasp_comb","rate":"True"},
            {"name":"as_viol_cmd_gram","rate":"True"},
            {"name":"as_viol_json_cmd_gram","rate":"True"},
            {"name":"as_viol_block_keyword","rate":"True"},
            {"name":"as_viol_json_blockkeyword","rate":"True"},
            {"name":"as_Requests","rate":"False"},
            {"name":"http_tot_Requests","rate":"True"},
            {"name":"http_tot_Requests1_0","rate":"True"},
            {"name":"http_tot_Requests1_1","rate":"True"},
            {"name":"as_sig_num_viols","rate":"True"}
        ],
        "appfw__":
        [
            {"name":"as_viol_starturl_profile","rate":"True"},
            {"name":"as_viol_denyurl_profile","rate":"True"},
            {"name":"as_viol_referer_header_profile","rate":"True"},
            {"name":"as_viol_bufferoverflow_profile","rate":"True"},
            {"name":"as_viol_postbodylimit_profile","rate":"True"},
            {"name":"as_viol_cookie_profile","rate":"True"},
            {"name":"as_viol_cookie_hijack_profile","rate":"True"},
            {"name":"as_viol_csrf_tag_profile","rate":"True"},
            {"name":"as_viol_xss_profile","rate":"True"},
            {"name":"as_viol_sql_profile","rate":"True"},
            {"name":"as_viol_fldfmt_profile","rate":"True"},
            {"name":"as_viol_fldconsistency_profile","rate":"True"},
            {"name":"as_viol_safecommerce_profile","rate":"True"},
            {"name":"as_viol_safeobject_profile","rate":"True"},
            {"name":"as_viol_signature_profile","rate":"True"},
            {"name":"as_viol_content_type_profile","rate":"True"},
            {"name":"as_viol_json_dos_profile","rate":"True"},
            {"name":"as_viol_json_sql_profile","rate":"True"},
            {"name":"as_viol_json_xss_profile","rate":"True"},
            {"name":"as_viol_json_cmd_profile","rate":"True"},
            {"name":"as_viol_fileuploadtypes_profile","rate":"True"},
            {"name":"as_viol_infer_ctype_xml_profile","rate":"True"},
            {"name":"as_viol_cmd_profile","rate":"True"},
            {"name":"as_viol_sql_gram_profile","rate":"True"},
            {"name":"as_viol_json_sql_gram_profile","rate":"True"},
            {"name":"as_viol_sql_comb_profile","rate":"True"},
            {"name":"as_viol_xxe_comb_profile","rate":"True"},
            {"name":"as_viol_xss_comb_profile","rate":"True"},
            {"name":"as_viol_owasp_comb_profile","rate":"True"},
            {"name":"as_viol_cmd_gram_profile","rate":"True"},
            {"name":"as_viol_json_cmd_gram_profile","rate":"True"},
            {"name":"as_viol_block_keyword_profile","rate":"True"},
            {"name":"as_viol_json_blockkeyword_profile","rate":"True"},
            {"name":"as_viol_total_per_profile","rate":"True"}
        ]
    }
    <!--NeedCopy-->
    

SSL 流量

要仅查看与 SSL 相关的指标,请执行以下步骤:

  1. 登录 NetScaler CLI 并导航到 /var/metrics_conf/ 文件夹。
  2. 创建架构文件。例如,ssltraffic_metrics.json

    set analytics profile ns_analytics_time_series_profile -schemaFile ssltraffic_metrics.json
    <!--NeedCopy-->
    
  3. 添加以下内容并保存更改:

    {
        "netscaler":
        [
            {"name":"ssl_tot_sslInfo_TotalTxCount","rate":"True"},
            {"name":"ssl_tot_enc_bytes","rate":"True"},
            {"name":"ssl_tot_dec_bytes","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_RSA_512","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_RSA_1024","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_RSA_2048","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_RSA_3072","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_RSA_4096","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_DH_512","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_DH_1024","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_DH_2048","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_DH_4096","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_ECDHE_curve_secp521r1","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_ECDHE_curve_secp384r1","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_ECDHE_curve_secp256r1","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_ECDHE_curve_secp224r1","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_ECDHE_curve_x25519","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_RC4_40","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_RC4_56","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_RC4_64","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_RC4_128","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_DES_40","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_DES_56","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_3DES_168","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_AES_128","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_AES_256","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_RC2_40","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_RC2_56","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_RC2_128","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_AESGCM_128","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_AESGCM_256","rate":"True"},
            {"name":"ssl_tot_sslInfo_Cipher_NULL","rate":"True"},
            {"name":"ssl_tot_sslInfo_Hash_MD5","rate":"True"},
            {"name":"ssl_tot_sslInfo_Hash_SHA","rate":"True"},
            {"name":"ssl_tot_sslInfo_Hash_SHA256","rate":"True"},
            {"name":"ssl_tot_sslInfo_Hash_SHA384","rate":"True"},
            {"name":"ssl_tot_sslInfo_SSLv3HandskCount","rate":"True"},
            {"name":"ssl_tot_sslInfo_TLSv1HandskCount","rate":"True"},
            {"name":"ssl_tot_sslInfo_TLSv11HandskCount","rate":"True"},
            {"name":"ssl_tot_sslInfo_TLSv12HandskCount","rate":"True"},
            {"name":"ssl_tot_sslInfo_Auth_RSA","rate":"True"},
            {"name":"ssl_tot_sslInfo_Auth_DH","rate":"True"},
            {"name":"ssl_tot_sslInfo_Auth_DSS","rate":"True"},
            {"name":"ssl_tot_sslInfo_Auth_ECDSA","rate":"True"},
            {"name":"ssl_tot_sslInfo_Auth_NULL","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_backend_ecdhe_curve_secp521r1","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_backend_ecdhe_curve_secp384r1","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_backend_ecdhe_curve_secp256r1","rate":"True"},
            {"name":"ssl_tot_sslInfo_KeyEx_backend_ecdhe_curve_secp224r1","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_RC4_40","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_RC4_56","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_RC4_64","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_RC4_128","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_DES_40","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_DES_56","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_3DES_168","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_AES_128","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_AES_256","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_RC2_40","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_RC2_56","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_RC2_128","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_AESGCM_128","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_AESGCM_256","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Cipher_NULL","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Hash_MD5","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Hash_SHA","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Hash_SHA256","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Hash_SHA384","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Auth_RSA","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Auth_DH","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Auth_DSS","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Auth_ECDSA","rate":"True"},
            {"name":"ssl_tot_sslInfo_Backend_Auth_NULL","rate":"True"},
            {"name":"ssl_tot_enc_bytes_FE","rate":"True"},
            {"name":"ssl_tot_enc_bytes_BE","rate":"True"},
            {"name":"ssl_tot_dec_bytes_FE","rate":"True"},
            {"name":"ssl_tot_dec_bytes_BE","rate":"True"},
            {"name":"ssl_cur_session_inuse","rate":"True"}
        ],
        "vserver_ssl":
        [
            {"name":"ssl_ctx_tot_HandskFail","rate":"True"}
        ]
    }
    <!--NeedCopy-->
    

TCP 流量

要仅查看与 TCP 相关的指标,请执行以下步骤:

  1. 登录 NetScaler CLI 并导航到 /var/metrics_conf/ 文件夹。
  2. 创建架构文件。例如,tcptraffic_metrics.json

    set analytics profile ns_analytics_time_series_profile -schemaFile tcptraffic_metrics.json
    <!--NeedCopy-->
    
  3. 添加以下内容并保存更改:

    {
        "server_svc_cfg":
        [
            {"name":"si_tot_pkt_rcvd","rate":"True"},
            {"name":"si_tot_pkt_sent","rate":"True"}
        ],
        "vserver_cr":
        [
            {"name":"si_tot_pkt_rcvd","rate":"True"},
            {"name":"si_tot_pkt_sent","rate":"True"}
        ],
        "vserver_cs":
        [
            {"name":"si_tot_pkt_rcvd","rate":"True"},
            {"name":"si_tot_pkt_sent","rate":"True"}
        ],
        "vserver_lb":
        [
            {"name":"si_tot_pkt_rcvd","rate":"True"},
            {"name":"si_tot_pkt_sent","rate":"True"}
        ],
        "netscaler":
        [
            {"name":"tcp_cur_ClientConn","rate":"False"},
            {"name":"tcp_cur_ClientConnEst","rate":"False"},
            {"name":"tcp_cur_ServerConn","rate":"False"},
            {"name":"tcp_cur_ServerConnEst","rate":"False"},
            {"name":"tcp_cur_ClientConnClosing","rate":"False"},
            {"name":"tcp_cur_ServerConnClosing","rate":"False"},
            {"name":"tcp_cur_surgequeuelen","rate":"False"},
            {"name":"tcp_err_rst","rate":"False"},
            {"name":"tcp_err_noip","rate":"False"},
            {"name":"tcp_err_retransmit_giveups","rate":"False"},
            {"name":"tcp_err_retransmit","rate":"False"},
            {"name":"tcp_err_stray_packets","rate":"False"}
        ],
        "vserver_user":
        [
            {"name":"si_tot_pkt_rcvd","rate":"True"},
            {"name":"si_tot_pkt_sent","rate":"True"}
        ]
    }
    
    <!--NeedCopy-->
    

HTTP 流量

要仅查看与 HTTP 相关的指标,请执行以下步骤:

  1. 登录 NetScaler CLI 并导航到 /var/metrics_conf/ 文件夹。
  2. 创建架构文件。例如,httptraffic_metrics.json

    set analytics profile ns_analytics_time_series_profile -schemaFile httptraffic_metrics.json
    <!--NeedCopy-->
    
  3. 添加以下内容并保存更改:

    {
        "server_svc_cfg":
        [
            {"name":"si_tot_Requests","rate":"True"},
            {"name":"si_tot_Responses","rate":"True"},
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "server_serviceGroup":
        [
            {"name":"si_tot_Requests","rate":"True"},
            {"name":"si_tot_Responses","rate":"True"},
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "netscaler":
        [
            {"name":"http_tot_api_req_json","rate":"False"},
            {"name":"http_tot_api_req_xml","rate":"False"},
            {"name":"http_tot_api_req_vnd","rate":"False"},
            {"name":"http_tot_api_res_json","rate":"False"},
            {"name":"http_tot_api_res_xml","rate":"False"},
            {"name":"http_tot_api_res_vnd","rate":"False"}
        ],
        "vserver_authn":
        [
            {"name":"si_tot_Requests","rate":"True"},
            {"name":"si_tot_Responses","rate":"True"},
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "vserver_cr":
        [
            {"name":"vsvr_tot_Hits","rate":"True"},
            {"name":"si_tot_Requests","rate":"True"},
            {"name":"si_tot_Responses","rate":"True"},
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "vserver_cs":
        [
            {"name":"vsvr_tot_Hits","rate":"True"},
            {"name":"si_tot_Requests","rate":"True"},
            {"name":"si_tot_Responses","rate":"True"},
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"},
            {"name":"si_tot_clt_ttlb_transactions","rate":"False"},
            {"name":"si_tot_clt_ttlb","rate":"False"}
        ],
        "gslb_server":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "gslb_vserver":
        [
            {"name":"vsvr_tot_Hits","rate":"True"},
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "server_gslb_serviceGroup":
        [
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "vserver_lb":
        [
            {"name":"vsvr_tot_Hits","rate":"True"},
            {"name":"si_tot_Requests","rate":"True"},
            {"name":"si_tot_Responses","rate":"True"},
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"},
            {"name":"si_tot_clt_ttlb_transactions","rate":"False"},
            {"name":"si_tot_clt_ttlb","rate":"False"},
            {"name":"si_tot_1xx_resp","rate":"False"},
            {"name":"si_tot_2xx_resp","rate":"False"},
            {"name":"si_tot_4xx_resp","rate":"False"},
            {"name":"si_tot_5xx_resp","rate":"False"}
        ],
        "vserver_vpn":
        [
            {"name":"si_tot_Requests","rate":"True"},
            {"name":"si_tot_Responses","rate":"True"},
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ],
        "vserver_user":
        [
            {"name":"vsvr_tot_Hits","rate":"True"},
            {"name":"si_tot_Requests","rate":"True"},
            {"name":"si_tot_Responses","rate":"True"},
            {"name":"si_tot_RequestBytes","rate":"True"},
            {"name":"si_tot_ResponseBytes","rate":"True"}
        ]
    }
    <!--NeedCopy-->
    

系统概述

要仅查看与系统概述相关的指标,请执行以下步骤:

  1. 登录 NetScaler CLI 并导航到 /var/metrics_conf/ 文件夹。
  2. 创建架构文件。例如,system_metrics.json

    set analytics profile ns_analytics_time_series_profile -schemaFile system_metrics.json
    <!--NeedCopy-->
    
  3. 添加以下内容并保存更改:

    {
        "server_svc_cfg":
        [
            {"name":"si_tot_svr_ttlb","rate":"False"},
            {"name":"si_tot_svr_ttlb_transactions","rate":"False"},
            {"name":"si_cur_state","rate":"False"},
            {"name":"si_tot_svr_ttfb_transactions","rate":"False"},
            {"name":"si_tot_svr_ttfb","rate":"False"}
        ],
        "serviceGroup_NSSVC":
        [
            {"name":"si_cur_state","rate":"False"}
        ],
        "server_serviceGroup":
        [
            {"name":"si_cur_state","rate":"False"},
            {"name":"si_tot_svr_ttfb_transactions","rate":"False"},
            {"name":"si_tot_svr_ttfb","rate":"False"}
        ],
        "vserver_authn":
        [
            {"name":"si_cur_state","rate":"False"}
        ],
        "vserver_cr":
        [
            {"name":"si_cur_state","rate":"False"},
            {"name":"vsvr_tot_Hits","rate":"True"}
        ],
        "vserver_cs":
        [
            {"name":"si_cur_state","rate":"False"},
            {"name":"vsvr_tot_Hits","rate":"True"}
        ],
        "gslb_server":
        [
            {"name":"si_cur_state","rate":"False"}
        ],
        "gslb_vserver":
        [
            {"name":"si_cur_state","rate":"False"},
            {"name":"vsvr_tot_Hits","rate":"True"}
        ],
        "gslb_serviceGroup_NSSVC":
        [
            {"name":"si_cur_state","rate":"False"}
        ],
        "server_gslb_serviceGroup":
        [
            {"name":"si_cur_state","rate":"False"}
        ],
        "vserver_lb":
        [
            {"name":"si_cur_state","rate":"False"},
            {"name":"si_tot_2xx_resp","rate":"False"},
            {"name":"si_tot_4xx_resp","rate":"False"},
            {"name":"vsvr_tot_Hits","rate":"True"}
        ],
        "interface":
        [
            {"name":"nic_err_dropped_pkts","rate":"True"}
        ],
        "netscaler":
        [
            {"name": "tcp_cur_ClientConn", "rate": "False"},
            {"name": "tcp_err_noip", "rate": "False"},
            {"name": "tcp_err_rst", "rate": "True"},
            {"name": "mem_cur_usedsize", "rate": "False"},
            {"name": "tcp_tot_rxpkts", "rate": "True"},
            {"name": "http_tot_rxResponseBytes", "rate": "True"},
            {"name": "http_tot_Requests1_1", "rate": "True"},
            {"name": "http_tot_Responses", "rate": "True"},
            {"name": "tcp_err_retransmit_giveups", "rate": "True"},
            {"name": "cur_syshealth_disk0_errors", "rate": "False"},
            {"name": "http_tot_Requests", "rate": "True"},
            {"name": "http_tot_rxRequestBytes", "rate": "True"},
            {"name": "slave_cpu_use", "rate": "False"},
            {"name": "cur_syshealth_disk0_used", "rate": "False"},
            {"name": "tcp_err_rst_outof_wnd", "rate": "True"},
            {"name": "tcp_err_stray_packets", "rate": "True"},
            {"name": "cur_syshealth_disk1_errors", "rate": "False"},
            {"name": "mgmt_additional_cpu_use", "rate": "False"},
            {"name": "tcp_cur_ServerConnEst", "rate": "False"},
            {"name": "tcp_cur_ClientConnEst", "rate": "False"},
            {"name": "tcp_err_link_giveups", "rate": "False"},
            {"name": "tcp_err_rst_inTimewaits", "rate": "True"},
            {"name": "tcp_err_retransmit", "rate": "True"},
            {"name": "tcp_cur_ServerConnClosing", "rate": "False"},
            {"name": "tcp_err_rst_not_est", "rate": "True"},
            {"name": "http_tot_Responses1_1", "rate": "True"},
            {"name": "tcp_err_rst_not_est", "rate": "True"},
            {"name": "tcp_err_rst_inTimewaits", "rate": "True"},
            {"name": "tcp_err_rst_outof_wnd", "rate": "True"},
            {"name": "tcp_cur_ServerConn", "rate": "False"},
            {"name": "allnic_tot_tx_mbits", "rate": "True"},
            {"name": "http_tot_Responses1_0", "rate": "True"},
            {"name": "cpu_use", "rate": "False"},
            {"name": "tcp_err_retransmit_giveups", "rate": "True"},
            {"name": "http_tot_Requests1_0", "rate": "True"},
            {"name": "mgmt_cpu_use", "rate": "False"},
            {"name": "cur_syshealth_disk1_size", "rate": "False"},
            {"name": "allnic_tot_rx_mbits", "rate": "True"},
            {"name": "master_cpu_use", "rate": "False"},
            {"name": "cur_syshealth_disk0_size", "rate": "False"}
        ],
        "mempool":
        [
            {"name":"mem_err_alloc_failed","rate":"False"}
        ],
        "vserver_ssl":
        [
            {"name":"si_cur_state","rate":"False"}
        ],
        "cpu":
        [
            {"name":"cc_cpu_use","rate":"False"}
        ],
        "vserver_vpn":
        [
            {"name":"si_cur_state","rate":"False"}
        ],
        "vserver_user":
        [
            {"name":"si_cur_state","rate":"False"},
            {"name":"vsvr_tot_Hits","rate":"True"}
        ]
    }
    <!--NeedCopy-->
    

查看指标

以下是使用或可视化指标的不同方式:

  • NetScaler 命令行界面 (CLI)
  • Citrix 专有的 NITRO API
  • 将指标导出到 NetScaler 控制台
  • 将指标导出到可观测性工具

NetScaler CLI

您可以使用 NetScaler CLI 来获取指标。登录 NetScaler CLI 并在 Shell 提示符下运行该命令。以下命令是示例命令:

stat lb vserver <vserver-name>
<!--NeedCopy-->

示例:

> shell
root@ns# stat lb vserver vsrv-wireless
Virtual Server Summary
                      vsvrIP  port     Protocol        State   Health  actSvcs
vsrv...eless               *     0          TCP           UP      100        1

           inactSvcs
vsrv...eless       0
Virtual Server Statistics
                                          Rate (/s)                Total
Vserver hits                                       0                   10
Requests                                           0                    0
Responses                                          0                    0
Request bytes                                      0                 1580
Response bytes                                     0            532594360
Total Packets rcvd                                 0               216463
Total Packets sent                                 0               369898
Current client connections                        --                    0
Current Client Est connections                    --                    0
Current server connections                        --                    0
Requests in surge queue                           --                    0
Requests in vserver's surgeQ                      --                    0
Requests in service's surgeQs                     --                    0
Spill Over Threshold                              --                    0
Spill Over Hits                                   --                    0
Labeled Connection                                --                    0
Push Labeled Connection                           --                    0
Deferred Request                                   0                    0
Invalid Request/Response                          --                    0
Invalid Request/Response Dropped                  --                    0
Bound Service(s) Summary
                          IP  port         Type        State     Hits   Hits/s
svc-internet     192.168.2.2     0          TCP           UP       10      0/s

                 Req    Req/s      Rsp    Rsp/s Throughp ClntConn   SurgeQ
svc-internet       0      0/s        0      0/s        0        0        0
                  SvrConn   ReuseP  MaxConn ActvTran  SvrTTFB     Load
svc-internet         0        0        0        0        0        0

<!--NeedCopy-->

Citrix 专有的 NITRO API

您可以运行 NITRO API 并获取所需的指标。

例如,要查看 NetScaler 正在处理的 HTTP 请求总数,您可以通过在 Linux 外壳中运行以下 curl 命令来使用 NITRO API:

curl http://{nsip}/nitro/v1/stat/nsglobalcntr?args=counters:http_tot_Requests -u {nsuser}:{nspassword}
<!--NeedCopy-->

在前面的示例中,

  • nsip 是 NetScaler 的 IP 地址
  • nsusernspassword 是 NetScaler 的登录凭据

输出如下所示:

root@rohit_lvm:~#  curl "http://10.10.10.10/nitro/v1/stat/nsglobalcntr?args=counters:http_tot_Requests" -u nsroot:freebsd
{ "errorcode": 0, "message": "Done", "severity": "NONE", "nsglobalcntr": { "http_tot_Requests": "33398" } }
<!--NeedCopy-->

有关 Citrix 专有的 NITRO API 的更多信息,请参阅 Citrix ADC NITRO API

将指标导出到 NetScaler 控制台

如果您的网络中有 NetScaler 控制台来管理 NetScaler,则可以通过 NetScaler 控制台 GUI 查看指标。有关更多信息,请参阅 NetScaler 控制台文档

将指标导出到可观测性工具

您可以将统计数据和计数器等指标导出到可观察性工具,例如:

示例控制板

Grafana 和 Splunk 上提供的以下控制板为您提供与特定用例相关的指标:

解决与指标导出相关的问题

您可以使用存储在 /var/nslog/metricscollector.log 位置的调试日志来解决任何问题。