Skip to content

Commit

Permalink
Squash Riaknostic commits prior to Weather Report fork
Browse files Browse the repository at this point in the history
I think I'm done with shell scripts for now.

Port to Perl.

Some cleaning up of the Perl code.

Add check for ring_creation_size != num_partitions.

Check if the Riak node is running.

Prefer riak over riaksearch when looking for commands.

Make it a proper hash.

Fetch number of nodes in the ring.

Look for crash dumps and emfile errors.

Add checks for number of partitions vs. nodes and for not being part of the ring.

Align status output for easier parsing.

Check number of connected nodes vs. ring members.

Use a better ratio for partitions vs. nodes.

Add some checks if the node is running to prevent errors in checks.

Start porting Riaknostic to Erlang.

Remove io:format that's broken anyway.

Remove shell script version.

Fetch and start printing data from the Riak instance.

Add Riak installation detection.

Find Riak logs.

Less code is good. Just tail-recurse it.

Change run code to use a config dict.

Add module to test for ring membership.

Add more check modules.

Add module to check for connected nodes.

Fixed ping riak to work more consistantly.

General code cleanup.

Moved log directories into the riaknostic.app.

Removed unneccassary filter code.

Updated rebar to the current version

Scriptized. Name and cookie can be passed in as parameters.

Added a README

Added type specs.

Added more output to nodes connected.

Added node to Config dict.

Added initial version of disk check.

Added noatime check for all mounted disks.

Removed flag to specify vm name because it's not needed.

Exrcised riaknostic node from connected node list.

Removed perl script.

Added dizzy's bitcask large value check.

Better output from nodes connected

Got rid of unnecessary sup.

More readable output.

Fixed incorrect application start callback return.

Memory use stats

Improved organization
Added util library

Added ability to output warnings and errors from riaknostic modules.

Added a gen_server for logging.

Improved logging with more logical strucutre

Using list:keyfind for OTP release per Sean's comment

Added conversion from binary to float
Fixed issue with higher memory usage check

vm.args can now be parsed in
A bit of cleanup

Integrated lager

Improved code organization
Moved from dicts to basic prop lists
Added all ebin directories in riak lib to path
Riaknostics are discovered via their run/1 methods

Added lots of command line configuration

Added sibling and vclock options to large value check

Added a guard to bitcask_threshold_check function

Key vals are binary_to_termed before printing.

Inserted tabs in readme - usage

Fixed broken lager:warning call.

Add license headers to all source files. Closes #3.

Upgrade rebar.

Add a Makefile, copied from lager.

Add check-module behavior according to plan.

Starting refactor of check modules.

Refactor memory use, add TODOs.

Refactor ring membership.

Added noatime check.

Getting the DataDir from riaknostic_config won't work, but if DataDir is set correctly, it is a valid noatime check.

Refactor nodes connected and fix some compilation bugs.

Refactor ring size check.

Fix typo/syntax error.

Rename disk check module.

Add ability to identify modules that are checks.

Update TODOs.

Refactor Joe's disk check module.

Add a little documentation to the private functions.

Add getopt, cleanup unused or antiquated modules.

Switching to use a global notion of the config, probably app env but TBD.

Do a little line-wrapping.

WIP riaknostic_config accessors.

Add top-level script with getopt and check descriptions.

Remove high-impact bitcask check.

Implement a huge swath of the runner, disk check works!

application:get_env/2 returns {ok, Value}.

Absolutize data directories.

Expose base_dir/0 and etc_dir/0.

Adjust crash dump detector to use base_dir().

Recognize -sname switch and distinguish between short and long names.

Added riaknostic_node module for interacting with the local/cluster nodes.

Fix a few bugs and enhance debugging information.

* Messages are properly sorted now.
* Match output of ps command properly.
* Add debug logging of node-connection logic.
* Improve detection of node connectivity.

Fix docs target, ignore generated docs.

Add edoc overview, initial stylesheet.

Finish up some styles and documentation, more detail on behaviour needed.

Add a more verbose description of the behaviour.

Make clear that this stylesheet is for edoc.

Initial version of the landing page.

Don't need to link to edoc, reflow some of those paragraphs.

Ignore parts of the gh-pages branch.

WIP make pages.

Add forkme ribbon.

Make sure to ignore root PNG files and add the new image to the pages.

Remove useless memsup info.

Added Dr. Basho. Thanks @jgnewman! Closes #13.

Build package tarball. Closes #12.

Update the README.

Minor wording correction, add missing docs to riaknostic_node.

Add a word of caution.

Solaris ps doesn't understand -o command and we don't use it anyway.

Forgot to stage this line.

Use -nocookie to prevent usage of the .erlang.cookie file. Closes #16.

Fedora installs Riak libraries to /usr/lib64. Closes #18

Setup dialyzer.

Fix dialyzer warnings.

Check for:
* Ring sizes not a multiple of 2
* Deployments where vnodes/node < 3% of ring size
* Deployments where vnodes/node > 70% of ring size

Change ring size inappropriate check from multiple of 2 to power of 2.

Leave out the ring size/vnode messages until we have a better
understanding of the relationship and can give better advice.

Fix a few mistakes.

Fix cluster_command

  1 Added check for ring preflists satisfying n_val

Check whether search is enabled on all nodes

v1.0.1

Update lager dependency

Changed regex split to string tokens. Fixes failure in Ubuntu

Fix xargs argument for Linux

eaccess -> eacces to catch the error correctly

Add can_connect_all to check if all nodes are available.

The reason for this, is that for search we're checking if search is enabled
or disabled on all nodes. If a node is down, this is not a valid test, and
errors out otherwise.

Check if connected first before running all connected

Travis CI config

Ignore .eunit folder

Add meck as a dependency

Initial eunit test for riaknostic_check_ring using meck

v1.0.2

Add Travis CI Build Status to README.md

some work on the docs re: 26 & 29

add lines for the autosaves of the one true editor

Added some reassuring output.

Just a few lines so that the runner of the command knows that riaknostic
is running and that it exited without error.

Update README.md

SmartOS has different paths from standard Solaris, using pkg_add package with current version 1.2

add basic sysctl checking

Removed freeBSD stuff

end of the day temp commit, code still kind of broken

move stuff to zip rather than os:cmd
added multiple platform support.
a couple of bugs/features:
 - we also need to be able to just grab
   a copy of a file
 - we need a list of tests for each platform
 - need cases for sunos and freebsd
 - fold in regular diagnostic messages (once I
   land the fix for #14).
 - there is a bug in shelling out, only some of the
   output is actually recorded.

another broken checkin, so I can work on something else

added the ability to copy out named files
changed the where the files were stored before
cleanup to CWD.

update to flesh out the export command a bit more.
still needs much testing, especially on smartos

clean up, fix some bugs, add directory-grabbing

added a (bad) first pass at machine-readable output

midstream checking to get back to work on export

added a (bad) first pass at machine-readable output

midstream checking to get back to work on export

Changed getopt version, one other fix

Fix default output

Added some comments and TODO's

Fix lager dependency version now that lager was updated

Fixate lager dependency on 1.2.1

Change dep on lager to 1.2.2 to match the rest of riak

Roll version riaknostic 1.1.0

Clarify that Riak 1.3 already has Riaknostic installed

removed misplaced parathesis

Add OpenBSD bits

Update lager dep to 2.0.0rc2

Lager to 2.0.0 final

Un-escriptize riaknostic and modify for lager 2.0 compatability

Add an extra log line for clarity when running non-existent checks

newline fix

Restore riaknostic output to console

When riaknostic became part of Riak instead of a separate app, its
output (through lager) ended up in the node's console.log instead of
being output by 'riak-admin diag'. Among other things, this broke the
riaknostic_rt riak test. This adds a layer on top of lager, so messages
can be directed to the console again, simply by using io:format. This
way, messages are sent to the group_leader instead of the user process,
which is what the lager backend does. When riaknostic is invoked through
RPC by riak-admin, the caller becomes the group leader and picks up
those messages. I wish there was a cleaner way to do this leveraging
something in lager, but I couldn't find any.

Roll riaknostic version 1.2.0

Pin meck dependency to a specific tag

Remove sysctl checks

Sysctl checks are now handled by the riak_kv_env module.

Standardize meck dep

Standardize on a rebar.config dep format to reduce conflicts

pull app.config and vm.args from init:get_arguments

added extra -vm_args to CONFIG_ARGS for easy access by erlang vm

Roll riaknostic 1.2.1 to pull in lager 2.0.1

Fix rebar.config url to stay consistent

Bump lager dep to 2.0.2

Bump lager dep to 2.0.3

- Adds a check for strong consistency configuration -- warning when
  strong consistency is enabled and AAE is disabled
  (defect basho/riak_kv#959)
  • Loading branch information
roidrage authored and jaydoane committed Apr 19, 2021
1 parent 6fff405 commit 920d005
Show file tree
Hide file tree
Showing 32 changed files with 2,622 additions and 47 deletions.
13 changes: 13 additions & 0 deletions src/weatherreport/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
doc/
deps/
ebin/*
log/
edoc/
index.html
riaknostic
*.png
pkg/
erl_crash.dump
.eunit/
*~
#*#
5 changes: 5 additions & 0 deletions src/weatherreport/.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
src
riaknostic
doc
LICENSE
README.md
8 changes: 8 additions & 0 deletions src/weatherreport/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: erlang
notifications:
disabled: true
env:
- R15B
- R14B04
- R14B03
- R14B02
86 changes: 86 additions & 0 deletions src/weatherreport/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Riaknostic Development

Riaknostic requires a sane GNU build system and a recent version of
Erlang. It has `lager` and `getopt` as dependencies, so those must be
compatible with your version of Erlang. Release versions are currently
built with Erlang version R14B03, while development versions are targeted at Erlang version R14B04.

See the `rebar.config` file for more details.

To build Riaknostic, simply run `make`:

```bash
$ make
./rebar get-deps
==> riaknostic (get-deps)
Pulling lager from {git,"git://github.com/basho/lager",{branch,"master"}}
Cloning into lager...
Pulling getopt from {git,"git://github.com/jcomellas/getopt.git","2981dfe"}
Cloning into getopt...
==> lager (get-deps)
==> getopt (get-deps)
./rebar compile
==> lager (compile)
Compiled src/lager_util.erl
Compiled src/lager_transform.erl
Compiled src/lager_sup.erl
Compiled src/lager_mochiglobal.erl
Compiled src/lager_stdlib.erl
Compiled src/lager_handler_watcher_sup.erl
Compiled src/lager_handler_watcher.erl
Compiled src/lager_trunc_io.erl
Compiled src/lager_crash_log.erl
Compiled src/lager_file_backend.erl
Compiled src/lager_app.erl
Compiled src/lager.erl
Compiled src/lager_console_backend.erl
Compiled src/lager_format.erl
Compiled src/error_logger_lager_h.erl
==> getopt (compile)
Compiled src/getopt.erl
==> riaknostic (compile)
Compiled src/riaknostic_check.erl
Compiled src/riaknostic_util.erl
Compiled src/riaknostic_node.erl
Compiled src/riaknostic_check_ring_size.erl
Compiled src/riaknostic_check_ring_membership.erl
Compiled src/riaknostic_config.erl
Compiled src/riaknostic_check_memory_use.erl
Compiled src/riaknostic_check_nodes_connected.erl
Compiled src/riaknostic_check_dumps.erl
Compiled src/riaknostic.erl
Compiled src/riaknostic_check_disk.erl
./rebar escriptize
==> lager (escriptize)
==> getopt (escriptize)
==> riaknostic (escriptize)
```

Now you can invoke the script manually via the below command:

```bash
$ ./riaknostic --etc ~/code/riak/rel/riak/etc --base ~/code/riak/rel/riak --user `whoami` [other options]
```

To generate the edoc reference, use `make docs` and then open the
`doc/index.html` file in your browser. Detailed discussion of the
internal APIs that you can use in developing new diagnostics is found
in the edocs.

## Contributing

Have an idea for a diagnostic? Want to improve the way Riaknostic works? Fork the [github repository](https://github.com/basho/riaknostic) and send us a pull-request with your changes! The code is documented with `edoc`, so give the [API Docs](http://riaknostic.basho.com/edoc/index.html) a read before you contribute.

### Developing for Riaknostic Without a Riak Instance

If you want to run the `riaknostic` script while developing, and you don't have it hooked up to your local Riak, you can invoke it directly like so:

```bash
./riaknostic --etc ~/code/riak/rel/riak/etc --base ~/code/riak/rel/riak --user `whoami` [other options]
```

The extra options are usually assigned by the `riak-admin` script for you, but here's how to set them:

* `--etc`: Where your Riak configuration directory is, in the example above it's in the generated directory of a source checkout of Riak.
* `--base`: The "base" directory of Riak, usually the root of the generated directory or `/usr/lib/riak` on Linux, for example. Scan the `riak-admin` script for how the `RUNNER_BASE_DIR` variable is assigned on your platform.
* `--user`: What user/UID the Riak node runs as. In a source checkout, it's the current user, on most systems, it's `riak`.
178 changes: 178 additions & 0 deletions src/weatherreport/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.

"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.

2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.

3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.

4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:

(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and

(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and

(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and

(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.

You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.

5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.

6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.

8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

85 changes: 85 additions & 0 deletions src/weatherreport/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
.PHONY: rel stagedevrel deps test

all: deps compile

compile:
./rebar compile

deps:
./rebar get-deps

clean:
./rebar clean

distclean: clean
./rebar delete-deps

test:
./rebar compile eunit

escriptize:
./rebar escriptize

##
## Doc targets
##
docs:
./rebar doc skip_deps=true

pages: docs
cp priv/index.html doc/_index.html
cp priv/ForkMe_Blk.png doc/
cp priv/*.jpg doc/
git checkout gh-pages
mv doc/_index.html ./index.html
mv doc/ForkMe_Blk.png .
mv doc/*.jpg .
rm -rf edoc/*
cp -R doc/* edoc/
git add .
git add -u
git commit
git push origin gh-pages
git checkout master

##
## Release targets
##
VSN = `grep vsn src/riaknostic.app.src | cut -f 2 -d "\""`

package: all docs
@mkdir -p pkg/riaknostic
@rm -rf pkg/riaknostic/*
@cat .manifest | xargs -n 1 -I % cp -R % pkg/riaknostic/.
@tar -czf pkg/riaknostic-$(VSN).tar.gz -C pkg riaknostic

##
## Dialyzer targets
##
APPS = kernel stdlib sasl erts ssl tools os_mon runtime_tools crypto inets \
xmerl webtool snmp public_key mnesia eunit syntax_tools compiler
COMBO_PLT = $(HOME)/.riak_combo_dialyzer_plt

check_plt: compile
dialyzer --check_plt --plt $(COMBO_PLT) --apps $(APPS)

build_plt: compile
dialyzer --build_plt --output_plt $(COMBO_PLT) --apps $(APPS)

dialyzer: compile
@echo
@echo Use "'make check_plt'" to check PLT prior to using this target.
@echo Use "'make build_plt'" to build PLT prior to using this target.
@echo
@sleep 1
dialyzer -Wno_return --plt $(COMBO_PLT) ebin deps/*/ebin | \
fgrep -v -f ./dialyzer.ignore-warnings

cleanplt:
@echo
@echo "Are you sure? It takes about 1/2 hour to re-build."
@echo Deleting $(COMBO_PLT) in 5 seconds.
@echo
sleep 5
rm $(COMBO_PLT)

Loading

0 comments on commit 920d005

Please sign in to comment.