我的目标是为每个主机的每个接口检索COUNT / STDDEV统计信息,最好运行一个查询。我以为我可以用GROUP BY做到这一点,但是当我这样查询时:
SELECT STDDEV(*), COUNT(*) FROM "M1" WHERE "host" =~ /^host1/ GROUP BY "interface-name"
我得到的结果是错误的。例如。对于特定的密钥,请说: (“ M1”,“ InterfaceNumber1”)是这样的:
[{
'time': '1970-01-01T00:00:00Z',
'stddev_applique': None,
'stddev_availability-flag': None,
'stddev_broadcast-packets-received': None,
'stddev_broadcast-packets-sent': None,
'stddev_bytes-received': None,
'stddev_bytes-sent': None,
'stddev_carrier-transitions': None,
'stddev_crc-errors': None,
'stddev_framing-errors-received': None,
'stddev_giant-packets-received': None,
'stddev_input-aborts': None,
'stddev_input-drops': None,
'stddev_input-errors': None,
'stddev_input-ignored-packets': None,
'stddev_input-overruns': None,
'stddev_input-queue-drops': None,
'stddev_last-data-time': None,
'stddev_last-discontinuity-time': None,
'stddev_multicast-packets-received': None,
'stddev_multicast-packets-sent': None,
'stddev_output-buffer-failures': None,
'stddev_output-buffers-swapped-out': None,
'stddev_output-drops': None,
'stddev_output-errors': None,
'stddev_output-queue-drops': None,
'stddev_output-underruns': None,
'stddev_packets-received': None,
'stddev_packets-sent': None,
'stddev_parity-packets-received': None,
'stddev_resets': None,
'stddev_runt-packets-received': None,
'stddev_seconds-since-last-clear-counters': None,
'stddev_seconds-since-packet-received': None,
'stddev_seconds-since-packet-sent': None,
'stddev_throttled-packets-received': None,
'stddev_unknown-protocol-packets-received': None,
'count_applique': 1,
'count_availability-flag': 1,
'count_broadcast-packets-received': 1,
'count_broadcast-packets-sent': 1,
'count_bytes-received': 1,
'count_bytes-sent': 1,
'count_carrier-transitions': 1,
'count_crc-errors': 1,
'count_framing-errors-received': 1,
'count_giant-packets-received': 1,
'count_input-aborts': 1,
'count_input-drops': 1,
'count_input-errors': 1,
'count_input-ignored-packets': 1,
'count_input-overruns': 1,
'count_input-queue-drops': 1,
'count_last-data-time': 1,
'count_last-discontinuity-time': 1,
'count_multicast-packets-received': 1,
'count_multicast-packets-sent': 1,
'count_output-buffer-failures': 1,
'count_output-buffers-swapped-out': 1,
'count_output-drops': 1,
'count_output-errors': 1,
'count_output-queue-drops': 1,
'count_output-underruns': 1,
'count_packets-received': 1,
'count_packets-sent': 1,
'count_parity-packets-received': 1,
'count_resets': 1,
'count_runt-packets-received': 1,
'count_seconds-since-last-clear-counters': 1,
'count_seconds-since-packet-received': 1,
'count_seconds-since-packet-sent': 1,
'count_throttled-packets-received': 1,
'count_unknown-protocol-packets-received': 1
}]
如您所见,全为1,无, 但是当我这样运行查询时(对于相同的主机,度量和接口名称):
SELECT STDDEV(*), COUNT(*) FROM "M1" WHERE "host" =~ /^host1/ AND "interface-name" =~ /^InterfaceNumber1/
我得到正确的结果:
[{
'time': '1970-01-01T00:00:00Z',
'stddev_applique': 0,
'stddev_availability-flag': 0,
'stddev_broadcast-packets-received': 7605.333137727622,
'stddev_broadcast-packets-sent': 5.034785826922664,
'stddev_bytes-received': 5305925389.339046,
'stddev_bytes-sent': 8554603540.685867,
'stddev_carrier-transitions': 0.7013739842897725,
'stddev_crc-errors': 0,
'stddev_framing-errors-received': 0,
'stddev_giant-packets-received': 0,
'stddev_input-aborts': 0,
'stddev_input-drops': 0,
'stddev_input-errors': 0,
'stddev_input-ignored-packets': 0,
'stddev_input-overruns': 0,
'stddev_input-queue-drops': 0,
'stddev_last-data-time': 278294.6634978229,
'stddev_last-discontinuity-time': 0,
'stddev_multicast-packets-received': 19214980.900301825,
'stddev_multicast-packets-sent': 19230254.49658241,
'stddev_output-buffer-failures': 0,
'stddev_output-buffers-swapped-out': 0,
'stddev_output-drops': 0,
'stddev_output-errors': 0,
'stddev_output-queue-drops': 0,
'stddev_output-underruns': 0,
'stddev_packets-received': 86536680.42904525,
'stddev_packets-sent': 29836054.72874229,
'stddev_parity-packets-received': 0,
'stddev_resets': 0,
'stddev_runt-packets-received': 0,
'stddev_seconds-since-last-clear-counters': 0,
'stddev_seconds-since-packet-received': 1004126108.0294715,
'stddev_seconds-since-packet-sent': 1004126108.0294715,
'stddev_throttled-packets-received': 0,
'stddev_unknown-protocol-packets-received': 0,
'count_applique': 70,
'count_availability-flag': 70,
'count_broadcast-packets-received': 70,
'count_broadcast-packets-sent': 70,
'count_bytes-received': 70,
'count_bytes-sent': 70,
'count_carrier-transitions': 70,
'count_crc-errors': 70,
'count_framing-errors-received': 70,
'count_giant-packets-received': 70,
'count_input-aborts': 70,
'count_input-drops': 70,
'count_input-errors': 70,
'count_input-ignored-packets': 70,
'count_input-overruns': 70,
'count_input-queue-drops': 70,
'count_last-data-time': 70,
'count_last-discontinuity-time': 70,
'count_multicast-packets-received': 70,
'count_multicast-packets-sent': 70,
'count_output-buffer-failures': 70,
'count_output-buffers-swapped-out': 70,
'count_output-drops': 70,
'count_output-errors': 70,
'count_output-queue-drops': 70,
'count_output-underruns': 70,
'count_packets-received': 70,
'count_packets-sent': 70,
'count_parity-packets-received': 70,
'count_resets': 70,
'count_runt-packets-received': 70,
'count_seconds-since-last-clear-counters': 70,
'count_seconds-since-packet-received': 70,
'count_seconds-since-packet-sent': 70,
'count_throttled-packets-received': 70,
'count_unknown-protocol-packets-received': 70
}]
interface-name
和host
是标签。
谢谢