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

Icinga: actionExecutor.py doesn't assure the working dir while generation Zip file(s) #72

Open
b-a-t opened this issue Mar 22, 2021 · 2 comments

Comments

@b-a-t
Copy link

b-a-t commented Mar 22, 2021

During processing of the alert integration script tries to create ZIPed observation document with histogram and trend images from Icinga.

As a first step of it it creates a ZIP file with the embedded date in the name, but doesn't specify in which directory that file will be created.

actionExecutor.py#L259

Apparently, somewhere in the process the current working directory either changes or initially set to the non-writable directory.

Hence, we are getting this error:

Executed [Create] action via OEC[integrationId: fd2c40c5-xxxxxxxxxxxxxxxxxxx integrationType: Icinga] with errors.
Reason: Err: exit status 1, Stderr: 
Traceback (most recent call last): 
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 425, in <module> main() 
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 408, in main send_create_request() 
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 288, in send_create_request attach() 
File "/home/opsgenie/oec/scripts/actionExecutor.py", line 261, in attach zip = zipfile.ZipFile(file_name, 'w') 
File "/usr/lib64/python3.6/zipfile.py", line 1113, in __init__ self.fp = io.open(file, filemode) PermissionError: [Errno 13] 
Permission denied: 'details_2021_03_21_21_03_1616359507.zip' 

Either script should set CWD in the beginning to it's home directory(and hope it's writable) or should use /tmp or /var/tmp for creating a temporary ZIP file or should have an option to specify writable tmp directory and use it in the filename.

Also, readability of the script may benefit from using f'strings or format...

@jbeisser
Copy link

I see this has been open for over a year.

I just encountered this problem, with the Python3 wrapper issue (due to CentOS 7) with the Nagios OEC.

@ghost
Copy link

ghost commented Nov 23, 2022

Hi @b-a-t, you can track the progress about the issue from this ticket

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