Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck at make for elm - does not find jinja2 #35

Open
sarohayan opened this issue Jan 28, 2024 · 5 comments
Open

Stuck at make for elm - does not find jinja2 #35

sarohayan opened this issue Jan 28, 2024 · 5 comments
Assignees

Comments

@sarohayan
Copy link

Running Ubuntu 22.04.3 on WSL2 in windows
I am unable to get elm to make

myusername@mylaptop:~/elm$ make
which curl
/usr/bin/curl
which jq
/usr/bin/jq
which python3
/usr/bin/python3
which jinja2
make: *** [Makefile:127: JINJA-exists] Error 1

Jinja2 is installed via pip
myusername@mylaptop~/elm$ pip install jinja2
WARNING: The directory '/home/mysername/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: jinja2 in /home/mysername/.local/lib/python3.11/site-packages (3.1.3)
Requirement already satisfied: MarkupSafe>=2.0 in /home/mysername/.local/lib/python3.11/site-packages (from jinja2) (2.1.4)

@rdmarsh rdmarsh self-assigned this Jan 29, 2024
@rdmarsh
Copy link
Owner

rdmarsh commented Jan 30, 2024

I don't have a proper environment to test this with, but hopefully this works:

pip install --user jinja2-cli (see https://pypi.org/project/jinja2-cli/)

Then make sure the dir is in the path (/home/mysername/.local/bin) or change line 60 in the Makefile to the full path:

JINJA ?= jinja2

to

JINJA ?= /home/mysername/.local/bin/jinja2

Please let me know if this works.

@rdmarsh
Copy link
Owner

rdmarsh commented Jan 30, 2024

If you don't want to alter the Makefile, you can also run make and override the JINJA variable like this:

make JINJA=/home/mysername/.local/bin/jinja2

@sarohayan
Copy link
Author

your first solution worked, adding jinja2-cli. Now i am running into what looks like an authentication issue with the API key - but it is the right key and and user key. Is here is a syntax maybe i am missing?

my user@DESKTOP-VV9R5KE:~$ ls -al | grep elm
drwx------  2 saro saro  4096 Jan 29 22:04 .elm
drwxr-xr-x 10 saro saro  4096 Jan 29 22:05 elm

myuser@DESKTOP-VV9R5KE:~$ cat .elm/config.ini
access_id = 'xxxxx'
access_key = 'xxxxx'
account_name = 'company'

Anything specific to look at?

@sarohayan
Copy link
Author

sarohayan commented Jan 30, 2024

myuser@DESKTOP-VV9R5KE:~$ elm ReportList
An error occured
ReportList
/report/reports
{'size': 50}
WARNING 2024-01-29 22:09:47,894 engine.py:131 engine not 200 status code: 401
Warning: not 200 status code
{"ReportList": [{"errorMessage": "Authentication failed", "errorCode": 1401, "errorDetail": null}]}

Note - i verified the API key an access key via postman - they are valid and functional

@rdmarsh
Copy link
Owner

rdmarsh commented Feb 1, 2024

Hi sarohayan,

I've tried to recreate the issue, but it's very hard to test. I'm not sure if the key/id is being mangled in some way when it's being read from the config file. I've tried changing perms etc and none of the testing I've done results in a 1401 error except when I mangle the API key on purpose.

I've made a small change to show the api info, if you pull down the latest version you could try running with debug flags to get more info, eg: elm -vv MetricsUsage. This will show sensitive api info so please be careful for security reasons.

Another thing you could try is suppling the credentials from the CLI itself:

elm --access_id ABCDEF --access_key 123456 --account_name COMPANYNAME ...

If this doesn't help, you could you try some code examples from LM. Most of the code in this repo started using their example code as a jumping off point. Any of the "GET" examples would be worth trying.

https://www.logicmonitor.com/support/rest-api-developers-guide/v1/rest-api-v1-examples

If their examples don't work you could raise the issue with LM support.

If their examples do work and my code still doesn't and you can't find the issue using the above tips, I'm sorry but there's not much more I can do to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants