• Recent
    • Unsolved
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. davide1611
    D
    • Profile
    • Following 0
    • Followers 0
    • Topics 5
    • Posts 17
    • Best 0
    • Controversial 0
    • Groups 0

    davide1611

    @davide1611

    0
    Reputation
    2
    Profile views
    17
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    davide1611 Unfollow Follow

    Latest posts made by davide1611

    • RE: How to understand if host is up or down using API?

      Thank you!

      posted in General Problems
      D
      davide1611
    • RE: How to understand if host is up or down using API?

      @Tom-Elliott Thanks for your feedback. Everything very clear.
      Last thing, I receive from GET: /fog/host the field pingstatus as an HTML tag:

      "pingstatus": "<i class=\\"icon-ping-fos fa fa-cogs green\\" data-toggle=\\"tooltip\\" data-placement=\\"right\\" title=\\"FOS\\"><\\/i>",
      

      Do you know why it is HTML tag rather than an error code? Thanks.

      posted in General Problems
      D
      davide1611
    • RE: How to understand if host is up or down using API?

      @george1421 Yes it should be easier but I prefer to work through FOG APIs.
      Make use of ping from my script directly to VM would result to get access to VM from two different point: the script and the FOG server and it may be complicated to manage.

      When I call GET on /fog/host I receive a JSON with a key-value field “ip”:“” but it’s always empty. Resolving this (understanding why it is always empty), I would only receive the IP when the host is up. Or another field?

      posted in General Problems
      D
      davide1611
    • How to understand if host is up or down using API?

      I’m using VirtualBox 6.0.14 where there is an ubuntu 18:04 machine with FOG server, DHCP server and DNS.

      I need to know when a VM is up or down using API. I see in the host management panel when the host is up a green indicator icon and when I step over it the word FOS appears. It appears after the configuration of DNS.
      I would like to query FOG server and receive an information about its status but if I do this using python:

      r = requests.get(ip_address+'/fog/host', headers=headers)
      
      print('RESPONSE: ',r.content)
      

      I cannot see difference between when the host is down or up.
      Does anyone know how can I do, please?

      posted in General Problems api api help host
      D
      davide1611
    • RE: Turn on/off VM on VirtualBox using APIs

      @george1421 ok, could be a way to solve the problem! Thank you!

      posted in General Problems
      D
      davide1611
    • Turn on/off VM on VirtualBox using APIs

      Hi everyone!

      I have installed on windows10, VirtualBox 6.0.14 where there are VMs:

      • Ubuntu 18:04 with FOG server and DHCP server --> server
      • Ubuntu 18:04 --> client

      I installed on the client the OS through NFS and everything works.

      My goal is to turn on/off the client through APIs using WOL.

      First, a question that’s not properly of this forum but maybe someone has already encountered this difficulty: Is it possible to do that? I mean, can I turn on/off VM on VBox from FOG server? Reading the forum the function is not enabled by Virtualbox but maybe there is a way to circumvent it.

      • If it’s not possible: should someone advise me a solution to test the turn on/off machine? LXC? I could move on from VBox because I need just to test this solution and in the future move to physical machines. Nevertheless, I prefer to use VBox if it’s possible.

      • If it’s possible: I think to create an “empty” snapin using WOL:true (to turn on) or shutdown:true (to turn off). Does it make sense?

      I posted a similar question but it had some gaps so I preferred to post it more detailed.

      Thanks to the community!

      posted in General Problems
      D
      davide1611
    • RE: Get HTML response instead JSON using API

      Solved! Remember to check the checkbox: API enabled

      posted in Tutorials
      D
      davide1611
    • RE: Get HTML response instead JSON using API

      I’m running the latest stable version: 1.5.8

      posted in Tutorials
      D
      davide1611
    • Get HTML response instead JSON using API

      Hi everyone,
      I’m implementing a script to query my FOG server looking the documentation at https://news.fogproject.org/simplified-api-documentation/

      When I make a GET request:

      curl -H 'fog-api-token: my_api_token' -H 'fog-user-token: my_fog_user' -X GET http://192.168.1.1/fog/task/current -o list.json
      
      

      List.json remain empty and on console get:
      2a8d834d-f0fa-4210-b6ab-7a0959bb48cb-image.png

      Using postman I found out that the result is an HTML file.

      Using python

      import requests
      
      usertoken='my_user_token'
      apitoken='my_api_token'
      headers = {'fog-user-token': usertoken, 'fog-api-token':apitoken }
      r = requests.get('http://192.168.1.1/fog/task/current', params=headers)
      print(r.url)
      

      The script print

      http://192.168.1.1/fog/management/index.php
      

      Need I to modify something on FOG server configuration? I would like to get my current task via JSON file.
      Thanks!

      posted in Tutorials
      D
      davide1611
    • RE: Turn VM on and off from FOG server

      Yes! I solved moving to physical machine rather than using VBox, thanks for your help Eduardo.

      posted in Tutorials
      D
      davide1611