How do I export all hosts and services from Thruk? [closed] - nagios

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
We use Thruk within our business as a front end to different nagios backend servers.
I need to create a list of all the services and their hosts being monitored by these nagios servers but I cannot see an easy way to export a list.
I have been to configuration button in the bottom left corner and have managed to get lists I need loaded but I cannot cleanly copy and paste from this area and there is no export available.
I am wondering if there is another easy way to do this, going via the CLI seems like it would be a longer task.

You can fetch a list of hosts and services from Thruks REST API.
There are some examples here: https://thruk.org/documentation/rest_examples.html
From the command line you can use the thruk cli tool to generate a list:
%> thruk r /csv/hosts?columns=name
this creates a simple text list of all hosts. Removing the /csv prefix will result in a json data structure.
Removing the columns=... will export all available columns.
Same can be fetched from the web rest api:
%> curl -H "X-Thruk-Auth-Key: ****" -g 'http://user:password#localhost/thruk/r/csv/hosts?columns=name'
API keys can be created in your user profile page.
The url /r/hosts retrieves all hosts as they are configured in nagios right now, Thruk config tool can be accessed by ex.: /r/config/objects?:TYPE=host.
A list of all available rest urls is here:
https://thruk.org/documentation/rest.html#_endpoints

Related

Should I pass data to the component or make a request to the API in React? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I'm currently developing a side-project and trying to learn some general API things.
The user can access a list of projects by going to /projects and I'll get
all of the projects as a list. The user can also click an Edit button that goes to
edit/{project_id} and was wondering whether I should pass the project object to the component or just do a separate request to the API with the ID of the project to only get that project.
The first one is good because it's easier and also, I won't have to send all information about the project objects because I can't show all of them in the table (in /project) and this will save some data (ex. the list will show name of project and created date only). However, the second way is good because there will be less requests to the server.
My question here is, what is the preferred way?
Sidenote: I've tried searching for a question like this but didn't know how to phrase it, so this might be a duplicate.
In this situation, I would advocate for the separate API request. With a list of projects, you really don't want to include everything in your "get all" API call; just enough basic stuff to populate the list. That will make your queries faster and data transfers smaller, which is especially helpful when a large number of projects come into play. However, when you "deep dive" into a single project, then you'll want everything about that single project.

How can I get data from a database to my iOS app? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I've designed my app in Xcode
But , it doesn't have any data ! And I want to get data from a database .
I don't know where to start ? And what should I use ?
*php , sql , json ?*
Your app needs to request data from the server, the easiest way would probably using a http request. You could either transfer the data in a json format, or just use the GET part of the HTTP Request.
You then need a simple API, written in any language the server can run, which will most likely be:
python
php
ruby
The choice of the language is up to you, it depends on personal preference and how scalable your API needs to be. The API has to deal with the request parameters and do the database work accordingly - this is up to you to design. It then needs to send a response - you can use plain text but json would be easier to deal with, as you can parse it with any language.
The app can then take that data and display it. There are lots of tutorials on the internet, here's a basic one I've found, it doesn't tell you how to build a proper API, but you'll learn how to get started.

Angulas 1 & Angular 2 - Hide api calls...possible? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I think I know the answer, but I'd like more opinions.
Imagine a scenario...
You create a new website using angular 1 or 2 where basically your front end application consumes services from a server that's send you results in json - The trivial scenario.
Then a competitor decide to create one web site to compete with yours. It's pretty easy to open Developers Tools on the browser and check the address of the rest server including api parameters. So, the competitor decides to create a migration tool to make easy for people to abandon your web site and adopt the competitor web site.
CORS cannot protect you because it's much more a browser feature - also you can use JSONp to consume api of different domains.
So, the question: Is there any solution for a scenario like this ?
You can obfuscate your API, but you can't hide the calls that are made to it.
There's a single good reason for this : the browser of the final user needs to know what requests to make, and make them.
Even if you found some way to hide the requests made from the Developper Tools, someone could still retrieve them by listening for them on the network.
However as I said, you can still obfuscate your API so that trying to replicate it would require non-trivial work. That way, an understandable request like
GET /user/id1234/profile?history=true
could become the less talkative
GET /1/id1234/p?x=1

Spring web flow and ExtJs 4 [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am not able to find a concrete answer yet on this forum or other's that, whether spring web flow can be used with Extjs 4.2 or later release of Extjs.
In case some one has integrated then kindly let me know the basic steps or guide to a specific example will be really helpful.
Thanks in Advance.
Rohit Dwivedi
The short answer is: "Yes".
Yes, because ExtJS does not need to (and does not) know how the server side is implemented. In its very essence, Ext sends a request to the server and expect a response, usually containing pertinent data.
In real life, you need to make decisions what part of the application logic will run on the server and what on the client and what the interface (API, request/response) will be between the two.
From the Spring site:
Spring Web Flow: Supports building web applications with controlled navigation such as checking in for a flight or applying for a loan.
So, if you want/need the server to be responsible for such flows, then go ahead.
If you want to implement the application logic (flows) at Ext client, then continue looking for the server side language/platform as you do not need the Web Flow functionality.

How to load a different language URL depending on the visitor's IP in a multingual site? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Some time ago I developed a multilingual website and now they have asked me that the website should load the language depending on the visitor's IP address. They are going to provide me with an IP address list of different countries.
For example. If an italian visitor loads the website, the website should load www.mydomain.com/it
If the IP is not recognised, the website should load www.mydomain.com
How can I achieve this?
Thanks in advance.
Regards
I found a solution and it worked perfectly for me.
I found a site which provides a database table with all the necessary ips and locations. The site can be found at:
http://www.ip2nation.com/
You can download both the sql dump and the php code sample from there.
You could also use the Accept-Language request header:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
http://www.w3.org/International/questions/qa-lang-priorities.en.php
You could write a redirect in Apache or NGINX to redirect to a different site based on that header.
This is one of Joomla plugins that help you in such case.. But this works only if your site is a Joomla site.
extensions.joomla.org/extension/language-domains
Else, set redirects to each language domain.. there are many ways for doing this.. you can google for these.
Solutions above are provided based on the idea of setting a domain to each language/country (EXP: .jp, .ir,. de,etc....)
If you have only one domain, with content is divided lingually in directories (site.com/ar, site.com.jp, site.com/en) you can set links in homepage.. if you want this to be done automatically create a script to get visitor`s country and automatically redirect him to his content.. this step can be done easier with solutions recomemnded for you earlier.

Resources