Trying to configure jmxeval plugin to Nagwin - jmx

I get this respond from CMD after checking the jmxeval plugin during setting up,
Command: check_jmxeval.bat
CMD output:
C:\Nagwin_x64\plugins>check_jmxeval.bat
org.kohsuke.args4j.CmdLineException: Argument "<filename>" is required
at org.kohsuke.args4j.CmdLineParser.parseArgument(CmdLineParser.java:448)
at com.adahas.tools.jmxeval.App.execute(App.java:43)
at com.adahas.tools.jmxeval.App.main(App.java:110)
Argument "<filename>" is required
java -jar jmxeval.jar <filename> [--schema <version>] [--set (--define) <name=value>] [--validate <boolean>]
--schema <version> : set schema version
--set (--define) <name=value> : set variable name to value
--validate <boolean> : set validation true|false, default is false
I am following the steps in google code project: https://code.google.com/archive/p/jmxeval/wikis/GettingStarted.wiki

Argument "<filename>" is required
You need to pass as argument to the script the path to the xml file containing the instructions on what to check

Related

The term 'System.DefaultWorkingDirectory' is not recognized in YAML pipeline

I had a pipeline with PowerShell task that run some python script. It worked without any problems.
After I convert my pipeline into YAML format to store it as code and got something like this (a part of whole yaml pipeline):
variables:
Build.SyncSources: false
REPO_PATH_DA: '/asdfg/qwerty'
REPO_PATH_DS: '/zxcvbn/tyuio'
PIP_REPO_HOST: 'bbbb.nnnn.yyyy.com'
PIP_REPO_URL: 'https://$(PIP_REPO_HOST)/api/pypi/pypi/simple'
PIP_VENV_NAME: 'my_test_venv'
SelectedBranch: ''
WorkingDirectory: $(System.DefaultWorkingDirectory)
…………………………………………….
- task: PowerShell#1
displayName: 'Install package'
inputs:
scriptType: inlineScript
inlineScript: |
.\$(PIP_VENV_NAME)\Scripts\activate
python.exe -m pip install --index-url=$(PIP_REPO_URL) --trusted-host=$(PIP_REPO_HOST) mypackage
python.exe -m pip install --index-url=$(PIP_REPO_URL) --trusted-host=$(PIP_REPO_HOST) $(WorkingDirectory)$(REPO_PATH_DA)\qwerty
And after I run this pipeline I get an error:
##[error]System.DefaultWorkingDirectory : The term 'System.DefaultWorkingDirectory' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I tried to change the name of variable in format: $(env:System_DefaultWorkingDirectory) , but no success. I suppose that predefined variables are not passed into yaml pipeline. Do you have any ideas how to resolve it?
Based on my test, the same script could work fine in my yaml pipeline. The $(WorkingDirectory) will be converted to paths xxx/xx/s.
To check if the predefined variable: $(System.DefaultWorkingDirectory) has been passed to Yaml Pipeline.
You could add a task to list all Environment variables:
steps:
- script: SET | more
In the task log, you could search the SYSTEM_DEFAULTWORKINGDIRECTORY and check if the variable exists.
For example:
If this environment variable exists, you could try to use the following format: $env:SYSTEM_DEFAULTWORKINGDIRECTORY
Here is the example:
variables:
Build.SyncSources: false
.....
WorkingDirectory: '$env:SYSTEM_DEFAULTWORKINGDIRECTORY'
If you couldn't find this variable, you can also check if there are equivalent variables.
For example:
BUILD_SOURCESDIRECTORY , BUILD_REPOSITORY_LOCALPATH
Is this a build or a release pipeline? If it's a release, you may need to use $(Pipeline.Workspace) instead of $(System.DefaultWorkingDirectory).
Also, have you tried using $(System.WorkingDirectory) directly in your Powershell task, instead of declaring a variable that references it?

Docker-compose variable-substitution mandatory variables

I have a docker-compose file that uses variable substitution for some secrets and I want to get an error if they are not supplied or empty, for this purpose I have tried this:
environment:
- >-
JAVA_OPTS=
-DMYSQL_USER=${MYSQL_USER:?MYSQL_USER_NOT_SET}
-DMYSQL_PASSWORD=${MYSQL_PASSWORD:?MYSQL_PASSWORD_NOT_SET}
-DMYSQL_URL=db:3306/${MYSQL_DATABASE:?MYSQL_DATABASE_NOT_SET}
However, it gives me the error:
ERROR: Invalid interpolation format for "environment" option in service "myservice": "JAVA_OPTS= -DMYSQL_USER=${MYSQL_USER:?MYSQL_USER_NOT_SET}...
According to https://docs.docker.com/compose/compose-file/#variable-substitution this should work since it has this snippet:
Similarly, the following syntax allows you to specify mandatory
variables:
${VARIABLE:?err} exits with an error message containing err if
VARIABLE is unset or empty in the environment. ${VARIABLE?err} exits
with an error message containing err if VARIABLE is unset in the
environment.
I also have version: "3.4" in my docker-compose so that shouldn't be the issue.
Already tried it with just ${MY_VAR?MY_ERROR} but it didn't work either.
I have even gone as far as to look at the source code but found nothing helpful.
EDIT :
I tried to make a minimum size reproduction:
docker-compose.yml
version: "3.4"
services:
hello:
image: hello-world
environment:
- TEST=${TEST?err}
docker-compose up
ERROR: Invalid interpolation format for "environment" option in service "hello": "TEST=${TEST?err}
This depends on your docker-compose version.
With docker-compose 1.17.1 you will get
ERROR: Invalid interpolation format for "environment" option in service "my-service": ...
if you use ${TEST?"My error message"} but with
e.g. docker-compose 1.29.2 it works as expected
ERROR: Missing mandatory value for "environment" option interpolating ... in service "my-service": "My error message"

