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

Cant create type in Grafana #22

Open
immicola opened this issue Oct 15, 2024 · 5 comments
Open

Cant create type in Grafana #22

immicola opened this issue Oct 15, 2024 · 5 comments

Comments

@immicola
Copy link

Hello, i tried to deploy opentwins, configured it, but then when i tried create type there was no button to create a type
Screenshot_15-Oct_22-53-57_12632

@medchedli
Copy link

It seems that the Grafana OpenTwins App may not have been configured correctly. Ensure that you have entered the correct addresses for both the Ditto NGNIX instance and the Ditto Extended API instance. Additionally, check your browser's console for any error messages that could help identify the problem.

@xxabdelxx
Copy link

xxabdelxx commented Nov 4, 2024

Hello. I have same problem but creating a type page has the button but not in the policies' page where nothing is showing. The error in the console is :
url: 'http://IP_Extended_API/api/policies', bad request 400

accessing that url on browser gives a void message :
{
"message": {}
}

I'm deploying using Minikube. Grafana, the extended API, the Ditto NGINX and Mosquitto are accessible from Internet as I'm deploying on cloud with openstack instance with a floating IP. Grafana OpenTwin plugin is well connected to the Ip addresses of both Ditto NGINX and Extended API. Running API queries such as IP_Ditto_NGINX/api/2/whoami works, inserting and finding a new policy through curl to IP_Ditto_NGINX/api/2/policies/id_policy works. However, in the installation files, it is expected that I find default:basic_policy if I query Ditto NGINX, but it seems it is not their ""error": "policies:policy.notfound",".

I was thinking it could be a problem with mongodb not connected, but as long as I insert and I can find a test policy then it is connected. What could make policies not loading ?

Thank you.

@medchedli
Copy link

medchedli commented Nov 8, 2024

@xxabdelxx you can try using the Eclipse Ditto API endpoint http://{{domain}}:{{ditto-ngnix-port}}/api/2/policies/ to insert a new default policy. This might help solve the problem with the policies not loading.

Here is an example of the policy :

{
    "imports": {},
    "entries": {
        "DEFAULT": {
            "subjects": {
                "pre-authenticated:kafkaml-connection": {
                    "type": "Connection to KafkaML"
                },
                "pre-authenticated:hono-connection": {
                    "type": "Connection to Eclipse Hono"
                },
                "nginx:ditto": {
                    "type": "Ditto user authenticated via nginx"
                }
            },
            "resources": {
                "policy:/": {
                    "grant": [
                        "READ",
                        "WRITE"
                    ],
                    "revoke": []
                },
                "thing:/": {
                    "grant": [
                        "READ",
                        "WRITE"
                    ],
                    "revoke": []
                },
                "message:/": {
                    "grant": [
                        "READ",
                        "WRITE"
                    ],
                    "revoke": []
                }
            },
            "importable": "implicit"
        }
    }
}

@sergioinf
Copy link
Member

sergioinf commented Jan 7, 2025

Hello @medchedli @immicola sorry for the delay in the response. Which type of user do you have in Grafana? Create twins and types are only available if you are admin or editor.

@xxabdelxx
Copy link

Thank you @medchedli for your response. This is exactly what I have done to solve the problem. I was querying using the API to find the policies already in the database. Then I realized that the scripts used to insert data into databases were not executed while installing the platform.

Using Minikube now with docker driver created another issue. While the platform was deployed on a cloud server and a public address was assigned to it, I had another issue with CORS not allowing external connection to the Extended API, which was blocking bringing policies to the Grafana form. Updating the CORS and adding the server public IP to allow connection solved the problem.

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

4 participants