{"id":20236961,"url":"https://github.com/uniwue-rz/login_exporter","last_synced_at":"2025-07-02T17:32:54.990Z","repository":{"id":128204870,"uuid":"192566665","full_name":"uniwue-rz/login_exporter","owner":"uniwue-rz","description":"A simple Prometheus exporter, that is used to login in a given site and check for a given text. (Mirror Only)","archived":false,"fork":false,"pushed_at":"2019-10-23T11:03:38.000Z","size":42,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-08T16:18:33.285Z","etag":null,"topics":["chrome-driver","exporter","prometheus"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uniwue-rz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-18T15:25:16.000Z","updated_at":"2024-06-19T07:58:34.180Z","dependencies_parsed_at":null,"dependency_job_id":"8ba46591-667a-4aa1-80f0-52f5cbb6b560","html_url":"https://github.com/uniwue-rz/login_exporter","commit_stats":null,"previous_names":[],"tags_count":10,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniwue-rz%2Flogin_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniwue-rz%2Flogin_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniwue-rz%2Flogin_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uniwue-rz%2Flogin_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uniwue-rz","download_url":"https://codeload.github.com/uniwue-rz/login_exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248279687,"owners_count":21077408,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chrome-driver","exporter","prometheus"],"created_at":"2024-11-14T08:24:00.162Z","updated_at":"2025-04-10T19:11:24.454Z","avatar_url":"https://github.com/uniwue-rz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Login Exporter\n\nLogin Exporter is a simple Prometheus exporter that uses Chrome and \nChrome-driver to open a website, to log in and then check for a given\ntext in the result. It simulate the first user interactions for the\ngiven application. This can be used for the general availability test\nof the application for the end users and for status management.\n\n## Installation\n\nThis application it self does not need any installation, copy the binary\nin the given directory should be enough. For running the logins and test\nit uses chrome-headless (chromium-headless) and the chrome-driver, both\nof them should be installed on the given machine. To Install them you\nneed to follow these guides:\n\n### Install on MacOS\n\nTo install the needed dependencies, use brew:\n\n```bash\nbrew install chromedriver\nbrew cask install google-chrome\n```\n\n### Install on Ubuntu\n\nTo install the needed dependencies on Ubuntu:\n\n```bash\n# Install Chrome.\nsudo curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add\nsudo echo \"deb http://dl.google.com/linux/chrome/deb/ stable main\" \u003e\u003e /etc/apt/sources.list.d/google-chrome.list\nsudo apt-get -y update\nsudo apt-get -y install google-chrome-stable\n\n# Install ChromeDriver.\nCHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`\nwget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/\nunzip ~/chromedriver_linux64.zip -d ~/\nrm ~/chromedriver_linux64.zip\nsudo mv -f ~/chromedriver /usr/local/bin/chromedriver\nsudo chown root:root /usr/local/bin/chromedriver\nsudo chmod 0755 /usr/local/bin/chromedriver\n```\n\n## Configuration\n\nThe following parameters can be set for the application:\n\n|  parameter  | default           | help|\n|------------ |-------------------|-----|\n| -config     | login.yml         | The path for the configuration file. This should be readable by running user|\n| -listen_ip  | 127.0.0.1         | The IP address the application should listen to|\n| -listen_port| 9980              | The port the application is listening to|\n| -log_level  | INFO              | The log level for the application|\n| -log_path   | login_exporter.log| The path for the log file. This should be writable by the running user|\n| -timeout    | 60                | The timeout for the application to stop the check in seconds|\n\n\n## Login.YML\n\nThere is an example file `login.yml.dist` available which can be used as\ntemplate for the `login.yml`. For every type of login the following \nparameters should be set:\n\n### Simple Form\n\nThe simple is the most common type of login that is used for different\napplication. As long as no `CAPTCHAS` are used, this should work for every\nkind of login forms. The following parameters should be set:\n\n| parameter      | help           |\n|----------------|----------------|\n| login_type     | simple_form    |\n| target         | The target that is searched for to find the config|\n| url            | The url that login form is included|\n| username       | The username that should be used for the login|\n| password       | The password that should be used for the login|\n| username_xpath | The xpath address of the username field (must be unique)|\n| password_xpath | The xpath address of the password field (must be unique)|\n| submit_xpath   | The xpath address of the submit button (must be unique)|\n| expected_text  | The text that is expected to be there|\n\nThe following parameters are optional:\n\n| parameter          | help           |\n|--------------------|----------------|\n| expected_text_xpath| The expected text xpath (must be unique), if not given the whole text is searched for the string|\n| submit_type        | The type of submission that should be used it can be click or submit, default is submit|\n| logout_xpath       | The xpath that should be used for the logout button|\n| wait_time          | The time that should the form submitter wait for the page to load in seconds|\n| expected_text_frame| The frame that the expected text resides|\n| logout_submit_type | The submit type for the logout|\n| logout_frame       | The frame that should be used for the logout|\n\n### Shibboleth \n\nShibboleth is the type used for the services that use the Shibboleth IDP\nfor the authentication. As all of them at the end land on the same form,\nthis method can be used for all of them. The following parameters must\nbe set for the Shibboleth:\n\n| parameter      | help           |\n|----------------|----------------|\n| login_type     | shibboleth     |\n| target         | The target that is searched for to find the config|\n| url            | The url that login form is included|\n| username       | The username that should be used for the login|\n| password       | The password that should be used for the login|\n| expected_text  | The text that is expected to be there|\n\nThe following parameters are optional:\n\n| parameter          | help           |\n|--------------------|----------------|\n| username_xpath | The xpath address of the username field (must be unique) for Shibboleth default value is the `//input[@id='username']`|\n| password_xpath | The xpath address of the password field (must be unique) for Shibboleth default value is the `//input[@id='password']`|\n| submit_xpath   | The xpath address of the submit button (must be unique) for Shibboleth default value is the `//button[@class='aai_login_button']`|\n| expected_text_xpath| The expected text xpath (must be unique), if not given the whole text is searched for the string|\n| submit_type        | The type of submission that should be used it can be click or submit, default is submit|\n| expected_text_frame| The frame that the expected text resides|\n| logout_submit_type | The submit type for the logout|\n| logout_frame       | The frame that should be used for the logout|\n\n\n### Basic Auth\n\nThe application can be used to login in Basic Auth systems. The \nfollowing parameters should be set for the application:\n\n| parameter      | help           |\n|----------------|----------------|\n| login_type     | basic_auth     |\n| url            | The url that login form is included|\n| target         | The target that is searched for to find the config|\n| username       | The username that should be used for the login|\n| password       | The password that should be used for the login|\n| expected_text  | The text that is expected to be there|\n\nThe following parameters are optional:\n\n| parameter          | help           |\n|--------------------|----------------|\n| expected_text_xpath| The expected text xpath (must be unique), if not given the whole text is searched for the string|\n| expected_text_frame| The frame that the expected text resides|\n| logout_submit_type | The submit type for the logout|\n| logout_frame       | The frame that should be used for the logout|\n\n### Password Only\n\nSome login fields like mailman only have a single password or token\nfield, this kind of authentications are also supported. The following parameters\nshould be set:\n\n| parameter      | help           |\n|----------------|----------------|\n| login_type     | password_only     |\n| url            | The url that login form is included|\n| target         | The target that is searched for to find the config|\n| password       | The password that should be used for the login|\n| password_xpath | The xpath address of the password field (must be unique)|\n| expected_text  | The text that is expected to be there|\n\nThe following parameters are optional\n\n| parameter          | help           |\n|--------------------|----------------|\n| expected_text_xpath| The expected text xpath (must be unique), if not given the whole text is searched for the string|\n| submit_type        | The type of submission that should be used it can be click or submit, default is submit|\n| logout_xpath       | The xpath that should be used for the logout button|\n| expected_text_frame| The frame that the expected text resides|\n| logout_submit_type | The submit type for the logout|\n| logout_frame       | The frame that should be used for the logout|\n\n### API\n\nThis login exporter has limited support of API logins and approaches. \nThe API part of the application does not use the chrome driver and uses\nthe `http.client` of go directly for the procedures. The following \nparameters should be set:\n \n| parameter      | help           |\n|----------------|----------------|\n| login_type     | api     |\n| url            | The url that login form is included|\n| target         | The target that is searched for to find the config|\n| password       | This could be key, password or token that should be used|\n| password_xpath | This is the parameter that should be used for the token or password|\n| expected_text  | The text that is expected to be there|\n\nThe following parameters are optional:\n\n| parameter      | help           |\n|----------------|----------------|\n| username       | The username that should be used for the login|\n| username_xpath | The parameter that is used for the username|\n| method         | The method that should be used for the call default is POST|\n\n### No Auth\n\nWhen the page is only protected by IP address firewall or does not\nhave any authentication, but still should be checked for a given text\nthis method can be used.\n\n| parameter      | help           |\n|----------------|----------------|\n| login_type     | no_auth     |\n| url            | The url that login form is included|\n| target         | The target that is searched for to find the config|\n| expected_text  | The text that is expected to be there|\n\nThese parameters are optional:\n\n| parameter          | help           |\n|--------------------|----------------|\n| expected_text_xpath| The expected text xpath (must be unique), if not given the whole text is searched for the string|\n\n## Configuring Prometheus\n\nThis exporter works the same way as\n[blackbox exporter](https://github.com/prometheus/blackbox_exporter). As\nit uses a full browser to run the queries, The queries should\nbe done in bigger intervals and timeout should be set to a higher number.\n\nIn `prometheus.yaml the following settings should be enough:\n\n```yaml\n  - job_name: 'login_exporter'\n    scrape_interval: 5m\n    metrics_path: /probe\n    relabel_configs:\n      - source_labels: [__address__]\n        target_label: __param_target\n      - source_labels: [__param_target]\n        target_label: instance\n      - target_label: __address__\n        replacement: 127.0.0.1:9980\n    file_sd_configs:\n    - refresh_interval: 2m\n      files:\n         - '/etc/prometheus/login_targets.json'\n```\n\nIn `login_targets.json` the following settings would be enough:\n\n```json\n[\n  {\n    \"labels\": {\n      \"group\": \"apps\",\n      \"host\": \"hostname\",\n      \"ip\": \"ip_address\",\n      \"job\": \"login_exporter\"\n    },\n    \"targets\": [\n      \"target_which_is_defined_in_login.yml_before\"\n    ]\n  }\n]\n```\n\n## Development\n\nThis application is open-source and can be extended. This repository\nis a mirror of our home owned repository, as a result the pull request\nhere can not be directly merged. But pull requests are still welcome. \nI will extract the patch and add it manually to our internal repo, when\nit is acceptable patch. You still can fork this repository and add your \nchanges too.\n\n### Build\n\nTo build this application you need to install the needed requirements\nfirst with go get. Dont forget to install chrome and chrome driver\nas it was discussed above.\n\n```bash\ngo get\ngo build -o ./login_exporter\n```\n\nOr if you want to create a binary for several platforms at once, you can\nuse the `go_build.sh` script.\n\n## Change Log\n\nSee the CHANGELOG file.\n\n## License\n\nSee the LICENSE file.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funiwue-rz%2Flogin_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funiwue-rz%2Flogin_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funiwue-rz%2Flogin_exporter/lists"}