Knife bootstrap failing through Jenkins execute shell

I'm trying to perform a "knife bootstrap" command through Jenkins web UI execute shell, but I keep getting this error message :
(this is the knife bootstrap command I'm using) :
"knife bootstrap [the node's IP] --ssh-user ec2-user --sudo --identity-file "[my key to the node]" --node-name My123 --run-list 'role[role1]' "
and this is the error message:
" ERROR: Errno::ENOENT: No such file or directory # rb_sysopen - /etc/chef/validation.pem "
when I run the 'knife bootstrap' command directly through the CLI it works fine.
any idea why it's not working from Jenkins execute shell?
It is due to validation.pem file is missing, this is default path for validation file. Either you can set path in /chef-repo/.chef/knife.rb file or you can use default location /etc/chef/validation.pem.
You can regenerate validation key from webUI and replace the existing one, this should resolve your issue.

symfony/yaml backed symfony/config not parsing environment variables

I have recreated a simple example in this tiny github repo. I am attempting to use symfony/dependency-injection to configure monolog/monolog to write logs to php://stderr. I am using a yaml file called services.yml to configure dependency injection.
This all works fine if my yml file looks like this:
parameters:
log.file: 'php://stderr'
log.level: 'DEBUG'
services:
stream_handler:
class: \Monolog\Handler\StreamHandler
arguments:
- '%log.file%'
- '%log.level%'
log:
class: \Monolog\Logger
arguments: [ 'default', ['#stream_handler'] ]
However, my goal is to read the path of the log files and the log level from environment variables, $APP_LOG and LOG_LEVEL respectively. According to The symphony documentations on external paramaters the correct way to do that in the services.yml file is like this:
parameters:
log.file: '%env(APP_LOG)%'
log.level: '%env(LOGGING_LEVEL)%'
In my sample app I verified PHP can read these environment variables with the following:
echo "Hello World!\n\n";
echo 'APP_LOG=' . (getenv('APP_LOG') ?? '__NULL__') . "\n";
echo 'LOG_LEVEL=' . (getenv('LOG_LEVEL') ?? '__NULL__') . "\n";
Which writes the following to the browser when I use my original services.yml with hard coded values.:
Hello World!
APP_LOG=php://stderr
LOG_LEVEL=debug
However, if I use the %env(VAR_NAME)% syntax in services.yml, I get the following error:
Fatal error: Uncaught UnexpectedValueException: The stream or file "env_PATH_a61e1e48db268605210ee2286597d6fb" could not be opened: failed to open stream: Permission denied in /var/www/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107 Stack trace: #0 /var/www/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array) #1 /var/www/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array) #2 /var/www/vendor/monolog/monolog/src/Monolog/Logger.php(532): Monolog\Logger->addRecord(100, 'Initialized dep...', Array) #3 /var/www/html/index.php(17): Monolog\Logger->debug('Initialized dep...') #4 {main} thrown in /var/www/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
What am I doing wrong?
Ok you need a few things here. First of all you need version 3.3 of Symfony, which is still in beta. 3.2 was the released version when I encountered this. Second you need to "compile" the environment variables.
Edit your composer.json with the following values and run composer update. You might need to update other dependencies. You can substitute ^3.3 with dev-master.
"symfony/config": "^3.3",
"symfony/console": "^3.3",
"symfony/dependency-injection": "^3.3",
"symfony/yaml": "^3.3",
You will likely have to do this for symfony/__WHATEVER__ if you have other symfony components.
Now in you're code after you load your yaml configuration into your dependency container you compile it.
So after you're lines here (perhaps in bin/console):
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . DIRECTORY_SEPARATOR . '..'));
$loader->load('services.yml');
Do this:
$container->compile(true);
Your IDE's intellisense might tell you compile takes no parameters. That's ok. That's because compile() grabs its args indirectly via func_get_arg().
public function compile(/*$resolveEnvPlaceholders = false*/)
{
if (1 <= func_num_args()) {
$resolveEnvPlaceholders = func_get_arg(0);
} else {
. . .
}
References
Github issue where this was discussed
Pull request to add compile(true)
Using this command after loading your services.yaml file should help.
$containerBuilder->compile(true);
given your files gets also validated by the checks for proper configurations which this method also does. The parameter is $resolveEnvPlaceholders which makes environmental variables accessible to the yaml services configuration.

Running jshint with Rhino shell using configure option

According to GitHub JSHint,
Configuration File Support For Rhino Wrapper #704 issues was closed and support for configuration file was provided [https://github.com/jshint/jshint/issues/704]
I am using Rhino1_7R4 and jshint-rhino-2.5.2.js
Trying to execute this cmd line -
java -jar rhino.jar jshint.js samplefile.js --configure=config.json
but none of the options I specified in the config file seems to take effect.
This is my config.json file:
{
"maxerr" : 150,
"asi" : true,
"expr" : true
}
Also, when trying to specify multiple options via command line, only the first one seems to take effect.
java -jar rhino.jar jshint.js samplefile.js asi=true expr=true
Thanks for your help!

Resources