Merge branch 'master' into v4.0
This commit is contained in:
commit
d7773a87b8
7
.github/workflows/build.yml
vendored
7
.github/workflows/build.yml
vendored
|
@ -1,6 +1,11 @@
|
||||||
name: Build Go binaries
|
name: Build Go binaries
|
||||||
|
|
||||||
on: push
|
on:
|
||||||
|
push:
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/release.svg'
|
||||||
|
- 'README.md'
|
||||||
|
- 'CHANGELOG.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
18
.github/workflows/release.yml
vendored
18
.github/workflows/release.yml
vendored
|
@ -36,3 +36,21 @@ jobs:
|
||||||
token: ${{ secrets.homebrew }}
|
token: ${{ secrets.homebrew }}
|
||||||
formula: gotop
|
formula: gotop
|
||||||
revision: ${{ steps.tag_name.outputs.tag }}
|
revision: ${{ steps.tag_name.outputs.tag }}
|
||||||
|
|
||||||
|
- name: Update current release badge
|
||||||
|
shell: bash
|
||||||
|
run: sed -i "s/v[0-9]*\.[0-9]*\.[0-9]*/${{steps.tag_name.outputs.tag}}/g" docs/release.svg
|
||||||
|
|
||||||
|
- name: Commit current release badge
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v4.1.0
|
||||||
|
with:
|
||||||
|
branch: 'master'
|
||||||
|
commit_message: Update release badge to version "${{ steps.tag_name.outputs.tag }}"
|
||||||
|
|
||||||
|
# Optional glob pattern of files which should be added to the commit
|
||||||
|
file_pattern: docs/release.svg
|
||||||
|
|
||||||
|
# Optional commit user and author settings
|
||||||
|
commit_user_name: Badge Updater
|
||||||
|
commit_user_email: ser@ser1.net
|
||||||
|
commit_author: Badge Updater <ser@ser1.net>
|
||||||
|
|
|
@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Adds ability to write out a configuration file
|
- Adds ability to write out a configuration file
|
||||||
- Adds a command for specifying the configuration file to use
|
- Adds a command for specifying the configuration file to use
|
||||||
- Merged cmatsuoka's console font contribution
|
- Merged cmatsuoka's console font contribution
|
||||||
|
- Added contribution from @wcdawn for building on machines w/ no Go/root access
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -40,6 +41,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Extensions are now built with a build tool; this is an interim solution until issues with the Go plugin API are resolved.
|
- Extensions are now built with a build tool; this is an interim solution until issues with the Go plugin API are resolved.
|
||||||
- Command line help text is cleaned up.
|
- Command line help text is cleaned up.
|
||||||
- Version bump of gopsutil
|
- Version bump of gopsutil
|
||||||
|
- Prometheus client replaced by [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics). This eliminated 6 indirect package dependencies and saved 3.5MB (25%) of the compiled binary size.
|
||||||
|
- Relicensed to MIT-3
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|
690
LICENSE
690
LICENSE
|
@ -1,661 +1,29 @@
|
||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
The MIT License (MIT)
|
||||||
Version 3, 19 November 2007
|
|
||||||
|
Copyright (c) 2020 Sean E. Russell <ser@ser1.net> 87651D71
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Redistribution and use in source and binary forms, with or without
|
||||||
of this license document, but changing it is not allowed.
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
Preamble
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
The GNU Affero General Public License is a free, copyleft license for
|
|
||||||
software and other kinds of works, specifically designed to ensure
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
cooperation with the community in the case of network server software.
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
The licenses for most software and other practical works are designed
|
|
||||||
to take away your freedom to share and change the works. By contrast,
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
our General Public Licenses are intended to guarantee your freedom to
|
contributors may be used to endorse or promote products derived from this
|
||||||
share and change all versions of a program--to make sure it remains free
|
software without specific prior written permission.
|
||||||
software for all its users.
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
When we speak of free software, we are referring to freedom, not
|
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
have the freedom to distribute copies of free software (and charge for
|
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||||
them if you wish), that you receive source code or can get it if you
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
want it, that you can change the software or use pieces of it in new
|
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
free programs, and that you know you can do these things.
|
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
Developers that use our General Public Licenses protect your rights
|
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
with two steps: (1) assert copyright on the software, and (2) offer
|
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
you this License which gives you legal permission to copy, distribute
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
and/or modify the software.
|
|
||||||
|
|
||||||
A secondary benefit of defending all users' freedom is that
|
|
||||||
improvements made in alternate versions of the program, if they
|
|
||||||
receive widespread use, become available for other developers to
|
|
||||||
incorporate. Many developers of free software are heartened and
|
|
||||||
encouraged by the resulting cooperation. However, in the case of
|
|
||||||
software used on network servers, this result may fail to come about.
|
|
||||||
The GNU General Public License permits making a modified version and
|
|
||||||
letting the public access it on a server without ever releasing its
|
|
||||||
source code to the public.
|
|
||||||
|
|
||||||
The GNU Affero General Public License is designed specifically to
|
|
||||||
ensure that, in such cases, the modified source code becomes available
|
|
||||||
to the community. It requires the operator of a network server to
|
|
||||||
provide the source code of the modified version running there to the
|
|
||||||
users of that server. Therefore, public use of a modified version, on
|
|
||||||
a publicly accessible server, gives the public access to the source
|
|
||||||
code of the modified version.
|
|
||||||
|
|
||||||
An older license, called the Affero General Public License and
|
|
||||||
published by Affero, was designed to accomplish similar goals. This is
|
|
||||||
a different license, not a version of the Affero GPL, but Affero has
|
|
||||||
released a new version of the Affero GPL which permits relicensing under
|
|
||||||
this license.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
|
||||||
works, such as semiconductor masks.
|
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
|
||||||
"recipients" may be individuals or organizations.
|
|
||||||
|
|
||||||
To "modify" a work means to copy from or adapt all or part of the work
|
|
||||||
in a fashion requiring copyright permission, other than the making of an
|
|
||||||
exact copy. The resulting work is called a "modified version" of the
|
|
||||||
earlier work or a work "based on" the earlier work.
|
|
||||||
|
|
||||||
A "covered work" means either the unmodified Program or a work based
|
|
||||||
on the Program.
|
|
||||||
|
|
||||||
To "propagate" a work means to do anything with it that, without
|
|
||||||
permission, would make you directly or secondarily liable for
|
|
||||||
infringement under applicable copyright law, except executing it on a
|
|
||||||
computer or modifying a private copy. Propagation includes copying,
|
|
||||||
distribution (with or without modification), making available to the
|
|
||||||
public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To "convey" a work means any kind of propagation that enables other
|
|
||||||
parties to make or receive copies. Mere interaction with a user through
|
|
||||||
a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays "Appropriate Legal Notices"
|
|
||||||
to the extent that it includes a convenient and prominently visible
|
|
||||||
feature that (1) displays an appropriate copyright notice, and (2)
|
|
||||||
tells the user that there is no warranty for the work (except to the
|
|
||||||
extent that warranties are provided), that licensees may convey the
|
|
||||||
work under this License, and how to view a copy of this License. If
|
|
||||||
the interface presents a list of user commands or options, such as a
|
|
||||||
menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
|
|
||||||
The "source code" for a work means the preferred form of the work
|
|
||||||
for making modifications to it. "Object code" means any non-source
|
|
||||||
form of a work.
|
|
||||||
|
|
||||||
A "Standard Interface" means an interface that either is an official
|
|
||||||
standard defined by a recognized standards body, or, in the case of
|
|
||||||
interfaces specified for a particular programming language, one that
|
|
||||||
is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The "System Libraries" of an executable work include anything, other
|
|
||||||
than the work as a whole, that (a) is included in the normal form of
|
|
||||||
packaging a Major Component, but which is not part of that Major
|
|
||||||
Component, and (b) serves only to enable use of the work with that
|
|
||||||
Major Component, or to implement a Standard Interface for which an
|
|
||||||
implementation is available to the public in source code form. A
|
|
||||||
"Major Component", in this context, means a major essential component
|
|
||||||
(kernel, window system, and so on) of the specific operating system
|
|
||||||
(if any) on which the executable work runs, or a compiler used to
|
|
||||||
produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The "Corresponding Source" for a work in object code form means all
|
|
||||||
the source code needed to generate, install, and (for an executable
|
|
||||||
work) run the object code and to modify the work, including scripts to
|
|
||||||
control those activities. However, it does not include the work's
|
|
||||||
System Libraries, or general-purpose tools or generally available free
|
|
||||||
programs which are used unmodified in performing those activities but
|
|
||||||
which are not part of the work. For example, Corresponding Source
|
|
||||||
includes interface definition files associated with source files for
|
|
||||||
the work, and the source code for shared libraries and dynamically
|
|
||||||
linked subprograms that the work is specifically designed to require,
|
|
||||||
such as by intimate data communication or control flow between those
|
|
||||||
subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users
|
|
||||||
can regenerate automatically from other parts of the Corresponding
|
|
||||||
Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that
|
|
||||||
same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
|
|
||||||
All rights granted under this License are granted for the term of
|
|
||||||
copyright on the Program, and are irrevocable provided the stated
|
|
||||||
conditions are met. This License explicitly affirms your unlimited
|
|
||||||
permission to run the unmodified Program. The output from running a
|
|
||||||
covered work is covered by this License only if the output, given its
|
|
||||||
content, constitutes a covered work. This License acknowledges your
|
|
||||||
rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not
|
|
||||||
convey, without conditions so long as your license otherwise remains
|
|
||||||
in force. You may convey covered works to others for the sole purpose
|
|
||||||
of having them make modifications exclusively for you, or provide you
|
|
||||||
with facilities for running those works, provided that you comply with
|
|
||||||
the terms of this License in conveying all material for which you do
|
|
||||||
not control copyright. Those thus making or running the covered works
|
|
||||||
for you must do so exclusively on your behalf, under your direction
|
|
||||||
and control, on terms that prohibit them from making any copies of
|
|
||||||
your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under
|
|
||||||
the conditions stated below. Sublicensing is not allowed; section 10
|
|
||||||
makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
|
|
||||||
No covered work shall be deemed part of an effective technological
|
|
||||||
measure under any applicable law fulfilling obligations under article
|
|
||||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
|
||||||
similar laws prohibiting or restricting circumvention of such
|
|
||||||
measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid
|
|
||||||
circumvention of technological measures to the extent such circumvention
|
|
||||||
is effected by exercising rights under this License with respect to
|
|
||||||
the covered work, and you disclaim any intention to limit operation or
|
|
||||||
modification of the work as a means of enforcing, against the work's
|
|
||||||
users, your or third parties' legal rights to forbid circumvention of
|
|
||||||
technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
|
|
||||||
You may convey verbatim copies of the Program's source code as you
|
|
||||||
receive it, in any medium, provided that you conspicuously and
|
|
||||||
appropriately publish on each copy an appropriate copyright notice;
|
|
||||||
keep intact all notices stating that this License and any
|
|
||||||
non-permissive terms added in accord with section 7 apply to the code;
|
|
||||||
keep intact all notices of the absence of any warranty; and give all
|
|
||||||
recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey,
|
|
||||||
and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
|
|
||||||
You may convey a work based on the Program, or the modifications to
|
|
||||||
produce it from the Program, in the form of source code under the
|
|
||||||
terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified
|
|
||||||
it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is
|
|
||||||
released under this License and any conditions added under section
|
|
||||||
7. This requirement modifies the requirement in section 4 to
|
|
||||||
"keep intact all notices".
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this
|
|
||||||
License to anyone who comes into possession of a copy. This
|
|
||||||
License will therefore apply, along with any applicable section 7
|
|
||||||
additional terms, to the whole of the work, and all its parts,
|
|
||||||
regardless of how they are packaged. This License gives no
|
|
||||||
permission to license the work in any other way, but it does not
|
|
||||||
invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display
|
|
||||||
Appropriate Legal Notices; however, if the Program has interactive
|
|
||||||
interfaces that do not display Appropriate Legal Notices, your
|
|
||||||
work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent
|
|
||||||
works, which are not by their nature extensions of the covered work,
|
|
||||||
and which are not combined with it such as to form a larger program,
|
|
||||||
in or on a volume of a storage or distribution medium, is called an
|
|
||||||
"aggregate" if the compilation and its resulting copyright are not
|
|
||||||
used to limit the access or legal rights of the compilation's users
|
|
||||||
beyond what the individual works permit. Inclusion of a covered work
|
|
||||||
in an aggregate does not cause this License to apply to the other
|
|
||||||
parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
|
|
||||||
You may convey a covered work in object code form under the terms
|
|
||||||
of sections 4 and 5, provided that you also convey the
|
|
||||||
machine-readable Corresponding Source under the terms of this License,
|
|
||||||
in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by the
|
|
||||||
Corresponding Source fixed on a durable physical medium
|
|
||||||
customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product
|
|
||||||
(including a physical distribution medium), accompanied by a
|
|
||||||
written offer, valid for at least three years and valid for as
|
|
||||||
long as you offer spare parts or customer support for that product
|
|
||||||
model, to give anyone who possesses the object code either (1) a
|
|
||||||
copy of the Corresponding Source for all the software in the
|
|
||||||
product that is covered by this License, on a durable physical
|
|
||||||
medium customarily used for software interchange, for a price no
|
|
||||||
more than your reasonable cost of physically performing this
|
|
||||||
conveying of source, or (2) access to copy the
|
|
||||||
Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the
|
|
||||||
written offer to provide the Corresponding Source. This
|
|
||||||
alternative is allowed only occasionally and noncommercially, and
|
|
||||||
only if you received the object code with such an offer, in accord
|
|
||||||
with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated
|
|
||||||
place (gratis or for a charge), and offer equivalent access to the
|
|
||||||
Corresponding Source in the same way through the same place at no
|
|
||||||
further charge. You need not require recipients to copy the
|
|
||||||
Corresponding Source along with the object code. If the place to
|
|
||||||
copy the object code is a network server, the Corresponding Source
|
|
||||||
may be on a different server (operated by you or a third party)
|
|
||||||
that supports equivalent copying facilities, provided you maintain
|
|
||||||
clear directions next to the object code saying where to find the
|
|
||||||
Corresponding Source. Regardless of what server hosts the
|
|
||||||
Corresponding Source, you remain obligated to ensure that it is
|
|
||||||
available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided
|
|
||||||
you inform other peers where the object code and Corresponding
|
|
||||||
Source of the work are being offered to the general public at no
|
|
||||||
charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded
|
|
||||||
from the Corresponding Source as a System Library, need not be
|
|
||||||
included in conveying the object code work.
|
|
||||||
|
|
||||||
A "User Product" is either (1) a "consumer product", which means any
|
|
||||||
tangible personal property which is normally used for personal, family,
|
|
||||||
or household purposes, or (2) anything designed or sold for incorporation
|
|
||||||
into a dwelling. In determining whether a product is a consumer product,
|
|
||||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
|
||||||
product received by a particular user, "normally used" refers to a
|
|
||||||
typical or common use of that class of product, regardless of the status
|
|
||||||
of the particular user or of the way in which the particular user
|
|
||||||
actually uses, or expects or is expected to use, the product. A product
|
|
||||||
is a consumer product regardless of whether the product has substantial
|
|
||||||
commercial, industrial or non-consumer uses, unless such uses represent
|
|
||||||
the only significant mode of use of the product.
|
|
||||||
|
|
||||||
"Installation Information" for a User Product means any methods,
|
|
||||||
procedures, authorization keys, or other information required to install
|
|
||||||
and execute modified versions of a covered work in that User Product from
|
|
||||||
a modified version of its Corresponding Source. The information must
|
|
||||||
suffice to ensure that the continued functioning of the modified object
|
|
||||||
code is in no case prevented or interfered with solely because
|
|
||||||
modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or
|
|
||||||
specifically for use in, a User Product, and the conveying occurs as
|
|
||||||
part of a transaction in which the right of possession and use of the
|
|
||||||
User Product is transferred to the recipient in perpetuity or for a
|
|
||||||
fixed term (regardless of how the transaction is characterized), the
|
|
||||||
Corresponding Source conveyed under this section must be accompanied
|
|
||||||
by the Installation Information. But this requirement does not apply
|
|
||||||
if neither you nor any third party retains the ability to install
|
|
||||||
modified object code on the User Product (for example, the work has
|
|
||||||
been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a
|
|
||||||
requirement to continue to provide support service, warranty, or updates
|
|
||||||
for a work that has been modified or installed by the recipient, or for
|
|
||||||
the User Product in which it has been modified or installed. Access to a
|
|
||||||
network may be denied when the modification itself materially and
|
|
||||||
adversely affects the operation of the network or violates the rules and
|
|
||||||
protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided,
|
|
||||||
in accord with this section must be in a format that is publicly
|
|
||||||
documented (and with an implementation available to the public in
|
|
||||||
source code form), and must require no special password or key for
|
|
||||||
unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
|
|
||||||
"Additional permissions" are terms that supplement the terms of this
|
|
||||||
License by making exceptions from one or more of its conditions.
|
|
||||||
Additional permissions that are applicable to the entire Program shall
|
|
||||||
be treated as though they were included in this License, to the extent
|
|
||||||
that they are valid under applicable law. If additional permissions
|
|
||||||
apply only to part of the Program, that part may be used separately
|
|
||||||
under those permissions, but the entire Program remains governed by
|
|
||||||
this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option
|
|
||||||
remove any additional permissions from that copy, or from any part of
|
|
||||||
it. (Additional permissions may be written to require their own
|
|
||||||
removal in certain cases when you modify the work.) You may place
|
|
||||||
additional permissions on material, added by you to a covered work,
|
|
||||||
for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you
|
|
||||||
add to a covered work, you may (if authorized by the copyright holders of
|
|
||||||
that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the
|
|
||||||
terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or
|
|
||||||
author attributions in that material or in the Appropriate Legal
|
|
||||||
Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or
|
|
||||||
requiring that modified versions of such material be marked in
|
|
||||||
reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or
|
|
||||||
authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some
|
|
||||||
trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that
|
|
||||||
material by anyone who conveys the material (or modified versions of
|
|
||||||
it) with contractual assumptions of liability to the recipient, for
|
|
||||||
any liability that these contractual assumptions directly impose on
|
|
||||||
those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered "further
|
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
|
||||||
received it, or any part of it, contains a notice stating that it is
|
|
||||||
governed by this License along with a term that is a further
|
|
||||||
restriction, you may remove that term. If a license document contains
|
|
||||||
a further restriction but permits relicensing or conveying under this
|
|
||||||
License, you may add to a covered work material governed by the terms
|
|
||||||
of that license document, provided that the further restriction does
|
|
||||||
not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
|
||||||
must place, in the relevant source files, a statement of the
|
|
||||||
additional terms that apply to those files, or a notice indicating
|
|
||||||
where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the
|
|
||||||
form of a separately written license, or stated as exceptions;
|
|
||||||
the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
|
|
||||||
You may not propagate or modify a covered work except as expressly
|
|
||||||
provided under this License. Any attempt otherwise to propagate or
|
|
||||||
modify it is void, and will automatically terminate your rights under
|
|
||||||
this License (including any patent licenses granted under the third
|
|
||||||
paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your
|
|
||||||
license from a particular copyright holder is reinstated (a)
|
|
||||||
provisionally, unless and until the copyright holder explicitly and
|
|
||||||
finally terminates your license, and (b) permanently, if the copyright
|
|
||||||
holder fails to notify you of the violation by some reasonable means
|
|
||||||
prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is
|
|
||||||
reinstated permanently if the copyright holder notifies you of the
|
|
||||||
violation by some reasonable means, this is the first time you have
|
|
||||||
received notice of violation of this License (for any work) from that
|
|
||||||
copyright holder, and you cure the violation prior to 30 days after
|
|
||||||
your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the
|
|
||||||
licenses of parties who have received copies or rights from you under
|
|
||||||
this License. If your rights have been terminated and not permanently
|
|
||||||
reinstated, you do not qualify to receive new licenses for the same
|
|
||||||
material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
|
|
||||||
You are not required to accept this License in order to receive or
|
|
||||||
run a copy of the Program. Ancillary propagation of a covered work
|
|
||||||
occurring solely as a consequence of using peer-to-peer transmission
|
|
||||||
to receive a copy likewise does not require acceptance. However,
|
|
||||||
nothing other than this License grants you permission to propagate or
|
|
||||||
modify any covered work. These actions infringe copyright if you do
|
|
||||||
not accept this License. Therefore, by modifying or propagating a
|
|
||||||
covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
|
|
||||||
Each time you convey a covered work, the recipient automatically
|
|
||||||
receives a license from the original licensors, to run, modify and
|
|
||||||
propagate that work, subject to this License. You are not responsible
|
|
||||||
for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An "entity transaction" is a transaction transferring control of an
|
|
||||||
organization, or substantially all assets of one, or subdividing an
|
|
||||||
organization, or merging organizations. If propagation of a covered
|
|
||||||
work results from an entity transaction, each party to that
|
|
||||||
transaction who receives a copy of the work also receives whatever
|
|
||||||
licenses to the work the party's predecessor in interest had or could
|
|
||||||
give under the previous paragraph, plus a right to possession of the
|
|
||||||
Corresponding Source of the work from the predecessor in interest, if
|
|
||||||
the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the
|
|
||||||
rights granted or affirmed under this License. For example, you may
|
|
||||||
not impose a license fee, royalty, or other charge for exercise of
|
|
||||||
rights granted under this License, and you may not initiate litigation
|
|
||||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
||||||
any patent claim is infringed by making, using, selling, offering for
|
|
||||||
sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
|
|
||||||
A "contributor" is a copyright holder who authorizes use under this
|
|
||||||
License of the Program or a work on which the Program is based. The
|
|
||||||
work thus licensed is called the contributor's "contributor version".
|
|
||||||
|
|
||||||
A contributor's "essential patent claims" are all patent claims
|
|
||||||
owned or controlled by the contributor, whether already acquired or
|
|
||||||
hereafter acquired, that would be infringed by some manner, permitted
|
|
||||||
by this License, of making, using, or selling its contributor version,
|
|
||||||
but do not include claims that would be infringed only as a
|
|
||||||
consequence of further modification of the contributor version. For
|
|
||||||
purposes of this definition, "control" includes the right to grant
|
|
||||||
patent sublicenses in a manner consistent with the requirements of
|
|
||||||
this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
|
||||||
patent license under the contributor's essential patent claims, to
|
|
||||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
|
||||||
propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a "patent license" is any express
|
|
||||||
agreement or commitment, however denominated, not to enforce a patent
|
|
||||||
(such as an express permission to practice a patent or covenant not to
|
|
||||||
sue for patent infringement). To "grant" such a patent license to a
|
|
||||||
party means to make such an agreement or commitment not to enforce a
|
|
||||||
patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license,
|
|
||||||
and the Corresponding Source of the work is not available for anyone
|
|
||||||
to copy, free of charge and under the terms of this License, through a
|
|
||||||
publicly available network server or other readily accessible means,
|
|
||||||
then you must either (1) cause the Corresponding Source to be so
|
|
||||||
available, or (2) arrange to deprive yourself of the benefit of the
|
|
||||||
patent license for this particular work, or (3) arrange, in a manner
|
|
||||||
consistent with the requirements of this License, to extend the patent
|
|
||||||
license to downstream recipients. "Knowingly relying" means you have
|
|
||||||
actual knowledge that, but for the patent license, your conveying the
|
|
||||||
covered work in a country, or your recipient's use of the covered work
|
|
||||||
in a country, would infringe one or more identifiable patents in that
|
|
||||||
country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or
|
|
||||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
|
||||||
covered work, and grant a patent license to some of the parties
|
|
||||||
receiving the covered work authorizing them to use, propagate, modify
|
|
||||||
or convey a specific copy of the covered work, then the patent license
|
|
||||||
you grant is automatically extended to all recipients of the covered
|
|
||||||
work and works based on it.
|
|
||||||
|
|
||||||
A patent license is "discriminatory" if it does not include within
|
|
||||||
the scope of its coverage, prohibits the exercise of, or is
|
|
||||||
conditioned on the non-exercise of one or more of the rights that are
|
|
||||||
specifically granted under this License. You may not convey a covered
|
|
||||||
work if you are a party to an arrangement with a third party that is
|
|
||||||
in the business of distributing software, under which you make payment
|
|
||||||
to the third party based on the extent of your activity of conveying
|
|
||||||
the work, and under which the third party grants, to any of the
|
|
||||||
parties who would receive the covered work from you, a discriminatory
|
|
||||||
patent license (a) in connection with copies of the covered work
|
|
||||||
conveyed by you (or copies made from those copies), or (b) primarily
|
|
||||||
for and in connection with specific products or compilations that
|
|
||||||
contain the covered work, unless you entered into that arrangement,
|
|
||||||
or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting
|
|
||||||
any implied license or other defenses to infringement that may
|
|
||||||
otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot convey a
|
|
||||||
covered work so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you may
|
|
||||||
not convey it at all. For example, if you agree to terms that obligate you
|
|
||||||
to collect a royalty for further conveying from those to whom you convey
|
|
||||||
the Program, the only way you could satisfy both those terms and this
|
|
||||||
License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, if you modify the
|
|
||||||
Program, your modified version must prominently offer all users
|
|
||||||
interacting with it remotely through a computer network (if your version
|
|
||||||
supports such interaction) an opportunity to receive the Corresponding
|
|
||||||
Source of your version by providing access to the Corresponding Source
|
|
||||||
from a network server at no charge, through some standard or customary
|
|
||||||
means of facilitating copying of software. This Corresponding Source
|
|
||||||
shall include the Corresponding Source for any work covered by version 3
|
|
||||||
of the GNU General Public License that is incorporated pursuant to the
|
|
||||||
following paragraph.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have
|
|
||||||
permission to link or combine any covered work with a work licensed
|
|
||||||
under version 3 of the GNU General Public License into a single
|
|
||||||
combined work, and to convey the resulting work. The terms of this
|
|
||||||
License will continue to apply to the part which is the covered work,
|
|
||||||
but the work with which it is combined will remain governed by version
|
|
||||||
3 of the GNU General Public License.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
|
||||||
the GNU Affero General Public License from time to time. Such new versions
|
|
||||||
will be similar in spirit to the present version, but may differ in detail to
|
|
||||||
address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
|
||||||
Program specifies that a certain numbered version of the GNU Affero General
|
|
||||||
Public License "or any later version" applies to it, you have the
|
|
||||||
option of following the terms and conditions either of that numbered
|
|
||||||
version or of any later version published by the Free Software
|
|
||||||
Foundation. If the Program does not specify a version number of the
|
|
||||||
GNU Affero General Public License, you may choose any version ever published
|
|
||||||
by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
|
||||||
versions of the GNU Affero General Public License can be used, that proxy's
|
|
||||||
public statement of acceptance of a version permanently authorizes you
|
|
||||||
to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
|
||||||
permissions. However, no additional obligations are imposed on any
|
|
||||||
author or copyright holder as a result of your choosing to follow a
|
|
||||||
later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
|
||||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
|
||||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
|
||||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
|
||||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
|
||||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
|
||||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
|
||||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
|
||||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
|
||||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
|
||||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
|
||||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
|
||||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
|
||||||
SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
|
|
||||||
If the disclaimer of warranty and limitation of liability provided
|
|
||||||
above cannot be given local legal effect according to their terms,
|
|
||||||
reviewing courts shall apply local law that most closely approximates
|
|
||||||
an absolute waiver of all civil liability in connection with the
|
|
||||||
Program, unless a warranty or assumption of liability accompanies a
|
|
||||||
copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
|
||||||
possible use to the public, the best way to achieve this is to make it
|
|
||||||
free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest
|
|
||||||
to attach them to the start of each source file to most effectively
|
|
||||||
state the exclusion of warranty; and each file should have at least
|
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU Affero General Public License as published
|
|
||||||
by the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU Affero General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If your software can interact with users remotely through a computer
|
|
||||||
network, you should also make sure that it provides a way for users to
|
|
||||||
get its source. For example, if your program is a web application, its
|
|
||||||
interface could display a "Source" link that leads users to an archive
|
|
||||||
of the code. There are many ways you could offer source, and different
|
|
||||||
solutions will be better for different programs; see section 13 for the
|
|
||||||
specific requirements.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school,
|
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
|
||||||
<http://www.gnu.org/licenses/>.
|
|
||||||
|
|
14
README.md
14
README.md
|
@ -9,6 +9,14 @@ Another terminal based graphical activity monitor, inspired by [gtop](https://gi
|
||||||
|
|
||||||
Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([matrix clients](https://matrix.to/#/#gotop:matrix.org)).
|
Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([matrix clients](https://matrix.to/#/#gotop:matrix.org)).
|
||||||
|
|
||||||
|
![](https://github.com/xxxserxxx/gotop/workflows/Build%20Go%20binaries/badge.svg)
|
||||||
|
![](https://github.com/xxxserxxx/gotop/workflows/Create%20pre-release/badge.svg)
|
||||||
|
|
||||||
|
![](https://raw.githubusercontent.com/xxxserxxx/gotop/master/docs/release.svg)
|
||||||
|
|
||||||
|
See the [mini-blog](/xxxserxxx/gotop/wiki/blog) for updates on the build status, and the [change log](/xxxserxxx/gotop/blob/master/CHANGELOG.md) for release updates.
|
||||||
|
|
||||||
|
|
||||||
<img src="./assets/screenshots/demo.gif" />
|
<img src="./assets/screenshots/demo.gif" />
|
||||||
<img src="./assets/screenshots/kitchensink.gif" />
|
<img src="./assets/screenshots/kitchensink.gif" />
|
||||||
|
|
||||||
|
@ -16,9 +24,6 @@ Join us in [\#gotop:matrix.org](https://riot.im/app/#/room/#gotop:matrix.org) ([
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
![](https://github.com/xxxserxxx/gotop/workflows/Build%20Go%20binaries/badge.svg)
|
|
||||||
![](https://github.com/xxxserxxx/gotop/workflows/Create%20pre-release/badge.svg)
|
|
||||||
|
|
||||||
Working and tested on Linux, FreeBSD and MacOS. Windows binaries are provided, but have limited testing. OpenBSD works with some caveats; cross-compiling is difficult and binaries are not provided.
|
Working and tested on Linux, FreeBSD and MacOS. Windows binaries are provided, but have limited testing. OpenBSD works with some caveats; cross-compiling is difficult and binaries are not provided.
|
||||||
|
|
||||||
If you install gotop by hand, or you download or create new layouts or colorschemes, you will need to put the layout files where gotop can find them. To see the list of directories gotop looks for files, run `gotop -h`. The first directory is always the directory from which gotop is run.
|
If you install gotop by hand, or you download or create new layouts or colorschemes, you will need to put the layout files where gotop can find them. To see the list of directories gotop looks for files, run `gotop -h`. The first directory is always the directory from which gotop is run.
|
||||||
|
@ -57,6 +62,8 @@ go build -o gotop ./cmd/gotop
|
||||||
|
|
||||||
Move `gotop` to somewhere in your `$PATH`.
|
Move `gotop` to somewhere in your `$PATH`.
|
||||||
|
|
||||||
|
If Go is not installed or is the wrong version, and you don't have root access or don't want to upgrade Go, a script is provided to download Go and the gotop sources, compile gotop, and then clean up. See `scripts/install_without_root.sh`.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Run with `-h` to get an extensive list of command line arguments. Many of these can be configured by creating a configuration file; see the next section for more information. Key bindings can be viewed while gotop is running by pressing the `?` key, or they can be printed out by using the `--list keys` command.
|
Run with `-h` to get an extensive list of command line arguments. Many of these can be configured by creating a configuration file; see the next section for more information. Key bindings can be viewed while gotop is running by pressing the `?` key, or they can be printed out by using the `--list keys` command.
|
||||||
|
@ -229,6 +236,7 @@ Run `gotop -h` to see the list of all command line options.
|
||||||
- [shirou/gopsutil](https://github.com/shirou/gopsutil)
|
- [shirou/gopsutil](https://github.com/shirou/gopsutil)
|
||||||
- [goreleaser/nfpm](https://github.com/goreleaser/nfpm)
|
- [goreleaser/nfpm](https://github.com/goreleaser/nfpm)
|
||||||
- [distatus/battery](https://github.com/distatus/battery)
|
- [distatus/battery](https://github.com/distatus/battery)
|
||||||
|
- [VictoriaMetrics/metrics](https://github.com/VictoriaMetrics/metrics) Check this out! The API is clean, elegant, introduces many fewer indirect dependencies than the Prometheus client, and adds 50% less size to binaries.
|
||||||
|
|
||||||
## History
|
## History
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ import (
|
||||||
|
|
||||||
//_ "net/http/pprof"
|
//_ "net/http/pprof"
|
||||||
|
|
||||||
|
"github.com/VictoriaMetrics/metrics"
|
||||||
ui "github.com/gizak/termui/v3"
|
ui "github.com/gizak/termui/v3"
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
||||||
"github.com/shibukawa/configdir"
|
"github.com/shibukawa/configdir"
|
||||||
"github.com/xxxserxxx/opflag"
|
"github.com/xxxserxxx/opflag"
|
||||||
|
|
||||||
|
@ -72,8 +72,6 @@ func parseArgs() error {
|
||||||
opflag.StringVarP(&conf.NetInterface, "interface", "i", "all", "Select network interface. Several interfaces can be defined using comma separated values. Interfaces can also be ignored using `!`")
|
opflag.StringVarP(&conf.NetInterface, "interface", "i", "all", "Select network interface. Several interfaces can be defined using comma separated values. Interfaces can also be ignored using `!`")
|
||||||
opflag.StringVarP(&conf.ExportPort, "export", "x", conf.ExportPort, "Enable metrics for export on the specified port.")
|
opflag.StringVarP(&conf.ExportPort, "export", "x", conf.ExportPort, "Enable metrics for export on the specified port.")
|
||||||
opflag.BoolVarP(&conf.Mbps, "mbps", "", conf.Mbps, "Show network rate as mbps.")
|
opflag.BoolVarP(&conf.Mbps, "mbps", "", conf.Mbps, "Show network rate as mbps.")
|
||||||
// FIXME Where did this go??
|
|
||||||
//conf.Band = opflag.IntP("bandwidth", "B", 100, "Specify the number of bits per seconds.")
|
|
||||||
opflag.BoolVar(&conf.Test, "test", conf.Test, "Runs tests and exits with success/failure code.")
|
opflag.BoolVar(&conf.Test, "test", conf.Test, "Runs tests and exits with success/failure code.")
|
||||||
opflag.StringP("", "C", "", "Config file to use instead of default (MUST BE FIRST ARGUMENT)")
|
opflag.StringP("", "C", "", "Config file to use instead of default (MUST BE FIRST ARGUMENT)")
|
||||||
list := opflag.String("list", "", `List <devices|layouts|colorschemes|paths|keys>
|
list := opflag.String("list", "", `List <devices|layouts|colorschemes|paths|keys>
|
||||||
|
@ -437,7 +435,9 @@ func run() int {
|
||||||
|
|
||||||
if conf.ExportPort != "" {
|
if conf.ExportPort != "" {
|
||||||
go func() {
|
go func() {
|
||||||
http.Handle("/metrics", promhttp.Handler())
|
http.HandleFunc("/metrics", func(w http.ResponseWriter, req *http.Request) {
|
||||||
|
metrics.WritePrometheus(w, true)
|
||||||
|
})
|
||||||
http.ListenAndServe(conf.ExportPort, nil)
|
http.ListenAndServe(conf.ExportPort, nil)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package devices
|
package devices
|
||||||
|
|
||||||
|
// TODO: https://github.com/elastic/go-sysinfo
|
||||||
|
// TODO: https://github.com/mackerelio/go-osstat
|
||||||
|
// TODO: https://github.com/akhenakh/statgo
|
||||||
|
// TODO: https://github.com/jaypipes/ghw
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"time"
|
"time"
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// FIXME: broken % under Linux. Doesn't reflect reality *at all*.
|
// FIXME: broken % under Linux. Doesn't reflect reality *at all*.
|
||||||
// FIXME: gotop CPU use high -- gopsutils again? Try rolling back.
|
|
||||||
func init() {
|
func init() {
|
||||||
f := func(cpus map[string]int, l bool) map[string]error {
|
f := func(cpus map[string]int, l bool) map[string]error {
|
||||||
cpuCount, err := psCpu.Counts(l)
|
cpuCount, err := psCpu.Counts(l)
|
||||||
|
|
|
@ -1,700 +0,0 @@
|
||||||
/*
|
|
||||||
* Apple System Management Controller (SMC) API from user space for Intel based
|
|
||||||
* Macs. Works by talking to the AppleSMC.kext (kernel extension), the driver
|
|
||||||
* for the SMC.
|
|
||||||
*
|
|
||||||
* smc.c
|
|
||||||
* libsmc
|
|
||||||
*
|
|
||||||
* Copyright (C) 2014 beltex <https://github.com/beltex>
|
|
||||||
*
|
|
||||||
* Based off of fork from:
|
|
||||||
* osx-cpu-temp <https://github.com/lavoiesl/osx-cpu-temp>
|
|
||||||
*
|
|
||||||
* With credits to:
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006 devnull
|
|
||||||
* Apple System Management Control (SMC) Tool
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006 Hendrik Holtmann
|
|
||||||
* smcFanControl <https://github.com/hholtmann/smcFanControl>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include "smc.h"
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: MACROS
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Name of the SMC IOService as seen in the IORegistry. You can view it either via
|
|
||||||
command line with ioreg or through the IORegistryExplorer app (found on Apple's
|
|
||||||
developer site - Hardware IO Tools for Xcode)
|
|
||||||
*/
|
|
||||||
#define IOSERVICE_SMC "AppleSMC"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
IOService for getting machine model name
|
|
||||||
*/
|
|
||||||
#define IOSERVICE_MODEL "IOPlatformExpertDevice"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
SMC data types - 4 byte multi-character constants
|
|
||||||
|
|
||||||
Sources: See TMP SMC keys in smc.h
|
|
||||||
|
|
||||||
http://stackoverflow.com/questions/22160746/fpe2-and-sp78-data-types
|
|
||||||
*/
|
|
||||||
#define DATA_TYPE_UINT8 "ui8 "
|
|
||||||
#define DATA_TYPE_UINT16 "ui16"
|
|
||||||
#define DATA_TYPE_UINT32 "ui32"
|
|
||||||
#define DATA_TYPE_FLAG "flag"
|
|
||||||
#define DATA_TYPE_FPE2 "fpe2"
|
|
||||||
#define DATA_TYPE_SFDS "{fds"
|
|
||||||
#define DATA_TYPE_SP78 "sp78"
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: GLOBAL VARS
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Our connection to the SMC
|
|
||||||
*/
|
|
||||||
static io_connect_t conn;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Number of characters in an SMC key
|
|
||||||
*/
|
|
||||||
static const int SMC_KEY_SIZE = 4;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Number of characters in a data type "key" returned from the SMC. See data type
|
|
||||||
macros.
|
|
||||||
*/
|
|
||||||
static const int DATA_TYPE_SIZE = 4;
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: ENUMS
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Defined by AppleSMC.kext. See SMCParamStruct.
|
|
||||||
|
|
||||||
These are SMC specific return codes
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
kSMCSuccess = 0,
|
|
||||||
kSMCError = 1,
|
|
||||||
kSMCKeyNotFound = 0x84
|
|
||||||
} kSMC_t;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Defined by AppleSMC.kext. See SMCParamStruct.
|
|
||||||
|
|
||||||
Function selectors. Used to tell the SMC which function inside it to call.
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
kSMCUserClientOpen = 0,
|
|
||||||
kSMCUserClientClose = 1,
|
|
||||||
kSMCHandleYPCEvent = 2,
|
|
||||||
kSMCReadKey = 5,
|
|
||||||
kSMCWriteKey = 6,
|
|
||||||
kSMCGetKeyCount = 7,
|
|
||||||
kSMCGetKeyFromIndex = 8,
|
|
||||||
kSMCGetKeyInfo = 9
|
|
||||||
} selector_t;
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: STRUCTS
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Defined by AppleSMC.kext. See SMCParamStruct.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
unsigned char major;
|
|
||||||
unsigned char minor;
|
|
||||||
unsigned char build;
|
|
||||||
unsigned char reserved;
|
|
||||||
unsigned short release;
|
|
||||||
} SMCVersion;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Defined by AppleSMC.kext. See SMCParamStruct.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
uint16_t version;
|
|
||||||
uint16_t length;
|
|
||||||
uint32_t cpuPLimit;
|
|
||||||
uint32_t gpuPLimit;
|
|
||||||
uint32_t memPLimit;
|
|
||||||
} SMCPLimitData;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Defined by AppleSMC.kext. See SMCParamStruct.
|
|
||||||
|
|
||||||
- dataSize : How many values written to SMCParamStruct.bytes
|
|
||||||
- dataType : Type of data written to SMCParamStruct.bytes. This lets us know how
|
|
||||||
to interpret it (translate it to human readable)
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
IOByteCount dataSize;
|
|
||||||
uint32_t dataType;
|
|
||||||
uint8_t dataColors;
|
|
||||||
} SMCKeyInfoData;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Defined by AppleSMC.kext.
|
|
||||||
|
|
||||||
This is the predefined struct that must be passed to communicate with the
|
|
||||||
AppleSMC driver. While the driver is closed source, the definition of this
|
|
||||||
struct happened to appear in the Apple PowerManagement project at around
|
|
||||||
version 211, and soon after disappeared. It can be seen in the PrivateLib.c
|
|
||||||
file under pmconfigd.
|
|
||||||
|
|
||||||
https://www.opensource.apple.com/source/PowerManagement/PowerManagement-211/
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
uint32_t key;
|
|
||||||
SMCVersion vers;
|
|
||||||
SMCPLimitData pLimitData;
|
|
||||||
SMCKeyInfoData keyInfo;
|
|
||||||
uint8_t result;
|
|
||||||
uint8_t status;
|
|
||||||
uint8_t data8;
|
|
||||||
uint32_t data32;
|
|
||||||
uint8_t bytes[32];
|
|
||||||
} SMCParamStruct;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Used for returning data from the SMC.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
uint8_t data[32];
|
|
||||||
uint32_t dataType;
|
|
||||||
uint32_t dataSize;
|
|
||||||
kSMC_t kSMC;
|
|
||||||
} smc_return_t;
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: HELPERS - TYPE CONVERSION
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert data from SMC of fpe2 type to human readable.
|
|
||||||
|
|
||||||
:param: data Data from the SMC to be converted. Assumed data size of 2.
|
|
||||||
:returns: Converted data
|
|
||||||
*/
|
|
||||||
static unsigned int from_fpe2(uint8_t data[32])
|
|
||||||
{
|
|
||||||
unsigned int ans = 0;
|
|
||||||
|
|
||||||
// Data type for fan calls - fpe2
|
|
||||||
// This is assumend to mean floating point, with 2 exponent bits
|
|
||||||
// http://stackoverflow.com/questions/22160746/fpe2-and-sp78-data-types
|
|
||||||
ans += data[0] << 6;
|
|
||||||
ans += data[1] << 2;
|
|
||||||
|
|
||||||
return ans;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert to fpe2 data type to be passed to SMC.
|
|
||||||
|
|
||||||
:param: val Value to convert
|
|
||||||
:param: data Pointer to data array to place result
|
|
||||||
*/
|
|
||||||
static void to_fpe2(unsigned int val, uint8_t *data)
|
|
||||||
{
|
|
||||||
data[0] = val >> 6;
|
|
||||||
data[1] = (val << 2) ^ (data[0] << 8);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Convert SMC key to uint32_t. This must be done to pass it to the SMC.
|
|
||||||
|
|
||||||
:param: key The SMC key to convert
|
|
||||||
:returns: uint32_t translation.
|
|
||||||
Returns zero if key is not 4 characters in length.
|
|
||||||
*/
|
|
||||||
static uint32_t to_uint32_t(char *key)
|
|
||||||
{
|
|
||||||
uint32_t ans = 0;
|
|
||||||
uint32_t shift = 24;
|
|
||||||
|
|
||||||
// SMC key is expected to be 4 bytes - thus 4 chars
|
|
||||||
if (strlen(key) != SMC_KEY_SIZE) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < SMC_KEY_SIZE; i++) {
|
|
||||||
ans += key[i] << shift;
|
|
||||||
shift -= 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ans;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
For converting the dataType return from the SMC to human readable 4 byte
|
|
||||||
multi-character constant.
|
|
||||||
*/
|
|
||||||
static void to_string(uint32_t val, char *dataType)
|
|
||||||
{
|
|
||||||
int shift = 24;
|
|
||||||
|
|
||||||
for (int i = 0; i < DATA_TYPE_SIZE; i++) {
|
|
||||||
// To get each char, we shift it into the lower 8 bits, and then & by
|
|
||||||
// 255 to insolate it
|
|
||||||
dataType[i] = (val >> shift) & 0xff;
|
|
||||||
shift -= 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: HELPERS - TMP CONVERSION
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Celsius to Fahrenheit
|
|
||||||
*/
|
|
||||||
static double to_fahrenheit(double tmp)
|
|
||||||
{
|
|
||||||
// http://en.wikipedia.org/wiki/Fahrenheit#Definition_and_conversions
|
|
||||||
return (tmp * 1.8) + 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Celsius to Kelvin
|
|
||||||
*/
|
|
||||||
static double to_kelvin(double tmp)
|
|
||||||
{
|
|
||||||
// http://en.wikipedia.org/wiki/Kelvin
|
|
||||||
return tmp + 273.15;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: "PRIVATE" FUNCTIONS
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Make a call to the SMC
|
|
||||||
|
|
||||||
:param: inputStruct Struct that holds data telling the SMC what you want
|
|
||||||
:param: outputStruct Struct holding the SMC's response
|
|
||||||
:returns: I/O Kit return code
|
|
||||||
*/
|
|
||||||
static kern_return_t call_smc(SMCParamStruct *inputStruct,
|
|
||||||
SMCParamStruct *outputStruct)
|
|
||||||
{
|
|
||||||
kern_return_t result;
|
|
||||||
size_t inputStructCnt = sizeof(SMCParamStruct);
|
|
||||||
size_t outputStructCnt = sizeof(SMCParamStruct);
|
|
||||||
|
|
||||||
result = IOConnectCallStructMethod(conn, kSMCHandleYPCEvent,
|
|
||||||
inputStruct,
|
|
||||||
inputStructCnt,
|
|
||||||
outputStruct,
|
|
||||||
&outputStructCnt);
|
|
||||||
|
|
||||||
if (result != kIOReturnSuccess) {
|
|
||||||
// IOReturn error code lookup. See "Accessing Hardware From Applications
|
|
||||||
// -> Handling Errors" Apple doc
|
|
||||||
result = err_get_code(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Read data from the SMC
|
|
||||||
|
|
||||||
:param: key The SMC key
|
|
||||||
*/
|
|
||||||
static kern_return_t read_smc(char *key, smc_return_t *result_smc)
|
|
||||||
{
|
|
||||||
kern_return_t result;
|
|
||||||
SMCParamStruct inputStruct;
|
|
||||||
SMCParamStruct outputStruct;
|
|
||||||
|
|
||||||
memset(&inputStruct, 0, sizeof(SMCParamStruct));
|
|
||||||
memset(&outputStruct, 0, sizeof(SMCParamStruct));
|
|
||||||
memset(result_smc, 0, sizeof(smc_return_t));
|
|
||||||
|
|
||||||
// First call to AppleSMC - get key info
|
|
||||||
inputStruct.key = to_uint32_t(key);
|
|
||||||
inputStruct.data8 = kSMCGetKeyInfo;
|
|
||||||
|
|
||||||
result = call_smc(&inputStruct, &outputStruct);
|
|
||||||
result_smc->kSMC = outputStruct.result;
|
|
||||||
|
|
||||||
if (result != kIOReturnSuccess || outputStruct.result != kSMCSuccess) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Store data for return
|
|
||||||
result_smc->dataSize = outputStruct.keyInfo.dataSize;
|
|
||||||
result_smc->dataType = outputStruct.keyInfo.dataType;
|
|
||||||
|
|
||||||
|
|
||||||
// Second call to AppleSMC - now we can get the data
|
|
||||||
inputStruct.keyInfo.dataSize = outputStruct.keyInfo.dataSize;
|
|
||||||
inputStruct.data8 = kSMCReadKey;
|
|
||||||
|
|
||||||
result = call_smc(&inputStruct, &outputStruct);
|
|
||||||
result_smc->kSMC = outputStruct.result;
|
|
||||||
|
|
||||||
if (result != kIOReturnSuccess || outputStruct.result != kSMCSuccess) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(result_smc->data, outputStruct.bytes, sizeof(outputStruct.bytes));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Write data to the SMC.
|
|
||||||
|
|
||||||
:returns: IOReturn IOKit return code
|
|
||||||
*/
|
|
||||||
static kern_return_t write_smc(char *key, smc_return_t *result_smc)
|
|
||||||
{
|
|
||||||
kern_return_t result;
|
|
||||||
SMCParamStruct inputStruct;
|
|
||||||
SMCParamStruct outputStruct;
|
|
||||||
|
|
||||||
memset(&inputStruct, 0, sizeof(SMCParamStruct));
|
|
||||||
memset(&outputStruct, 0, sizeof(SMCParamStruct));
|
|
||||||
|
|
||||||
// First call to AppleSMC - get key info
|
|
||||||
inputStruct.key = to_uint32_t(key);
|
|
||||||
inputStruct.data8 = kSMCGetKeyInfo;
|
|
||||||
|
|
||||||
result = call_smc(&inputStruct, &outputStruct);
|
|
||||||
result_smc->kSMC = outputStruct.result;
|
|
||||||
|
|
||||||
if (result != kIOReturnSuccess || outputStruct.result != kSMCSuccess) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check data is correct
|
|
||||||
if (result_smc->dataSize != outputStruct.keyInfo.dataSize ||
|
|
||||||
result_smc->dataType != outputStruct.keyInfo.dataType) {
|
|
||||||
return kIOReturnBadArgument;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Second call to AppleSMC - now we can write the data
|
|
||||||
inputStruct.data8 = kSMCWriteKey;
|
|
||||||
inputStruct.keyInfo.dataSize = outputStruct.keyInfo.dataSize;
|
|
||||||
|
|
||||||
// Set data to write
|
|
||||||
memcpy(inputStruct.bytes, result_smc->data, sizeof(result_smc->data));
|
|
||||||
|
|
||||||
result = call_smc(&inputStruct, &outputStruct);
|
|
||||||
result_smc->kSMC = outputStruct.result;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get the model name of the machine.
|
|
||||||
*/
|
|
||||||
static kern_return_t get_machine_model(io_name_t model)
|
|
||||||
{
|
|
||||||
io_service_t service;
|
|
||||||
kern_return_t result;
|
|
||||||
|
|
||||||
service = IOServiceGetMatchingService(kIOMasterPortDefault,
|
|
||||||
IOServiceMatching(IOSERVICE_MODEL));
|
|
||||||
|
|
||||||
if (service == 0) {
|
|
||||||
printf("ERROR: %s NOT FOUND\n", IOSERVICE_MODEL);
|
|
||||||
return kIOReturnError;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the model name
|
|
||||||
result = IORegistryEntryGetName(service, model);
|
|
||||||
IOObjectRelease(service);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: "PUBLIC" FUNCTIONS
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
kern_return_t open_smc(void)
|
|
||||||
{
|
|
||||||
kern_return_t result;
|
|
||||||
io_service_t service;
|
|
||||||
|
|
||||||
service = IOServiceGetMatchingService(kIOMasterPortDefault,
|
|
||||||
IOServiceMatching(IOSERVICE_SMC));
|
|
||||||
|
|
||||||
if (service == 0) {
|
|
||||||
// NOTE: IOServiceMatching documents 0 on failure
|
|
||||||
printf("ERROR: %s NOT FOUND\n", IOSERVICE_SMC);
|
|
||||||
return kIOReturnError;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = IOServiceOpen(service, mach_task_self(), 0, &conn);
|
|
||||||
IOObjectRelease(service);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
kern_return_t close_smc(void)
|
|
||||||
{
|
|
||||||
return IOServiceClose(conn);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool is_key_valid(char *key)
|
|
||||||
{
|
|
||||||
bool ans = false;
|
|
||||||
kern_return_t result;
|
|
||||||
smc_return_t result_smc;
|
|
||||||
|
|
||||||
if (strlen(key) != SMC_KEY_SIZE) {
|
|
||||||
printf("ERROR: Invalid key size - must be 4 chars\n");
|
|
||||||
return ans;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try a read and see if it succeeds
|
|
||||||
result = read_smc(key, &result_smc);
|
|
||||||
|
|
||||||
if (result == kIOReturnSuccess && result_smc.kSMC == kSMCSuccess) {
|
|
||||||
ans = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ans;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
double get_tmp(char *key, tmp_unit_t unit)
|
|
||||||
{
|
|
||||||
kern_return_t result;
|
|
||||||
smc_return_t result_smc;
|
|
||||||
|
|
||||||
result = read_smc(key, &result_smc);
|
|
||||||
|
|
||||||
if (!(result == kIOReturnSuccess &&
|
|
||||||
result_smc.dataSize == 2 &&
|
|
||||||
result_smc.dataType == to_uint32_t(DATA_TYPE_SP78))) {
|
|
||||||
// Error
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Create from_sp78() convert function
|
|
||||||
double tmp = result_smc.data[0];
|
|
||||||
|
|
||||||
switch (unit) {
|
|
||||||
case CELSIUS:
|
|
||||||
break;
|
|
||||||
case FAHRENHEIT:
|
|
||||||
tmp = to_fahrenheit(tmp);
|
|
||||||
break;
|
|
||||||
case KELVIN:
|
|
||||||
tmp = to_kelvin(tmp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool is_battery_powered(void)
|
|
||||||
{
|
|
||||||
kern_return_t result;
|
|
||||||
smc_return_t result_smc;
|
|
||||||
|
|
||||||
result = read_smc(BATT_PWR, &result_smc);
|
|
||||||
|
|
||||||
if (!(result == kIOReturnSuccess &&
|
|
||||||
result_smc.dataSize == 1 &&
|
|
||||||
result_smc.dataType == to_uint32_t(DATA_TYPE_FLAG))) {
|
|
||||||
// Error
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result_smc.data[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool is_optical_disk_drive_full(void)
|
|
||||||
{
|
|
||||||
kern_return_t result;
|
|
||||||
smc_return_t result_smc;
|
|
||||||
|
|
||||||
result = read_smc(ODD_FULL, &result_smc);
|
|
||||||
|
|
||||||
if (!(result == kIOReturnSuccess &&
|
|
||||||
result_smc.dataSize == 1 &&
|
|
||||||
result_smc.dataType == to_uint32_t(DATA_TYPE_FLAG))) {
|
|
||||||
// Error
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result_smc.data[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: FAN FUNCTIONS
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
bool get_fan_name(unsigned int fan_num, fan_name_t name)
|
|
||||||
{
|
|
||||||
char key[5];
|
|
||||||
kern_return_t result;
|
|
||||||
smc_return_t result_smc;
|
|
||||||
|
|
||||||
sprintf(key, "F%dID", fan_num);
|
|
||||||
result = read_smc(key, &result_smc);
|
|
||||||
|
|
||||||
if (!(result == kIOReturnSuccess &&
|
|
||||||
result_smc.dataSize == 16 &&
|
|
||||||
result_smc.dataType == to_uint32_t(DATA_TYPE_SFDS))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
We know the data size is 16 bytes and the type is "{fds", a custom
|
|
||||||
struct defined by the AppleSMC.kext. See TMP enum sources for the
|
|
||||||
struct.
|
|
||||||
|
|
||||||
The last 12 bytes contain the name of the fan, an array of chars, hence
|
|
||||||
the loop range.
|
|
||||||
*/
|
|
||||||
int index = 0;
|
|
||||||
for (int i = 4; i < 16; i++) {
|
|
||||||
// Check if at the end (name may not be full 12 bytes)
|
|
||||||
// Could check for 0 (null), but instead we check for 32 (space). This
|
|
||||||
// is a hack to remove whitespace. :)
|
|
||||||
if (result_smc.data[i] == 32) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
name[index] = result_smc.data[i];
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int get_num_fans(void)
|
|
||||||
{
|
|
||||||
kern_return_t result;
|
|
||||||
smc_return_t result_smc;
|
|
||||||
|
|
||||||
result = read_smc(NUM_FANS, &result_smc);
|
|
||||||
|
|
||||||
if (!(result == kIOReturnSuccess &&
|
|
||||||
result_smc.dataSize == 1 &&
|
|
||||||
result_smc.dataType == to_uint32_t(DATA_TYPE_UINT8))) {
|
|
||||||
// Error
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result_smc.data[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned int get_fan_rpm(unsigned int fan_num)
|
|
||||||
{
|
|
||||||
char key[5];
|
|
||||||
kern_return_t result;
|
|
||||||
smc_return_t result_smc;
|
|
||||||
|
|
||||||
sprintf(key, "F%dAc", fan_num);
|
|
||||||
result = read_smc(key, &result_smc);
|
|
||||||
|
|
||||||
if (!(result == kIOReturnSuccess &&
|
|
||||||
result_smc.dataSize == 2 &&
|
|
||||||
result_smc.dataType == to_uint32_t(DATA_TYPE_FPE2))) {
|
|
||||||
// Error
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return from_fpe2(result_smc.data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool set_fan_min_rpm(unsigned int fan_num, unsigned int rpm, bool auth)
|
|
||||||
{
|
|
||||||
// TODO: Add rpm val safety check
|
|
||||||
char key[5];
|
|
||||||
bool ans = false;
|
|
||||||
kern_return_t result;
|
|
||||||
smc_return_t result_smc;
|
|
||||||
|
|
||||||
memset(&result_smc, 0, sizeof(smc_return_t));
|
|
||||||
|
|
||||||
// TODO: Don't use magic number
|
|
||||||
result_smc.dataSize = 2;
|
|
||||||
result_smc.dataType = to_uint32_t(DATA_TYPE_FPE2);
|
|
||||||
to_fpe2(rpm, result_smc.data);
|
|
||||||
|
|
||||||
sprintf(key, "F%dMn", fan_num);
|
|
||||||
result = write_smc(key, &result_smc);
|
|
||||||
|
|
||||||
if (result == kIOReturnSuccess && result_smc.kSMC == kSMCSuccess) {
|
|
||||||
ans = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ans;
|
|
||||||
}
|
|
|
@ -1,254 +0,0 @@
|
||||||
/*
|
|
||||||
* Apple System Management Controller (SMC) API from user space for Intel based
|
|
||||||
* Macs. Works by talking to the AppleSMC.kext (kernel extension), the driver
|
|
||||||
* for the SMC.
|
|
||||||
*
|
|
||||||
* smc.h
|
|
||||||
* libsmc
|
|
||||||
*
|
|
||||||
* Copyright (C) 2014 beltex <https://github.com/beltex>
|
|
||||||
*
|
|
||||||
* Based off of fork from:
|
|
||||||
* osx-cpu-temp <https://github.com/lavoiesl/osx-cpu-temp>
|
|
||||||
*
|
|
||||||
* With credits to:
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006 devnull
|
|
||||||
* Apple System Management Control (SMC) Tool
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006 Hendrik Holtmann
|
|
||||||
* smcFanControl <https://github.com/hholtmann/smcFanControl>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <IOKit/IOKitLib.h>
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: MACROS
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
SMC keys for temperature sensors - 4 byte multi-character constants
|
|
||||||
|
|
||||||
Not applicable to all Mac's of course. In adition, the definition of the codes
|
|
||||||
may not be 100% accurate necessarily. Finally, list is incomplete.
|
|
||||||
|
|
||||||
Presumed letter translations:
|
|
||||||
|
|
||||||
- T = Temperature (if first char)
|
|
||||||
- C = CPU
|
|
||||||
- G = GPU
|
|
||||||
- P = Proximity
|
|
||||||
- D = Diode
|
|
||||||
- H = Heatsink
|
|
||||||
|
|
||||||
Sources:
|
|
||||||
|
|
||||||
- https://www.apple.com/downloads/dashboard/status/istatpro.html
|
|
||||||
- https://github.com/hholtmann/smcFanControl
|
|
||||||
- https://github.com/jedda/OSX-Monitoring-Tools
|
|
||||||
- http://www.parhelia.ch/blog/statics/k3_keys.html
|
|
||||||
*/
|
|
||||||
#define AMBIENT_AIR_0 "TA0P"
|
|
||||||
#define AMBIENT_AIR_1 "TA1P"
|
|
||||||
#define CPU_0_DIODE "TC0D"
|
|
||||||
#define CPU_0_HEATSINK "TC0H"
|
|
||||||
#define CPU_0_PROXIMITY "TC0P"
|
|
||||||
#define ENCLOSURE_BASE_0 "TB0T"
|
|
||||||
#define ENCLOSURE_BASE_1 "TB1T"
|
|
||||||
#define ENCLOSURE_BASE_2 "TB2T"
|
|
||||||
#define ENCLOSURE_BASE_3 "TB3T"
|
|
||||||
#define GPU_0_DIODE "TG0D"
|
|
||||||
#define GPU_0_HEATSINK "TG0H"
|
|
||||||
#define GPU_0_PROXIMITY "TG0P"
|
|
||||||
#define HARD_DRIVE_BAY "TH0P"
|
|
||||||
#define MEMORY_SLOT_0 "TM0S"
|
|
||||||
#define MEMORY_SLOTS_PROXIMITY "TM0P"
|
|
||||||
#define NORTHBRIDGE "TN0H"
|
|
||||||
#define NORTHBRIDGE_DIODE "TN0D"
|
|
||||||
#define NORTHBRIDGE_PROXIMITY "TN0P"
|
|
||||||
#define THUNDERBOLT_0 "TI0P"
|
|
||||||
#define THUNDERBOLT_1 "TI1P"
|
|
||||||
#define WIRELESS_MODULE "TW0P"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
SMC keys for fans - 4 byte multi-character constants
|
|
||||||
|
|
||||||
Number of fans on Macs vary of course, thus not all keys will be applicable.
|
|
||||||
|
|
||||||
Presumed letter translations:
|
|
||||||
|
|
||||||
- F = Fan
|
|
||||||
- Ac = Acutal
|
|
||||||
- Mn = Min
|
|
||||||
- Mx = Max
|
|
||||||
- Sf = Safe
|
|
||||||
- Tg = Target
|
|
||||||
|
|
||||||
Sources: See TMP SMC keys
|
|
||||||
*/
|
|
||||||
#define FAN_0 "F0Ac"
|
|
||||||
#define FAN_0_MIN_RPM "F0Mn"
|
|
||||||
#define FAN_0_MAX_RPM "F0Mx"
|
|
||||||
#define FAN_0_SAFE_RPM "F0Sf"
|
|
||||||
#define FAN_0_TARGET_RPM "F0Tg"
|
|
||||||
#define FAN_1 "F1Ac"
|
|
||||||
#define FAN_1_MIN_RPM "F1Mn"
|
|
||||||
#define FAN_1_MAX_RPM "F1Mx"
|
|
||||||
#define FAN_1_SAFE_RPM "F1Sf"
|
|
||||||
#define FAN_1_TARGET_RPM "F1Tg"
|
|
||||||
#define FAN_2 "F2Ac"
|
|
||||||
#define FAN_2_MIN_RPM "F2Mn"
|
|
||||||
#define FAN_2_MAX_RPM "F2Mx"
|
|
||||||
#define FAN_2_SAFE_RPM "F2Sf"
|
|
||||||
#define FAN_2_TARGET_RPM "F2Tg"
|
|
||||||
#define NUM_FANS "FNum"
|
|
||||||
#define FORCE_BITS "FS! "
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Misc SMC keys - 4 byte multi-character constants
|
|
||||||
|
|
||||||
Sources: See TMP SMC keys
|
|
||||||
*/
|
|
||||||
#define BATT_PWR "BATP"
|
|
||||||
#define NUM_KEYS "#KEY"
|
|
||||||
#define ODD_FULL "MSDI"
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: TYPES
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
typedef char fan_name_t[13];
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: ENUMS
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
CELSIUS,
|
|
||||||
FAHRENHEIT,
|
|
||||||
KELVIN
|
|
||||||
} tmp_unit_t;
|
|
||||||
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// MARK: PROTOTYPES
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Open a connection to the SMC
|
|
||||||
|
|
||||||
:returns: kIOReturnSuccess on successful connection to the SMC.
|
|
||||||
*/
|
|
||||||
kern_return_t open_smc(void);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Close connection to the SMC
|
|
||||||
|
|
||||||
:returns: kIOReturnSuccess on successful close of connection to the SMC.
|
|
||||||
*/
|
|
||||||
kern_return_t close_smc(void);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Check if an SMC key is valid. Useful for determining if a certain machine has
|
|
||||||
particular sensor or fan for example.
|
|
||||||
|
|
||||||
:param: key The SMC key to check. 4 byte multi-character constant. Must be 4
|
|
||||||
characters in length.
|
|
||||||
:returns: True if the key is found, false otherwise
|
|
||||||
*/
|
|
||||||
bool is_key_valid(char *key);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get the current temperature from a sensor
|
|
||||||
|
|
||||||
:param: key The temperature sensor to read from
|
|
||||||
:param: unit The unit for the temperature value.
|
|
||||||
:returns: Temperature of sensor. If the sensor is not found, or an error
|
|
||||||
occurs, return will be zero
|
|
||||||
*/
|
|
||||||
double get_tmp(char *key, tmp_unit_t unit);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Is the machine being powered by the battery?
|
|
||||||
|
|
||||||
:returns: True if it is, false otherwise
|
|
||||||
*/
|
|
||||||
bool is_battery_powered(void);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Is there a CD in the optical disk drive (ODD)?
|
|
||||||
|
|
||||||
:returns: True if there is, false otherwise
|
|
||||||
*/
|
|
||||||
bool is_optical_disk_drive_full(void);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get the name of a fan.
|
|
||||||
|
|
||||||
:param: fanNum The number of the fan to check
|
|
||||||
:param: name The name of the fan. Return will be empty on error.
|
|
||||||
:returns: True if successful, false otherwise.
|
|
||||||
*/
|
|
||||||
bool get_fan_name(unsigned int fan_num, fan_name_t name);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get the number of fans on this machine.
|
|
||||||
|
|
||||||
:returns: The number of fans. If an error occurs, return will be -1.
|
|
||||||
*/
|
|
||||||
int get_num_fans(void);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get the current speed (RPM - revolutions per minute) of a fan.
|
|
||||||
|
|
||||||
:param: fan_num The number of the fan to check
|
|
||||||
:returns: The fan RPM. If the fan is not found, or an error occurs, return
|
|
||||||
will be zero
|
|
||||||
*/
|
|
||||||
UInt get_fan_rpm(UInt fan_num);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Set the minimum speed (RPM - revolutions per minute) of a fan. This method
|
|
||||||
requires root privileges. By minimum we mean that OS X can interject and
|
|
||||||
raise the fan speed if needed, however it will not go below this.
|
|
||||||
|
|
||||||
WARNING: You are playing with hardware here, BE CAREFUL.
|
|
||||||
|
|
||||||
:param: fan_num The number of the fan to set
|
|
||||||
:param: rpm The speed you would like to set the fan to.
|
|
||||||
:param: auth Should the function do authentication?
|
|
||||||
:return: True if successful, false otherwise
|
|
||||||
*/
|
|
||||||
bool set_fan_min_rpm(unsigned int fan_num, unsigned int rpm, bool auth);
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
package devices
|
package devices
|
||||||
|
|
||||||
|
// TODO gopsutil team reports this is not needed; try getting rid of this dep
|
||||||
import smc "github.com/xxxserxxx/iSMC"
|
import smc "github.com/xxxserxxx/iSMC"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
8
docs/release.svg
Normal file
8
docs/release.svg
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="300" height="30">
|
||||||
|
<a href="/xxxserxxx/gotop/releases/tag/v3.5.2">
|
||||||
|
<text text-anchor="middle" font-size="14pt" fill="#000000" x="150" y="15">
|
||||||
|
Current release: <tspan font-weight="bold">v3.5.2</tspan>
|
||||||
|
</text>
|
||||||
|
</a>
|
||||||
|
</svg>
|
||||||
|
|
After Width: | Height: | Size: 291 B |
16
go.mod
16
go.mod
|
@ -1,25 +1,19 @@
|
||||||
module github.com/xxxserxxx/gotop/v4
|
module github.com/xxxserxxx/gotop/v4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
|
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
|
||||||
|
github.com/VictoriaMetrics/metrics v1.11.2
|
||||||
github.com/distatus/battery v0.9.0
|
github.com/distatus/battery v0.9.0
|
||||||
github.com/docopt/docopt.go v0.0.0-20180111231733-ee0de3bc6815
|
|
||||||
github.com/gizak/termui/v3 v3.0.0
|
github.com/gizak/termui/v3 v3.0.0
|
||||||
github.com/go-ole/go-ole v1.2.1 // indirect
|
github.com/go-ole/go-ole v1.2.4 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.4
|
github.com/mattn/go-runewidth v0.0.4
|
||||||
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
|
|
||||||
github.com/prometheus/client_golang v1.4.1
|
|
||||||
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0
|
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0
|
||||||
github.com/shirou/gopsutil v2.20.3+incompatible
|
github.com/shirou/gopsutil v2.20.3+incompatible
|
||||||
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 // indirect
|
|
||||||
github.com/stretchr/testify v1.4.0
|
github.com/stretchr/testify v1.4.0
|
||||||
github.com/xxxserxxx/iSMC v1.0.1
|
github.com/xxxserxxx/iSMC v1.0.1
|
||||||
github.com/xxxserxxx/opflag v1.0.5
|
github.com/xxxserxxx/opflag v1.0.5
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a // indirect
|
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25 // indirect
|
||||||
golang.org/x/tools v0.0.0-20200425043458-8463f397d07c // indirect
|
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 // indirect
|
||||||
golang.org/x/tools/gopls v0.4.0 // indirect
|
|
||||||
howett.net/plist v0.0.0-20181124034731-591f970eefbb // indirect
|
|
||||||
mvdan.cc/xurls/v2 v2.2.0 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
||||||
go 1.14
|
go 1.14
|
||||||
|
|
168
go.sum
168
go.sum
|
@ -1,52 +1,18 @@
|
||||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
||||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8=
|
github.com/VictoriaMetrics/metrics v1.11.2 h1:t/ceLP6SvagUqypCKU7cI7+tQn54+TIV/tGoxihHvx8=
|
||||||
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
|
github.com/VictoriaMetrics/metrics v1.11.2/go.mod h1:LU2j9qq7xqZYXz8tF3/RQnB2z2MbZms5TDiIg9/NHiQ=
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
|
||||||
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
|
|
||||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
|
||||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
|
||||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
|
||||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
|
||||||
github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd h1:XtfPmj9tQRilnrEmI1HjQhxXWRhEM+m8CACtaMJE/kM=
|
github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd h1:XtfPmj9tQRilnrEmI1HjQhxXWRhEM+m8CACtaMJE/kM=
|
||||||
github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd/go.mod h1:vjcQJUZJYD3MeVGhtZXSMnCHfUNZxsyYzJt90eCYxK4=
|
github.com/cjbassi/drawille-go v0.0.0-20190126131713-27dc511fe6fd/go.mod h1:vjcQJUZJYD3MeVGhtZXSMnCHfUNZxsyYzJt90eCYxK4=
|
||||||
|
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/distatus/battery v0.9.0 h1:8NS5o00/j3Oh2xgocA6pQROTp5guoR+s8CZlWzHC4QM=
|
github.com/distatus/battery v0.9.0 h1:8NS5o00/j3Oh2xgocA6pQROTp5guoR+s8CZlWzHC4QM=
|
||||||
github.com/distatus/battery v0.9.0/go.mod h1:gGO7GxHTi1zlRT+cAj8uGG0/8HFiqAeH0TJvoipnuPs=
|
github.com/distatus/battery v0.9.0/go.mod h1:gGO7GxHTi1zlRT+cAj8uGG0/8HFiqAeH0TJvoipnuPs=
|
||||||
github.com/docopt/docopt.go v0.0.0-20180111231733-ee0de3bc6815 h1:HMAfwOa33y82IaQEKQDfUCiwNlxtM1iw7HLM9ru0RNc=
|
|
||||||
github.com/docopt/docopt.go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:l7JNRynTRuqe45tpIyItHNqZWTxywYjp87MWTOnU5cg=
|
|
||||||
github.com/gizak/termui/v3 v3.0.0 h1:NYTUG6ig/sJK05O5FyhWemwlVPO8ilNpvS/PgRtrKAE=
|
github.com/gizak/termui/v3 v3.0.0 h1:NYTUG6ig/sJK05O5FyhWemwlVPO8ilNpvS/PgRtrKAE=
|
||||||
github.com/gizak/termui/v3 v3.0.0/go.mod h1:uinu2dMdtMI+FTIdEFUJQT5y+KShnhQRshvPblXq3lY=
|
github.com/gizak/termui/v3 v3.0.0/go.mod h1:uinu2dMdtMI+FTIdEFUJQT5y+KShnhQRshvPblXq3lY=
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI=
|
||||||
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
|
||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
|
||||||
github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E=
|
|
||||||
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
|
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
|
|
||||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
|
||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
|
||||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||||
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
|
|
||||||
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
|
||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
|
|
||||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
|
@ -55,134 +21,38 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
|
github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y=
|
||||||
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
|
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
|
||||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
|
||||||
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
||||||
github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
|
|
||||||
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
|
||||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
|
||||||
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
|
|
||||||
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840=
|
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d h1:x3S6kxmy49zXVVyhcnrFqxvNVCBPb2KZ9hV2RBdS840=
|
||||||
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
|
github.com/nsf/termbox-go v0.0.0-20190121233118-02980233997d/go.mod h1:IuKpRQcYE1Tfu+oAQqaLisqDeXgjyyltCfsaoYN18NQ=
|
||||||
github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a h1:P0QSyHOubLI2e6hccBBEjVX0vPWXoXui5QCAVNWdJSk=
|
github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a h1:P0QSyHOubLI2e6hccBBEjVX0vPWXoXui5QCAVNWdJSk=
|
||||||
github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a/go.mod h1:u8Q8dpnMAam0MElxP2KjEROzXMk9G8X168RTpAZ9tPc=
|
github.com/panotza/gosmc v0.0.0-20190601191911-810267459a2a/go.mod h1:u8Q8dpnMAam0MElxP2KjEROzXMk9G8X168RTpAZ9tPc=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
|
|
||||||
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
|
|
||||||
github.com/prometheus/client_golang v1.4.1 h1:FFSuS004yOQEtDdTq+TAOLP5xUq63KqAFYyOi8zA+Y8=
|
|
||||||
github.com/prometheus/client_golang v1.4.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
|
|
||||||
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
|
|
||||||
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
|
||||||
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
|
|
||||||
github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U=
|
|
||||||
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
|
|
||||||
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
|
||||||
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
|
||||||
github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8=
|
|
||||||
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
|
|
||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
|
||||||
github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
|
||||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
|
||||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
|
||||||
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 h1:Xuk8ma/ibJ1fOy4Ee11vHhUFHQNpHhrBneOCNHVXS5w=
|
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 h1:Xuk8ma/ibJ1fOy4Ee11vHhUFHQNpHhrBneOCNHVXS5w=
|
||||||
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7AwjWCpdPhkSmNAgUv5C7EJ4AbmjEB3r047r3DXWu3Y=
|
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0/go.mod h1:7AwjWCpdPhkSmNAgUv5C7EJ4AbmjEB3r047r3DXWu3Y=
|
||||||
github.com/shirou/gopsutil v2.18.11+incompatible h1:PMFTKnFTr/YTRW5rbLK4vWALV3a+IGXse5nvhSjztmg=
|
|
||||||
github.com/shirou/gopsutil v2.18.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
|
||||||
github.com/shirou/gopsutil v2.20.3+incompatible h1:0JVooMPsT7A7HqEYdydp/OfjSOYSjhXV7w1hkKj/NPQ=
|
github.com/shirou/gopsutil v2.20.3+incompatible h1:0JVooMPsT7A7HqEYdydp/OfjSOYSjhXV7w1hkKj/NPQ=
|
||||||
github.com/shirou/gopsutil v2.20.3+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
github.com/shirou/gopsutil v2.20.3+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
|
||||||
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4 h1:udFKJ0aHUL60LboW/A+DfgoHVedieIzIXE8uylPue0U=
|
|
||||||
github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc=
|
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
|
||||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
||||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/xxxserxxx/gotop v0.0.0-20200228201131-d16cf1c6d2b9 h1:Sn+TuKkfF+CVaJjm4oVmeADtrOaHtrWpgqVLtsMpUqg=
|
github.com/valyala/fastrand v1.0.0 h1:LUKT9aKer2dVQNUi3waewTbKV+7H17kvWFNKs2ObdkI=
|
||||||
github.com/xxxserxxx/gotop/v3 v3.5.1 h1:aBf++Oxg7qCZpKqYpPPnXKFOxT1KYLPtiEXRh57ywu0=
|
github.com/valyala/fastrand v1.0.0/go.mod h1:HWqCzkrkg6QXT8V2EXWvXCoow7vLwOFN002oeRzjapQ=
|
||||||
github.com/xxxserxxx/gotop/v3 v3.5.1/go.mod h1:DGPTiAmUhqE21xvokK64BuMxW+EmnOptaxpdOlqiH6s=
|
github.com/valyala/histogram v1.0.1 h1:FzA7n2Tz/wKRMejgu3PV1vw3htAklTjjuoI6z3d4KDg=
|
||||||
|
github.com/valyala/histogram v1.0.1/go.mod h1:lQy0xA4wUz2+IUnf97SivorsJIp8FxsnRd6x25q7Mto=
|
||||||
github.com/xxxserxxx/iSMC v1.0.1 h1:M9Gkwnnkl+evvnugoB5yRYrbUP+cRIVOPM+xrHZc3Hs=
|
github.com/xxxserxxx/iSMC v1.0.1 h1:M9Gkwnnkl+evvnugoB5yRYrbUP+cRIVOPM+xrHZc3Hs=
|
||||||
github.com/xxxserxxx/iSMC v1.0.1/go.mod h1:TGgNjU7BF2DZSuxiTft+BdzxzcujFJYqFfMCzcTl/aY=
|
github.com/xxxserxxx/iSMC v1.0.1/go.mod h1:TGgNjU7BF2DZSuxiTft+BdzxzcujFJYqFfMCzcTl/aY=
|
||||||
github.com/xxxserxxx/opflag v1.0.0 h1:NabxbubvejqcdzQUHnsU8pBMAiWM+a/Rh2IJe56moiU=
|
|
||||||
github.com/xxxserxxx/opflag v1.0.0/go.mod h1:Zf9bGkOcA35ypGfN25KX0iujVpZB5XwauEFjcfSKcBo=
|
|
||||||
github.com/xxxserxxx/opflag v1.0.2 h1:TanW4Ck/RNal4fP2VVAvhEu7eBq4z+9hhGq9Q8OTq68=
|
|
||||||
github.com/xxxserxxx/opflag v1.0.2/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4=
|
|
||||||
github.com/xxxserxxx/opflag v1.0.3 h1:ugsBWZtSXUaMLEjPLW0WKGjq/gsrc0GpZYbCJY6ZHVY=
|
|
||||||
github.com/xxxserxxx/opflag v1.0.3/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4=
|
|
||||||
github.com/xxxserxxx/opflag v1.0.4 h1:g979b8oReAERfDKFTTwdvAYIarFxpVYOzYrHa/hMvNs=
|
|
||||||
github.com/xxxserxxx/opflag v1.0.4/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4=
|
|
||||||
github.com/xxxserxxx/opflag v1.0.5 h1:2H4Qtl1qe+dSkEcGt+fBe2mQ8z14MgkWPqcLaoa6k90=
|
github.com/xxxserxxx/opflag v1.0.5 h1:2H4Qtl1qe+dSkEcGt+fBe2mQ8z14MgkWPqcLaoa6k90=
|
||||||
github.com/xxxserxxx/opflag v1.0.5/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4=
|
github.com/xxxserxxx/opflag v1.0.5/go.mod h1:GWZtb3/tGGj5W1GE/JTyJAuqgxDxl1+jqDGAGM+P/p4=
|
||||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8=
|
golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8=
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25 h1:OKbAoGs4fGM5cPLlVQLZGYkFC8OnOfgo6tt0Smf9XhM=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
|
||||||
golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ=
|
|
||||||
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY=
|
|
||||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a h1:WXEvlFVvvGxCJLG6REjsT03iWnKLEWinaScsxF2Vm2o=
|
|
||||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82 h1:ywK/j/KkyTHcdyYSZNXGjMwgmDSfjglYZ3vStQ/gSCU=
|
|
||||||
golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20200407041343-bf15fae40dea h1:DUwLyMDMUauGMd9kSLIlhhYJNELm06HuxeBdkFkeax4=
|
|
||||||
golang.org/x/tools v0.0.0-20200407041343-bf15fae40dea/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools v0.0.0-20200425043458-8463f397d07c h1:iHhCR0b26amDCiiO+kBguKZom9aMF+NrFxh9zeKR/XU=
|
|
||||||
golang.org/x/tools v0.0.0-20200425043458-8463f397d07c/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
|
||||||
golang.org/x/tools/gopls v0.4.0 h1:G4+YP9kaV4dJb79J5MobyApxX493Qa6VoiTceUmxqik=
|
|
||||||
golang.org/x/tools/gopls v0.4.0/go.mod h1:fdOZ8zb6nqlePvfek79JCskQXI4W+i2e1xT+xOPKMcY=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5 h1:AQkaJpH+/FmqRjmXZPELom5zIERYZfwTjnHpfoVMQEc=
|
||||||
gopkg.in/yaml.v2 v2.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c=
|
howett.net/plist v0.0.0-20200419221736-3b63eb3a43b5/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
|
||||||
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
|
||||||
howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M=
|
|
||||||
howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
|
|
||||||
mvdan.cc/xurls/v2 v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=
|
|
||||||
mvdan.cc/xurls/v2 v2.1.0/go.mod h1:5GrSd9rOnKOpZaji1OZLYL/yeAAtGDlo/cFe+8K5n8E=
|
|
||||||
mvdan.cc/xurls/v2 v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
|
|
||||||
mvdan.cc/xurls/v2 v2.2.0/go.mod h1:EV1RMtya9D6G5DMYPGD8zTQzaHet6Jh8gFlRgGRJeO8=
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build arm64
|
// +build linux,arm64
|
||||||
|
|
||||||
package logging
|
package logging
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// +build linux openbsd freebsd darwin
|
// +build linux openbsd freebsd darwin
|
||||||
// +build !arm64
|
// +build !linux,arm64
|
||||||
|
|
||||||
package logging
|
package logging
|
||||||
|
|
||||||
|
|
45
scripts/install_without_root.sh
Executable file
45
scripts/install_without_root.sh
Executable file
|
@ -0,0 +1,45 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Builds the gotop executable on machines where Go isn't installed,
|
||||||
|
# or is the wrong version, and you don't have root access to upgrade or
|
||||||
|
# install Go.
|
||||||
|
#
|
||||||
|
# You can run this without cloning the entire gotop repository (the script
|
||||||
|
# will do this for you.)
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
VERSION='1.14.2' # Go version needed to build
|
||||||
|
OS='linux'
|
||||||
|
ARCH='amd64'
|
||||||
|
BUILDDIR=/tmp/gotop-build
|
||||||
|
INSTALLDIR=${HOME}/bin
|
||||||
|
|
||||||
|
GO_NAME=go${VERSION}.${OS}-${ARCH}
|
||||||
|
|
||||||
|
mkdir -p $BUILDDIR
|
||||||
|
cd $BUILDDIR
|
||||||
|
|
||||||
|
curl https://dl.google.com/go/${GO_NAME}.tar.gz --output ./${GO_NAME}.tar.gz
|
||||||
|
|
||||||
|
tar -vxzf ${GO_NAME}.tar.gz
|
||||||
|
rm ${GO_NAME}.tar.gz
|
||||||
|
|
||||||
|
PATH=$BUILDDIR/go/bin:$PATH
|
||||||
|
|
||||||
|
go env -w GOPATH=$BUILDDIR # otherwise go would create a directory in $HOME
|
||||||
|
|
||||||
|
rm -rf ./gotop
|
||||||
|
git clone https://github.com/xxxserxxx/gotop.git
|
||||||
|
cd ./gotop
|
||||||
|
go build -o gotop ./cmd/gotop
|
||||||
|
|
||||||
|
go clean -modcache # otherwise $BUILDDIR/pkg would need sudo permissions to remove
|
||||||
|
|
||||||
|
mkdir -p $INSTALLDIR
|
||||||
|
mv gotop ${INSTALLDIR}/gotop
|
||||||
|
|
||||||
|
rm -rf $BUILDDIR
|
||||||
|
|
||||||
|
printf "gotop installed in ${INSTALLDIR}/gotop\n"
|
||||||
|
|
26
scripts/size.sh
Executable file
26
scripts/size.sh
Executable file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# size.sh is used to bisect the repository and find changes that negatively
|
||||||
|
# impacted the gotop binary size. It does this by building gotop and exiting
|
||||||
|
# successfully if the binary size is under a defined amount.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# ```
|
||||||
|
# git bisect start
|
||||||
|
# git bisect bad master
|
||||||
|
# git bisect good 755037d211cc8e58e9ce43ee74a95a3036053dee
|
||||||
|
# git bisect run ./size
|
||||||
|
# ```
|
||||||
|
|
||||||
|
GOODSIZE=6000000
|
||||||
|
|
||||||
|
# Caleb's directory structure was different from the current structure, so
|
||||||
|
# we have to find the main package first.
|
||||||
|
pt=$(dirname $(find . -name main.go))
|
||||||
|
# Give the executable a unique-ish name
|
||||||
|
fn=gotop_$(git rev-list -1 HEAD)
|
||||||
|
go build -o $fn $pt
|
||||||
|
sz=$(ls -l $fn | awk '{print $5}')
|
||||||
|
git checkout -- .
|
||||||
|
[[ $sz -gt $GOODSIZE ]] && exit 1
|
||||||
|
exit 0
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/VictoriaMetrics/metrics"
|
||||||
"github.com/distatus/battery"
|
"github.com/distatus/battery"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
|
||||||
|
|
||||||
ui "github.com/xxxserxxx/gotop/v4/termui"
|
ui "github.com/xxxserxxx/gotop/v4/termui"
|
||||||
)
|
)
|
||||||
|
@ -16,7 +16,6 @@ import (
|
||||||
type BatteryWidget struct {
|
type BatteryWidget struct {
|
||||||
*ui.LineGraph
|
*ui.LineGraph
|
||||||
updateInterval time.Duration
|
updateInterval time.Duration
|
||||||
metric []prometheus.Gauge
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBatteryWidget(horizontalScale int) *BatteryWidget {
|
func NewBatteryWidget(horizontalScale int) *BatteryWidget {
|
||||||
|
@ -49,16 +48,14 @@ func (b *BatteryWidget) EnableMetric() {
|
||||||
log.Printf("error setting up metrics: %v", err)
|
log.Printf("error setting up metrics: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
b.metric = make([]prometheus.Gauge, len(bats))
|
for i, _ := range bats {
|
||||||
for i, bat := range bats {
|
id := makeID(i)
|
||||||
gauge := prometheus.NewGauge(prometheus.GaugeOpts{
|
metrics.NewGauge(makeName("battery", i), func() float64 {
|
||||||
Namespace: "gotop",
|
if ds, ok := b.Data[id]; ok {
|
||||||
Subsystem: "battery",
|
return ds[len(ds)-1]
|
||||||
Name: fmt.Sprintf("%d", i),
|
}
|
||||||
|
return 0.0
|
||||||
})
|
})
|
||||||
gauge.Set(bat.Current / bat.Full)
|
|
||||||
b.metric[i] = gauge
|
|
||||||
prometheus.MustRegister(gauge)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,10 +94,8 @@ func (b *BatteryWidget) update() {
|
||||||
id := makeID(i)
|
id := makeID(i)
|
||||||
perc := battery.Current / battery.Full
|
perc := battery.Current / battery.Full
|
||||||
percentFull := math.Abs(perc) * 100.0
|
percentFull := math.Abs(perc) * 100.0
|
||||||
|
// TODO: look into this sort of thing; doesn't the array grow forever? Is the widget library truncating it?
|
||||||
b.Data[id] = append(b.Data[id], percentFull)
|
b.Data[id] = append(b.Data[id], percentFull)
|
||||||
b.Labels[id] = fmt.Sprintf("%3.0f%% %.0f/%.0f", percentFull, math.Abs(battery.Current), math.Abs(battery.Full))
|
b.Labels[id] = fmt.Sprintf("%3.0f%% %.0f/%.0f", percentFull, math.Abs(battery.Current), math.Abs(battery.Full))
|
||||||
if b.metric != nil {
|
|
||||||
b.metric[i].Set(perc)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,14 @@ import (
|
||||||
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/VictoriaMetrics/metrics"
|
||||||
"github.com/distatus/battery"
|
"github.com/distatus/battery"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
|
||||||
|
|
||||||
"github.com/xxxserxxx/gotop/v4/termui"
|
"github.com/xxxserxxx/gotop/v4/termui"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BatteryGauge struct {
|
type BatteryGauge struct {
|
||||||
*termui.Gauge
|
*termui.Gauge
|
||||||
metric prometheus.Gauge
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBatteryGauge() *BatteryGauge {
|
func NewBatteryGauge() *BatteryGauge {
|
||||||
|
@ -35,25 +34,9 @@ func NewBatteryGauge() *BatteryGauge {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BatteryGauge) EnableMetric() {
|
func (b *BatteryGauge) EnableMetric() {
|
||||||
bats, err := battery.GetAll()
|
metrics.NewGauge(makeName("battery", "total"), func() float64 {
|
||||||
if err != nil {
|
return float64(b.Percent)
|
||||||
log.Printf("error setting up metrics: %v", err)
|
})
|
||||||
return
|
|
||||||
}
|
|
||||||
mx := 0.0
|
|
||||||
cu := 0.0
|
|
||||||
for _, bat := range bats {
|
|
||||||
mx += bat.Full
|
|
||||||
cu += bat.Current
|
|
||||||
gauge := prometheus.NewGauge(prometheus.GaugeOpts{
|
|
||||||
Namespace: "gotop",
|
|
||||||
Subsystem: "battery",
|
|
||||||
Name: "total",
|
|
||||||
})
|
|
||||||
gauge.Set(cu / mx)
|
|
||||||
b.metric = gauge
|
|
||||||
prometheus.MustRegister(gauge)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *BatteryGauge) update() {
|
func (b *BatteryGauge) update() {
|
||||||
|
@ -81,7 +64,4 @@ func (b *BatteryGauge) update() {
|
||||||
d, _ := time.ParseDuration(fmt.Sprintf("%fh", tn))
|
d, _ := time.ParseDuration(fmt.Sprintf("%fh", tn))
|
||||||
b.Percent = int((cu / mx) * 100.0)
|
b.Percent = int((cu / mx) * 100.0)
|
||||||
b.Label = fmt.Sprintf(charging, b.Percent, d.Truncate(time.Minute))
|
b.Label = fmt.Sprintf(charging, b.Percent, d.Truncate(time.Minute))
|
||||||
if b.metric != nil {
|
|
||||||
b.metric.Set(cu / mx)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,10 @@ package widgets
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/VictoriaMetrics/metrics"
|
||||||
"github.com/xxxserxxx/gotop/v4/devices"
|
"github.com/xxxserxxx/gotop/v4/devices"
|
||||||
|
|
||||||
ui "github.com/xxxserxxx/gotop/v4/termui"
|
ui "github.com/xxxserxxx/gotop/v4/termui"
|
||||||
|
@ -19,7 +18,7 @@ type CPUWidget struct {
|
||||||
ShowPerCPULoad bool
|
ShowPerCPULoad bool
|
||||||
updateInterval time.Duration
|
updateInterval time.Duration
|
||||||
updateLock sync.Mutex
|
updateLock sync.Mutex
|
||||||
metric map[string]prometheus.Gauge
|
cpuLoads map[string]float64
|
||||||
}
|
}
|
||||||
|
|
||||||
var cpuLabels []string
|
var cpuLabels []string
|
||||||
|
@ -31,6 +30,7 @@ func NewCPUWidget(updateInterval time.Duration, horizontalScale int, showAverage
|
||||||
updateInterval: updateInterval,
|
updateInterval: updateInterval,
|
||||||
ShowAverageLoad: showAverageLoad,
|
ShowAverageLoad: showAverageLoad,
|
||||||
ShowPerCPULoad: showPerCPULoad,
|
ShowPerCPULoad: showPerCPULoad,
|
||||||
|
cpuLoads: make(map[string]float64),
|
||||||
}
|
}
|
||||||
self.Title = " CPU Usage "
|
self.Title = " CPU Usage "
|
||||||
self.HorizontalScale = horizontalScale
|
self.HorizontalScale = horizontalScale
|
||||||
|
@ -66,26 +66,22 @@ func NewCPUWidget(updateInterval time.Duration, horizontalScale int, showAverage
|
||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const AVRG = "AVRG"
|
||||||
|
|
||||||
func (cpu *CPUWidget) EnableMetric() {
|
func (cpu *CPUWidget) EnableMetric() {
|
||||||
if cpu.ShowAverageLoad {
|
if cpu.ShowAverageLoad {
|
||||||
cpu.metric = make(map[string]prometheus.Gauge)
|
metrics.NewGauge(makeName("cpu", " avg"), func() float64 {
|
||||||
cpu.metric["AVRG"] = prometheus.NewGauge(prometheus.GaugeOpts{
|
return cpu.cpuLoads[AVRG]
|
||||||
Subsystem: "cpu",
|
|
||||||
Name: "avg",
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
cpus := make(map[string]int)
|
cpus := make(map[string]int)
|
||||||
devices.UpdateCPU(cpus, cpu.updateInterval, cpu.ShowPerCPULoad)
|
devices.UpdateCPU(cpus, cpu.updateInterval, cpu.ShowPerCPULoad)
|
||||||
cpu.metric = make(map[string]prometheus.Gauge)
|
|
||||||
for key, perc := range cpus {
|
for key, perc := range cpus {
|
||||||
gauge := prometheus.NewGauge(prometheus.GaugeOpts{
|
kc := key
|
||||||
Namespace: "gotop",
|
cpu.cpuLoads[key] = float64(perc)
|
||||||
Subsystem: "cpu",
|
metrics.NewGauge(makeName("cpu", key), func() float64 {
|
||||||
Name: key,
|
return cpu.cpuLoads[kc]
|
||||||
})
|
})
|
||||||
gauge.Set(float64(perc))
|
|
||||||
prometheus.MustRegister(gauge)
|
|
||||||
cpu.metric[key] = gauge
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,11 +104,9 @@ func (cpu *CPUWidget) update() {
|
||||||
val = float64(v)
|
val = float64(v)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
cpu.Data["AVRG"] = append(cpu.Data["AVRG"], val)
|
cpu.Data[AVRG] = append(cpu.Data[AVRG], val)
|
||||||
cpu.Labels["AVRG"] = fmt.Sprintf("%3.0f%%", val)
|
cpu.Labels[AVRG] = fmt.Sprintf("%3.0f%%", val)
|
||||||
if cpu.metric != nil {
|
cpu.cpuLoads[AVRG] = val
|
||||||
cpu.metric["AVRG"].Set(val)
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,13 +121,7 @@ func (cpu *CPUWidget) update() {
|
||||||
for key, percent := range cpus {
|
for key, percent := range cpus {
|
||||||
cpu.Data[key] = append(cpu.Data[key], float64(percent))
|
cpu.Data[key] = append(cpu.Data[key], float64(percent))
|
||||||
cpu.Labels[key] = fmt.Sprintf("%d%%", percent)
|
cpu.Labels[key] = fmt.Sprintf("%d%%", percent)
|
||||||
if cpu.metric != nil {
|
cpu.cpuLoads[key] = float64(percent)
|
||||||
if cpu.metric[key] == nil {
|
|
||||||
log.Printf("no metrics for %s", key)
|
|
||||||
} else {
|
|
||||||
cpu.metric[key].Set(float64(percent))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/VictoriaMetrics/metrics"
|
||||||
psDisk "github.com/shirou/gopsutil/disk"
|
psDisk "github.com/shirou/gopsutil/disk"
|
||||||
|
|
||||||
ui "github.com/xxxserxxx/gotop/v4/termui"
|
ui "github.com/xxxserxxx/gotop/v4/termui"
|
||||||
|
@ -29,7 +29,6 @@ type DiskWidget struct {
|
||||||
*ui.Table
|
*ui.Table
|
||||||
updateInterval time.Duration
|
updateInterval time.Duration
|
||||||
Partitions map[string]*Partition
|
Partitions map[string]*Partition
|
||||||
metric map[string]prometheus.Gauge
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDiskWidget() *DiskWidget {
|
func NewDiskWidget() *DiskWidget {
|
||||||
|
@ -63,17 +62,11 @@ func NewDiskWidget() *DiskWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (disk *DiskWidget) EnableMetric() {
|
func (disk *DiskWidget) EnableMetric() {
|
||||||
disk.metric = make(map[string]prometheus.Gauge)
|
|
||||||
for key, part := range disk.Partitions {
|
for key, part := range disk.Partitions {
|
||||||
gauge := prometheus.NewGauge(prometheus.GaugeOpts{
|
pc := part
|
||||||
Namespace: "gotop",
|
metrics.NewGauge(makeName("disk", strings.ReplaceAll(key, "/", ":")), func() float64 {
|
||||||
Subsystem: "disk",
|
return float64(pc.UsedPercent) / 100.0
|
||||||
Name: strings.ReplaceAll(key, "/", ":"),
|
|
||||||
//Name: strings.Replace(strings.Replace(part.Device, "/dev/", "", -1), "mapper/", "", -1),
|
|
||||||
})
|
})
|
||||||
gauge.Set(float64(part.UsedPercent) / 100.0)
|
|
||||||
prometheus.MustRegister(gauge)
|
|
||||||
disk.metric[key] = gauge
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,12 +167,5 @@ func (disk *DiskWidget) update() {
|
||||||
disk.Rows[i][3] = partition.Free
|
disk.Rows[i][3] = partition.Free
|
||||||
disk.Rows[i][4] = partition.BytesReadRecently
|
disk.Rows[i][4] = partition.BytesReadRecently
|
||||||
disk.Rows[i][5] = partition.BytesWrittenRecently
|
disk.Rows[i][5] = partition.BytesWrittenRecently
|
||||||
if disk.metric != nil {
|
|
||||||
if disk.metric[key] == nil {
|
|
||||||
log.Printf("ERROR: missing metric %s", key)
|
|
||||||
} else {
|
|
||||||
disk.metric[key].Set(float64(partition.UsedPercent) / 100.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/VictoriaMetrics/metrics"
|
||||||
|
|
||||||
"github.com/xxxserxxx/gotop/v4/devices"
|
"github.com/xxxserxxx/gotop/v4/devices"
|
||||||
ui "github.com/xxxserxxx/gotop/v4/termui"
|
ui "github.com/xxxserxxx/gotop/v4/termui"
|
||||||
|
@ -14,52 +14,47 @@ import (
|
||||||
type MemWidget struct {
|
type MemWidget struct {
|
||||||
*ui.LineGraph
|
*ui.LineGraph
|
||||||
updateInterval time.Duration
|
updateInterval time.Duration
|
||||||
metrics map[string]prometheus.Gauge
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMemWidget(updateInterval time.Duration, horizontalScale int) *MemWidget {
|
func NewMemWidget(updateInterval time.Duration, horizontalScale int) *MemWidget {
|
||||||
self := &MemWidget{
|
widg := &MemWidget{
|
||||||
LineGraph: ui.NewLineGraph(),
|
LineGraph: ui.NewLineGraph(),
|
||||||
updateInterval: updateInterval,
|
updateInterval: updateInterval,
|
||||||
}
|
}
|
||||||
self.Title = " Memory Usage "
|
widg.Title = " Memory Usage "
|
||||||
self.HorizontalScale = horizontalScale
|
widg.HorizontalScale = horizontalScale
|
||||||
mems := make(map[string]devices.MemoryInfo)
|
mems := make(map[string]devices.MemoryInfo)
|
||||||
devices.UpdateMem(mems)
|
devices.UpdateMem(mems)
|
||||||
for name, mem := range mems {
|
for name, mem := range mems {
|
||||||
self.Data[name] = []float64{0}
|
widg.Data[name] = []float64{0}
|
||||||
self.renderMemInfo(name, mem)
|
widg.renderMemInfo(name, mem)
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for range time.NewTicker(self.updateInterval).C {
|
for range time.NewTicker(widg.updateInterval).C {
|
||||||
self.Lock()
|
widg.Lock()
|
||||||
devices.UpdateMem(mems)
|
devices.UpdateMem(mems)
|
||||||
for label, mi := range mems {
|
for label, mi := range mems {
|
||||||
self.renderMemInfo(label, mi)
|
widg.renderMemInfo(label, mi)
|
||||||
if self.metrics != nil && self.metrics[label] != nil {
|
|
||||||
self.metrics[label].Set(mi.UsedPercent)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
self.Unlock()
|
widg.Unlock()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return self
|
return widg
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mem *MemWidget) EnableMetric() {
|
func (mem *MemWidget) EnableMetric() {
|
||||||
mem.metrics = make(map[string]prometheus.Gauge)
|
|
||||||
mems := make(map[string]devices.MemoryInfo)
|
mems := make(map[string]devices.MemoryInfo)
|
||||||
devices.UpdateMem(mems)
|
devices.UpdateMem(mems)
|
||||||
for l, m := range mems {
|
for l, _ := range mems {
|
||||||
mem.metrics[l] = prometheus.NewGauge(prometheus.GaugeOpts{
|
lc := l
|
||||||
Namespace: "gotop",
|
metrics.NewGauge(makeName("memory", l), func() float64 {
|
||||||
Subsystem: "memory",
|
if ds, ok := mem.Data[lc]; ok {
|
||||||
Name: l,
|
return ds[len(ds)-1]
|
||||||
|
}
|
||||||
|
return 0.0
|
||||||
})
|
})
|
||||||
mem.metrics[l].Set(m.UsedPercent)
|
|
||||||
prometheus.MustRegister(mem.metrics[l])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
widgets/metrics.go
Normal file
19
widgets/metrics.go
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package widgets
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// makeName creates a prometheus metric name in the gotop space
|
||||||
|
// This function doesn't have to be very efficient because it's only
|
||||||
|
// called at init time, and only a few dozen times... and it isn't
|
||||||
|
// (very efficient).
|
||||||
|
func makeName(parts ...interface{}) string {
|
||||||
|
args := make([]string, len(parts)+1)
|
||||||
|
args[0] = "gotop"
|
||||||
|
for i, v := range parts {
|
||||||
|
args[i+1] = fmt.Sprintf("%v", v)
|
||||||
|
}
|
||||||
|
return strings.Join(args, "_")
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/VictoriaMetrics/metrics"
|
||||||
psNet "github.com/shirou/gopsutil/net"
|
psNet "github.com/shirou/gopsutil/net"
|
||||||
|
|
||||||
ui "github.com/xxxserxxx/gotop/v4/termui"
|
ui "github.com/xxxserxxx/gotop/v4/termui"
|
||||||
|
@ -28,8 +28,8 @@ type NetWidget struct {
|
||||||
totalBytesRecv uint64
|
totalBytesRecv uint64
|
||||||
totalBytesSent uint64
|
totalBytesSent uint64
|
||||||
NetInterface []string
|
NetInterface []string
|
||||||
sentMetric prometheus.Counter
|
sentMetric *metrics.Counter
|
||||||
recvMetric prometheus.Counter
|
recvMetric *metrics.Counter
|
||||||
Mbps bool
|
Mbps bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,19 +66,8 @@ func NewNetWidget(netInterface string) *NetWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (net *NetWidget) EnableMetric() {
|
func (net *NetWidget) EnableMetric() {
|
||||||
net.recvMetric = prometheus.NewCounter(prometheus.CounterOpts{
|
net.recvMetric = metrics.NewCounter(makeName("net", "recv"))
|
||||||
Namespace: "gotop",
|
net.sentMetric = metrics.NewCounter(makeName("net", "sent"))
|
||||||
Subsystem: "net",
|
|
||||||
Name: "recv",
|
|
||||||
})
|
|
||||||
prometheus.MustRegister(net.recvMetric)
|
|
||||||
|
|
||||||
net.sentMetric = prometheus.NewCounter(prometheus.CounterOpts{
|
|
||||||
Namespace: "gotop",
|
|
||||||
Subsystem: "net",
|
|
||||||
Name: "sent",
|
|
||||||
})
|
|
||||||
prometheus.MustRegister(net.sentMetric)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (net *NetWidget) update() {
|
func (net *NetWidget) update() {
|
||||||
|
@ -138,8 +127,8 @@ func (net *NetWidget) update() {
|
||||||
net.Lines[0].Data = append(net.Lines[0].Data, int(recentBytesRecv))
|
net.Lines[0].Data = append(net.Lines[0].Data, int(recentBytesRecv))
|
||||||
net.Lines[1].Data = append(net.Lines[1].Data, int(recentBytesSent))
|
net.Lines[1].Data = append(net.Lines[1].Data, int(recentBytesSent))
|
||||||
if net.sentMetric != nil {
|
if net.sentMetric != nil {
|
||||||
net.sentMetric.Add(float64(recentBytesSent))
|
net.sentMetric.Add(int(recentBytesSent))
|
||||||
net.recvMetric.Add(float64(recentBytesRecv))
|
net.recvMetric.Add(int(recentBytesRecv))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"sort"
|
"sort"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/VictoriaMetrics/metrics"
|
||||||
ui "github.com/gizak/termui/v3"
|
ui "github.com/gizak/termui/v3"
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
|
||||||
|
|
||||||
"github.com/xxxserxxx/gotop/v4/devices"
|
"github.com/xxxserxxx/gotop/v4/devices"
|
||||||
"github.com/xxxserxxx/gotop/v4/utils"
|
"github.com/xxxserxxx/gotop/v4/utils"
|
||||||
|
@ -28,7 +28,7 @@ type TempWidget struct {
|
||||||
TempLowColor ui.Color
|
TempLowColor ui.Color
|
||||||
TempHighColor ui.Color
|
TempHighColor ui.Color
|
||||||
TempScale TempScale
|
TempScale TempScale
|
||||||
tempsMetric map[string]prometheus.Gauge
|
temps map[string]float64
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewTempWidget(tempScale TempScale, filter []string) *TempWidget {
|
func NewTempWidget(tempScale TempScale, filter []string) *TempWidget {
|
||||||
|
@ -68,16 +68,12 @@ func NewTempWidget(tempScale TempScale, filter []string) *TempWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (temp *TempWidget) EnableMetric() {
|
func (temp *TempWidget) EnableMetric() {
|
||||||
temp.tempsMetric = make(map[string]prometheus.Gauge)
|
temp.temps = make(map[string]float64)
|
||||||
for k, v := range temp.Data {
|
for k, _ := range temp.Data {
|
||||||
gauge := prometheus.NewGauge(prometheus.GaugeOpts{
|
kc := k
|
||||||
Namespace: "gotop",
|
metrics.NewGauge(makeName("temp", k), func() float64 {
|
||||||
Subsystem: "temp",
|
return float64(temp.Data[kc])
|
||||||
Name: k,
|
|
||||||
})
|
})
|
||||||
gauge.Set(float64(v))
|
|
||||||
prometheus.MustRegister(gauge)
|
|
||||||
temp.tempsMetric[k] = gauge
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,9 +105,6 @@ func (temp *TempWidget) Draw(buf *ui.Buffer) {
|
||||||
image.Pt(temp.Inner.Min.X, temp.Inner.Min.Y+y),
|
image.Pt(temp.Inner.Min.X, temp.Inner.Min.Y+y),
|
||||||
)
|
)
|
||||||
|
|
||||||
if temp.tempsMetric != nil {
|
|
||||||
temp.tempsMetric[key].Set(float64(temp.Data[key]))
|
|
||||||
}
|
|
||||||
temperature := fmt.Sprintf("%3d°%c", temp.Data[key], temp.TempScale)
|
temperature := fmt.Sprintf("%3d°%c", temp.Data[key], temp.TempScale)
|
||||||
|
|
||||||
buf.SetString(
|
buf.SetString(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user