mtakaki / cachet-url-monitor

URL monitor plugin for cachethq.io
MIT License
125 stars 49 forks source link

IsADirectoryError: [Errno 21] Is a directory: 'config/config.yml' #75

Closed antoine19 closed 4 years ago

antoine19 commented 4 years ago

Hello,

Sorry but i may sounds weird because i am bit confused on how to run with docker. I first pull the image from the docker hub and then i get an erroor with this command:

docker run --rm -it -v "$PWD":/usr/src/app/config/ mtakaki/cachet-url-monitor

and i get this :

Traceback (most recent call last): File "./cachet_url_monitor/scheduler.py", line 90, in scheduler = Scheduler(sys.argv[1]) File "./cachet_url_monitor/scheduler.py", line 56, in init self.configuration = Configuration(config_file) File "/usr/local/lib/python3.7/site-packages/cachet_url_monitor-0.5-py3.7.egg/cachet_url_monitor/configuration.py", line 84, in init self.data = load(open(self.config_file, 'r'), Loader=FullLoader) IsADirectoryError: [Errno 21] Is a directory: 'config/config.yml'

I am a bit confused if i need to clone the repository or i just need to add a yml on my current directory . Also i was wondering if i need to get the repository to the yml file (/usr/src/app/config/) in my current directory. Thank you in advance for the answers

mtakaki commented 4 years ago

You just need to add a yaml file in your directory. Do you have a local config.yml in your directory? It sounds like it's a directory, not a file based on the error message.

antoine19 commented 4 years ago

Hello, Yes i do have a file "config.yml" in local.

Then also when I run: docker run --rm -it -v "$PWD"/my_config.yml:/usr/src/app/config/config.yml:ro mtakaki/cachet-url-monitor

When i check on Kitematic, it is going to create a folder "config.yml" inside config (on my container repo) . This is where the error "Is a Directory" comes from. --> config/config.yml --> it runs but note with my configuration file my_config.yml ( it pings URL http://localhost:8080/swagger instead)

The issu is i can't acces my container repo (usr\src\app\config) until i run the image.

Maybe my configuration file "my_config.yml" is not in the right place.

mtakaki commented 4 years ago

So, I tried reproducing the same error you're getting and I only get it if I create a directory named config.yml, like this:

$ mkdir config.yml
$ docker run --rm -it -v "$PWD":/usr/src/app/config/ mtakaki/cachet-url-monitor
Traceback (most recent call last):
  File "./cachet_url_monitor/scheduler.py", line 90, in <module>
    scheduler = Scheduler(sys.argv[1])
  File "./cachet_url_monitor/scheduler.py", line 56, in __init__
    self.configuration = Configuration(config_file)
  File "/usr/local/lib/python3.7/site-packages/cachet_url_monitor-0.5-py3.7.egg/cachet_url_monitor/configuration.py", line 84, in __init__
    self.data = load(open(self.config_file, 'r'), Loader=FullLoader)
IsADirectoryError: [Errno 21] Is a directory: 'config/config.yml'

Could you please confirm you have a config.yml file (not directory) in your current directory when you're calling docker?

antoine19 commented 4 years ago

Hello, Yes i do have a file "config.yml" in my local repository. I think the problem is coming from the fact that i have two volumes mounted on my container: -usr\src\app\config\ -usr\src\app\conf\

So when i run : docker run --rm -it -v "$PWD":/usr/src/app/conf/ mtakaki/cachet-url-monitor

It runs but still with another fill. By default it seems that it will look in this container repo and ignores the other container repo.(usr\src\app\config)

mtakaki commented 4 years ago

On which OS are you running this?

antoine19 commented 4 years ago

I am using Windows (not Pro).

I deleted the container and re-pull image and run the container with Kitematic. I have now a local repo with a config.yml inside.

Capture

Its running and now my issue seems to be coming from the Cachet API now.

Capture2

mtakaki commented 4 years ago

Name does not resolve sounds like your domain name is incorrect. Sometimes in docker you can get dns issues, if you don't configure the dns properly on your container. Is it an internal domain name that is only resolved by your internal dns server? Or is it a public one?

antoine19 commented 4 years ago

Ok thanks, my bad i made a mistake when entering the cachet API. I think my last issue is coming from the metric now during the uploading. It is weird because i do have two metric in my cachet server (with id: 1 and id: 2) Do i need token to access them ? Because when entering (http://hostname/api/v1/metrics) i get them without any token ? Capture0

antoine19 commented 4 years ago

Hi,

Indeed, i need an API token. Ok now i have everything working fine, thank you for your help. I was just wondering if it would be possible to monitor multiple URL at the send time with the configuration file (.yml) ?

mtakaki commented 4 years ago

@antoine19 this is now supported on the latest release. You can refer to the readme on how to set it up.

mtakaki commented 4 years ago

I'm closing this issue as it's not a problem anymore.

tayanov commented 1 year ago

before create container, make empty config file, then start container. Because container make not file, but folder.