Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Commit

Permalink
MINIFI-430 Provide a batch script for executing Flow Status queries i…
Browse files Browse the repository at this point in the history
…n Windows environments.

This closes #125.

Signed-off-by: Aldrin Piri <aldrin@apache.org>
  • Loading branch information
apiri committed May 24, 2018
1 parent e8c4aae commit a08bc9a
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
14 changes: 12 additions & 2 deletions minifi-docs/src/main/markdown/System_Admin_Guide.md
Expand Up @@ -138,6 +138,16 @@ minifi.sh flowStatus processor:TailFile:health,stats,bulletins
```
Currently the script only accepts one high level option at a time. Also any names of connections, remote process groups, or processors that contain " " (a space), ":", ";" or "," cause parsing errors when querying.

**Note:** The examples in this documentation are provided for *nix based environments. Windows support is also provided by by the `flowstatus-minifi.bat` file. To perform one of the listed interactions, `minifi.sh flowStatus` would simply be replaced by `flowstatus-minifi.bat`. For example, the sample query above in *nix environments,

```
minifi.sh flowStatus processor:TailFile:health,stats,bulletins`
```
would translate to Windows environments as,
```
flowstatus-minifi.bat processor:TailFile:health,stats,bulletins
```

## Periodic Status Reporters

You can set up Periodic Status Reporters to periodically report the status of your dataflow. The query executes at configurable intervals and the results are reported using the configured implementation. Configure the Reporters in the bootstrap.conf file, using the "nifi.minifi.status.reporter.components" key followed by the full path name of the desired Reporter implementation to run. Use a comma separated list to define more than one Reporter implementation. For example:
Expand Down Expand Up @@ -202,7 +212,7 @@ This section outlines each option to query the MiNiFi instance for the FlowStatu

### Processors

To query the processors use the "processor" flag followed by the processor ID or name, to get (or "all") followed by one of the processor options. The processor options are below.
To query the processors use the "processor" flag followed by the processor ID or name, to get (or "all") followed by one of the processor options. The processor options are below. **Note:** In Windows environments, all `minifi.sh flowStatus` invocations should be replaced with `flowstatus-minifi.bat`. See [FlowStatus Script Query](#flowstatus-script-query) for an illustration.

Option | Description
------ | -----------
Expand Down Expand Up @@ -282,7 +292,7 @@ To query the status of the MiNiFi instance use the "instance" flag followed by o

Option | Description
------ | -----------
health | The provenance reporting state, active threads, whether or not it has bulletins and any validation errors.
health | The instance reporting state, active threads, whether or not it has bulletins and any validation errors.
bulletins | A list of all the current bulletins (if there are any).
stats | The current stats of the instance. This including but not limited to bytes read/written and FlowFiles sent/transferred.

Expand Down
@@ -0,0 +1,50 @@
@echo off
rem
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements. See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License. You may obtain a copy of the License at
rem
rem http://www.apache.org/licenses/LICENSE-2.0
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.
rem

call %~sdp0\minifi-env.bat

rem Use JAVA_HOME if it's set; otherwise, just use java

if "%JAVA_HOME%" == "" goto noJavaHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
set JAVA_EXE=%JAVA_HOME%\bin\java.exe
goto startMiNifi

:noJavaHome
echo The JAVA_HOME environment variable is not defined correctly.
echo Instead the PATH will be used to find the java executable.
echo.
set JAVA_EXE=java
goto startMiNifi

:startMiNifi
set MINIFI_ROOT=%~dp0..\
pushd "%MINIFI_ROOT%"
set BOOTSTRAP_LIB_DIR=lib\bootstrap
set LIB_DIR=lib
set CONF_DIR=conf

set BOOTSTRAP_CONF_FILE=%CONF_DIR%\bootstrap.conf
set JAVA_ARGS=-Dorg.apache.nifi.minifi.bootstrap.config.log.dir=%MINIFI_LOG_DIR% -Dorg.apache.nifi.minifi.bootstrap.config.pid.dir=%MINIFI_PID_DIR% -Dorg.apache.nifi.minifi.bootstrap.config.file=%BOOTSTRAP_CONF_FILE%

set JAVA_PARAMS=-cp %CONF_DIR%;%BOOTSTRAP_LIB_DIR%\*;%LIB_DIR%\* -Xms12m -Xmx24m %JAVA_ARGS% org.apache.nifi.minifi.bootstrap.RunMiNiFi
set BOOTSTRAP_ACTION=flowStatus

cmd.exe /C "%JAVA_EXE%" %JAVA_PARAMS% %BOOTSTRAP_ACTION% %1

popd

0 comments on commit a08bc9a

Please sign in to comment.