📄 nodequery.xpl
字号:
<?xml version="1.0"?><!DOCTYPE methoddef SYSTEM "rpc-method.dtd"><methoddef><name>NodeQuery</name><version>1.0</version><signature>struct scalar</signature><help> Accepts a scalar containing: transp scalar one of 'drw' char, as a transport codeReturns a struct containing KEY VALUE ret_code int (numeric return code) ret_val string (message string) Health int (health value 0-100) CpuLoad int (cpu load value 0-100) Throughput int (total streaming server throughput in bit/s)</help><code language="perl"><![CDATA[#!/usr/bin/perl################################################################################ Sub Name: NodeQuery## Accepts a scalar containing:# transp scalar one of 'drw' char, as a transport code## Returns a struct containing# KEY VALUE# ret_code int (numeric return code)# ret_val string (message string)# Health int (health value 0-100)# CpuLoad int (cpu load value 0-100)# Throughput int (total streaming server throughput in bit/s)###############################################################################sub NodeQuery { use CommLib qw(node_log); my $transp = shift; my $thrp = &Adaptation::query_band($transp); my $cpu = &NodeLib::query_cpu; my $health = (( $maxband - $thrp ) / $maxband) * (( 100 - $cpu ) / 100 ) * 100; my ( $ret_code, $ret_val ); #writes a system log node_log ( ">>> Receiving a node status query. Total throughput is $thrp bit/s. Cpu load is $cpu %. Health is $health.", 3, 'n'); return { ret_code => '200', ret_val => 'Node sending status values correctly', Health => $health, CpuLoad => $cpu, Throughput => $thrp };}__END__]]></code></methoddef>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -