1Sys::Statistics::Linux:U:sNeertSCtoanttsr(i3bpumt)ed PerSlysD:o:cSutmaetnitsattiicosn::Linux::NetStats(3pm)
2
3
4
6 Sys::Statistics::Linux::NetStats - Collect linux net statistics.
7
9 use Sys::Statistics::Linux::NetStats;
10
11 my $lxs = Sys::Statistics::Linux::NetStats->new;
12 $lxs->init;
13 sleep 1;
14 my $stat = $lxs->get;
15
16 Or
17
18 my $lxs = Sys::Statistics::Linux::NetStats->new(initfile => $file);
19 $lxs->init;
20 my $stat = $lxs->get;
21
23 Sys::Statistics::Linux::NetStats gathers net statistics from the
24 virtual /proc filesystem (procfs).
25
26 For more information read the documentation of the front-end module
27 Sys::Statistics::Linux.
28
30 Generated by /proc/net/dev.
31
32 rxbyt - Number of bytes received per second.
33 rxpcks - Number of packets received per second.
34 rxerrs - Number of errors that happend while received packets per second.
35 rxdrop - Number of packets that were dropped per second.
36 rxfifo - Number of FIFO overruns that happend on received packets per second.
37 rxframe - Number of carrier errors that happend on received packets per second.
38 rxcompr - Number of compressed packets received per second.
39 rxmulti - Number of multicast packets received per second.
40 txbyt - Number of bytes transmitted per second.
41 txpcks - Number of packets transmitted per second.
42 txerrs - Number of errors that happend while transmitting packets per second.
43 txdrop - Number of packets that were dropped per second.
44 txfifo - Number of FIFO overruns that happend on transmitted packets per second.
45 txcolls - Number of collisions that were detected per second.
46 txcarr - Number of carrier errors that happend on transmitted packets per second.
47 txcompr - Number of compressed packets transmitted per second.
48 ttpcks - Number of total packets (received + transmitted) per second.
49 ttbyt - Number of total bytes (received + transmitted) per second.
50
52 new()
53 Call new() to create a new object.
54
55 my $lxs = Sys::Statistics::Linux::NetStats->new;
56
57 Maybe you want to store/load the initial statistics to/from a file:
58
59 my $lxs = Sys::Statistics::Linux::NetStats->new(initfile => '/tmp/netstats.yml');
60
61 If you set "initfile" it's not necessary to call sleep before get().
62
63 It's also possible to set the path to the proc filesystem.
64
65 Sys::Statistics::Linux::NetStats->new(
66 files => {
67 # This is the default
68 path => '/proc',
69 netdev => 'net/dev',
70 }
71 );
72
73 init()
74 Call init() to initialize the statistics.
75
76 $lxs->init;
77
78 get()
79 Call get() to get the statistics. get() returns the statistics as a
80 hash reference.
81
82 my $stat = $lxs->get;
83
84 raw()
85 The same as get_raw() but it's not necessary to call init() first.
86
87 get_raw()
88 Call get_raw() to get the raw data - no deltas.
89
91 No exports.
92
94 proc(5)
95
97 Please report all bugs to <jschulz.cpan(at)bloonix.de>.
98
100 Jonny Schulz <jschulz.cpan(at)bloonix.de>.
101
103 Copyright (c) 2006, 2007 by Jonny Schulz. All rights reserved.
104
105 This program is free software; you can redistribute it and/or modify it
106 under the same terms as Perl itself.
107
108
109
110perl v5.38.0 2023-07-S2y1s::Statistics::Linux::NetStats(3pm)