How to dump status information of hosts and services into da


I wanna periodically retrieve status information of hosts and services from Nagios, and put those data into database. Then, later, I may write my own programs to process those data in the database or show them to end users.

Does anyone have suggestions that how I can handle this? Thanks a lot.


You can compile nagios to use a MySQL database to store host/service status. So now that the data is already in the database, do as you wish, to write your report.


The problem is that my database schema is different from Nagios. So I wonder if there is any API that I can call for the latest status information about hosts and services?


Dunno abot that. I seriously doubt that someone has programmed nagios to dump data into a DB schema that they don’t even know about. i.e. Your DB schema.

But you stated that you want to write a program to process the data from a database and make reports with it. I see no difference writing a program for one schema or another. Either way, you have to write the program to fit the DB schema. Since it’s your schema, it looks like it’s up to you.

Bottom line is, Nagios data is already in a DB, which is what you requested in your first post.


Thanks a lot for your replay.

Yes. You may be right. The reason that I prefer to use API to get data is because API is usually more table than database schema and API can also hide details about underlying changes. I wonder if Nagios provides Web Services that the third-party application can get status information about host and services.

As to access directly database, I failed to find out how to compile nagios to use MySQL database and where is the database schema file. I really appreciate if you can give me some hints.


./configure --help
will show all the switches to configure nagios. The documentation also explains about how to install nagios and use a MySQL database.

Edited Mon Sep 12 2005, 12:11AM ]


keep in mind that nagios 2 does NOT use MySQL anymore.



So what’s your suggestion for my question? Thanks a lot!!!


You asked if data can be stored into a DB. The answer is yes it can in V1.2. Just compile nagios to store data in a db and you are good to go. I don’t see the problem. If you are asking if Nagios can store data into a DB that has the structure that YOU have created, then the answer is no. How could anyone possibly know, what your particular stucture looks like?
Edited Mon Sep 19 2005, 03:48AM ]


Maybe I haven’t made my question clearly. Sorry about that.

There is a simple scenario. There are a lot of computers in an organization. Some computers are monitored by Nagios and some computers are monitored by other tools, such as NWS, MDS, or Ganglia. Now I want to develop a system that pulls data from those monitoring tools into one database and shows them to end users.

So my question is that if Nagios provides web services or APIs that I can develop small program to periodically get status information data from Nagios and push them to the central database?

Yes. If Nagios uses database, that will be done easily. But Nagios 2 does not support database, so how can deal with my problem with Nagios 2?

Thanks a lot for your patient answer.


export your data somehow… write it yourself…
or (and i think it would be better) if it’s a single organization standardize monitoring… :smiley:



I also think if it is better if there is only one monitoring. But the fact is that it is not :frowning:


If I’m not mistaken, it’s a common practice for people like yourself that love to tinker, to pull data from text files and and store it in databases. So the only thing I can see, is that you have to write the script to do this, since you don’t use nagios v1.2


Hey, all that you have to do is, install nagios 1.2, and the write a trigger in mysql 5.0 or postgress, when a table is updated dump the data to another db and table.

or see:

Juan P