Thread: [Nagios-db-devel] abstraction and mysql support added to ui
Status: Beta
Brought to you by:
bench23
From: Matthew K. <mk...@ma...> - 2005-01-17 02:25:37
|
Well as there hasn't been any other activity since I mentioned doing this, I've just gone and checked it all in. If I've messed something up I have copies to revert the changes. So basically this breaks database calls and logic into 2 separate files - one of which is loaded at runtime based on the values in config.php. Instead of referencing the db directly the gui just calls a generic function and handles displaying the results. It's explained in a bit more detail in ui/docs/DESIGN. One fun thing about the way the neb module is implemented is that nagios can load both the mysql and postgres modules up at the same time and you can switch the gui between the two on the fly just by editing a line in config.php :) I've also started a todo in ui/docs/TODO with a few issues I've come across. The most immediate one being fixing some of the queries/stored procs that create the availability reports for both databases. Currently a few of the start and end time criteria combinations don't work (bounded start, bounded end time is the most obvious) on both databases. In testing everything is working. There are a few inconsistencies between the displays of nagios default cgis, postgres and mysql that I plan on ironing out. Oh and I had to make a single change to the postgres schema and restart stored proc to change the 'option' column to just 'opt' as mysql has it as a reserved word and postgres didn't like the quoting I had to use. And please feel free to point out any mistakes in what I've done, I'm not a professional php programmer, just a system admin :) -- Matthew Kent <mk...@ma...> http://magoazul.com |
From: Ben <be...@si...> - 2005-01-18 19:31:14
|
Nice work, I'm looking it over and have some first-glance questions. 1. You've modified the host stored proc to say that if a host doesn't have a host_check defined, then it's always up. First, I'm not sure this is correct - if we can't check the host, how do we know it's up? At best, it'd be pending. Second, I don't think the changes you've done to the stored proc make the host "up".... actually, I think they keep it in a pending state. :) 2. What's wrong with bounded time limits? For me, this is a critical feature, so they must be supported. 3. What are the inconsistancies between psql, mysql, and the cigs? Those are likely bugs and should probably have a high priority of getting squashed. I'll ask more questions as they come to me. :) On Sun, 16 Jan 2005, Matthew Kent wrote: > Well as there hasn't been any other activity since I mentioned doing > this, I've just gone and checked it all in. If I've messed something up > I have copies to revert the changes. > > So basically this breaks database calls and logic into 2 separate files > - one of which is loaded at runtime based on the values in config.php. > Instead of referencing the db directly the gui just calls a generic > function and handles displaying the results. It's explained in a bit > more detail in ui/docs/DESIGN. > > One fun thing about the way the neb module is implemented is that nagios > can load both the mysql and postgres modules up at the same time and you > can switch the gui between the two on the fly just by editing a line in > config.php :) > > I've also started a todo in ui/docs/TODO with a few issues I've come > across. The most immediate one being fixing some of the queries/stored > procs that create the availability reports for both databases. Currently > a few of the start and end time criteria combinations don't work > (bounded start, bounded end time is the most obvious) on both databases. > > In testing everything is working. There are a few inconsistencies > between the displays of nagios default cgis, postgres and mysql that I > plan on ironing out. > > Oh and I had to make a single change to the postgres schema and restart > stored proc to change the 'option' column to just 'opt' as mysql has it > as a reserved word and postgres didn't like the quoting I had to use. > > And please feel free to point out any mistakes in what I've done, I'm > not a professional php programmer, just a system admin :) > -- > Matthew Kent <mk...@ma...> > http://magoazul.com > > > > ------------------------------------------------------- > The SF.Net email is sponsored by: Beat the post-holiday blues > Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek. > It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt > _______________________________________________ > Nagios-db-devel mailing list > Nag...@li... > https://lists.sourceforge.net/lists/listinfo/nagios-db-devel > |
From: Matthew K. <mk...@ma...> - 2005-01-18 20:59:10
|
On Tue, 2005-01-18 at 19:31, Ben wrote: > Nice work, I'm looking it over and have some first-glance questions. > > 1. You've modified the host stored proc to say that if a host doesn't have > a host_check defined, then it's always up. First, I'm not sure this is > correct - if we can't check the host, how do we know it's up? At best, > it'd be pending. Second, I don't think the changes you've done to the > stored proc make the host "up".... actually, I think they keep it in a > pending state. :) > Well nagios allows for an undefined host check_command and considers them permanently up (http://nagios.sourceforge.net/docs/2_0/xodtemplate.html#host) I may have missed the corresponding queries for the tac display to include it as up though. That change was made quickly so I could start the postgres module without it dumping on a query error since the field was marked not null. Also a few changes that I made for the mysql queries didn't make it back into postgres quite yet. Need to test them some more. > 2. What's wrong with bounded time limits? For me, this is a critical > feature, so they must be supported. > Sorry I must have been mistaken in my testing, postgres's reports work fine! I'll test the mysql equivalent again and fix it up. > 3. What are the inconsistancies between psql, mysql, and the cigs? Those > are likely bugs and should probably have a high priority of getting > squashed. > Well the most noticeable item for postgres is in the tac overview, pending passive checks are totalled properly but not displayed by serviceDetails.php when you click the link. > I'll ask more questions as they come to me. :) > Perfect thanks. Couple more things Do you have some time or mind if I make changes to your module to register hosts and services on startup like the mysql one does? The issue I see with how it currently works is that if you clear out the db and wipe the nagios retention.dat, when you go to start nagios up from this 'fresh' state the module doesn't insert all the host/services on startup. So instead of seeing '800 pending checks' after refreshing the mat view you see 5 hosts up/20 service ok/0 pending. Lastly, I have a nice and simple caching template implementation that I'll send up today or tomorrow so I can work on some mockups of the gui over the weekend for comment. -- Matthew Kent <mk...@ma...> http://magoazul.com |
From: Ben <be...@si...> - 2005-01-18 21:48:32
|
On Tue, 18 Jan 2005, Matthew Kent wrote: > Well nagios allows for an undefined host check_command and considers > them permanently up > (http://nagios.sourceforge.net/docs/2_0/xodtemplate.html#host) Hey, check that out. I'll change the stored proc to do the right thing. > Also a few changes that I made for the mysql queries didn't make it back > into postgres quite yet. Need to test them some more. OK. Out of curiosity, what's in the pipeline? > > 3. What are the inconsistancies between psql, mysql, and the cigs? Those > > are likely bugs and should probably have a high priority of getting > > squashed. > > > > Well the most noticeable item for postgres is in the tac overview, > pending passive checks are totalled properly but not displayed by > serviceDetails.php when you click the link. If I recall, this is because service checks aren't made while a host is still pending, and the (postgres) neb module waits until a service check is made before writing it down. In other words, if a service is configured for a pending host, it will never be populated as "pending". This should probably be changed to be more correct, even though it will slow down startup time. > The issue I see with how it currently works is that if you clear out the > db and wipe the nagios retention.dat, when you go to start nagios up > from this 'fresh' state the module doesn't insert all the host/services > on startup. So instead of seeing '800 pending checks' after refreshing > the mat view you see 5 hosts up/20 service ok/0 pending. I suppose that is more correct, and doing this will also address the issue about serviceDetails.php not showing pending services. > Lastly, I have a nice and simple caching template implementation that > I'll send up today or tomorrow so I can work on some mockups of the gui > over the weekend for comment. I look forward to it. I think I have a good grasp on your database abstraction layer - despite my post-lunch food coma - to my new php eyes, it looks pretty clean. Late last week I had added the ability to sort serviceDetails.php columns.... I'll merge it in and check in the new files later today. |
From: Matthew K. <mk...@ma...> - 2005-01-19 17:56:53
|
On Tue, 2005-01-18 at 21:48, Ben wrote: > On Tue, 18 Jan 2005, Matthew Kent wrote: > > > Well nagios allows for an undefined host check_command and considers > > them permanently up > > (http://nagios.sourceforge.net/docs/2_0/xodtemplate.html#host) > > Hey, check that out. > > I'll change the stored proc to do the right thing. > > > Also a few changes that I made for the mysql queries didn't make it back > > into postgres quite yet. Need to test them some more. > > OK. Out of curiosity, what's in the pipeline? > Believe it was the displaying of pending items by serviceDetails. If I have time I'll go over it this evening and get back to you. Not enough hours in the day lately! -- Matthew Kent <mk...@ma...> http://magoazul.com |
From: Matthew K. <mk...@ma...> - 2005-01-20 19:41:14
|
> > The issue I see with how it currently works is that if you clear out the > > db and wipe the nagios retention.dat, when you go to start nagios up > > from this 'fresh' state the module doesn't insert all the host/services > > on startup. So instead of seeing '800 pending checks' after refreshing > > the mat view you see 5 hosts up/20 service ok/0 pending. > > I suppose that is more correct, and doing this will also address the issue > about serviceDetails.php not showing pending services. Sorry, need clarification here, do you want me to fix this up over the weekend or would you rather do it? -- Matthew Kent <mk...@ma...> http://magoazul.com |
From: Ben <be...@si...> - 2005-01-20 20:55:54
|
I'll do it. On Thu, 20 Jan 2005, Matthew Kent wrote: > > > The issue I see with how it currently works is that if you clear out the > > > db and wipe the nagios retention.dat, when you go to start nagios up > > > from this 'fresh' state the module doesn't insert all the host/services > > > on startup. So instead of seeing '800 pending checks' after refreshing > > > the mat view you see 5 hosts up/20 service ok/0 pending. > > > > I suppose that is more correct, and doing this will also address the issue > > about serviceDetails.php not showing pending services. > > Sorry, need clarification here, do you want me to fix this up over the > weekend or would you rather do it? > -- > Matthew Kent <mk...@ma...> > http://magoazul.com > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Nagios-db-devel mailing list > Nag...@li... > https://lists.sourceforge.net/lists/listinfo/nagios-db-devel > |
From: Ben <be...@si...> - 2005-01-21 19:37:18
|
On Tue, 18 Jan 2005, Ben wrote: > > The issue I see with how it currently works is that if you clear out the > > db and wipe the nagios retention.dat, when you go to start nagios up > > from this 'fresh' state the module doesn't insert all the host/services > > on startup. So instead of seeing '800 pending checks' after refreshing > > the mat view you see 5 hosts up/20 service ok/0 pending. > > I suppose that is more correct, and doing this will also address the issue > about serviceDetails.php not showing pending services. Ok, so I made some changes to get this to work, and I'm now noticing that it seems nagios isn't doing host checks on some of my servers. Have you noticed that? |
From: Matthew K. <mk...@ma...> - 2005-01-21 20:00:04
|
On Fri, 2005-01-21 at 19:37, Ben wrote: > On Tue, 18 Jan 2005, Ben wrote: > > > > The issue I see with how it currently works is that if you clear out the > > > db and wipe the nagios retention.dat, when you go to start nagios up > > > from this 'fresh' state the module doesn't insert all the host/services > > > on startup. So instead of seeing '800 pending checks' after refreshing > > > the mat view you see 5 hosts up/20 service ok/0 pending. > > > > I suppose that is more correct, and doing this will also address the issue > > about serviceDetails.php not showing pending services. > > Ok, so I made some changes to get this to work, and I'm now noticing that > it seems nagios isn't doing host checks on some of my servers. Have you > noticed that? Interesting, no I haven't noticed that. So they aren't showing up in the nagios log either? What I did notice immediately after making that change was that host and service check data in the UI was out of date. I made a note about it in the TODO. "need to define a plugin_output field for both host_check/service_check to be use when querying host/service status. currently host_history/service_history is used but these results are stale right after the initial check." -- Matthew Kent <mk...@ma...> http://magoazul.com |
From: Ben <be...@si...> - 2005-01-21 20:32:45
|
Well, as usual, blaming problems on something else publicly is a sure-fire way to figure out that it's really your fault. It appears that if a host is in a CRITICAL state since nagios has been started, then hostchecks still happen, but if they don't change the state, then NEB events are not fired. I've gotten around this by registering for host and service check events, as well as for status updates. Seems to be working better so far.... I'll watch how things progress over the next few hours. On Fri, 21 Jan 2005, Matthew Kent wrote: > On Fri, 2005-01-21 at 19:37, Ben wrote: > > On Tue, 18 Jan 2005, Ben wrote: > > > > > > The issue I see with how it currently works is that if you clear out the > > > > db and wipe the nagios retention.dat, when you go to start nagios up > > > > from this 'fresh' state the module doesn't insert all the host/services > > > > on startup. So instead of seeing '800 pending checks' after refreshing > > > > the mat view you see 5 hosts up/20 service ok/0 pending. > > > > > > I suppose that is more correct, and doing this will also address the issue > > > about serviceDetails.php not showing pending services. > > > > Ok, so I made some changes to get this to work, and I'm now noticing that > > it seems nagios isn't doing host checks on some of my servers. Have you > > noticed that? > > Interesting, no I haven't noticed that. So they aren't showing up in the > nagios log either? > > What I did notice immediately after making that change was that host and service > check data in the UI was out of date. I made a note about it in the TODO. > > "need to define a plugin_output field for both host_check/service_check to be use > when querying host/service status. currently host_history/service_history is used > but these results are stale right after the initial check." > > -- > Matthew Kent <mk...@ma...> > http://magoazul.com > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Nagios-db-devel mailing list > Nag...@li... > https://lists.sourceforge.net/lists/listinfo/nagios-db-devel > |
From: Matthew K. <mk...@ma...> - 2005-01-21 20:49:31
|
On Fri, 2005-01-21 at 20:32, Ben wrote: > Well, as usual, blaming problems on something else publicly is a sure-fire > way to figure out that it's really your fault. > > It appears that if a host is in a CRITICAL state since nagios has been > started, then hostchecks still happen, but if they don't change the state, > then NEB events are not fired. I've gotten around this by registering for > host and service check events, as well as for status updates. Seems to be > working better so far.... I'll watch how things progress over the next few > hours. > Great, I'll have to take a look at your changes when it's ready. So as for adding that extra plugin_output field I mentioned below, do you agree with that logic? Or am I missing something obvious... seems to me the UI should be displaying the most current check results. - Matt > On Fri, 21 Jan 2005, Matthew Kent wrote: > > > On Fri, 2005-01-21 at 19:37, Ben wrote: > > > On Tue, 18 Jan 2005, Ben wrote: > > > > > > > > The issue I see with how it currently works is that if you clear out the > > > > > db and wipe the nagios retention.dat, when you go to start nagios up > > > > > from this 'fresh' state the module doesn't insert all the host/services > > > > > on startup. So instead of seeing '800 pending checks' after refreshing > > > > > the mat view you see 5 hosts up/20 service ok/0 pending. > > > > > > > > I suppose that is more correct, and doing this will also address the issue > > > > about serviceDetails.php not showing pending services. > > > > > > Ok, so I made some changes to get this to work, and I'm now noticing that > > > it seems nagios isn't doing host checks on some of my servers. Have you > > > noticed that? > > > > Interesting, no I haven't noticed that. So they aren't showing up in the > > nagios log either? > > > > What I did notice immediately after making that change was that host and service > > check data in the UI was out of date. I made a note about it in the TODO. > > > > "need to define a plugin_output field for both host_check/service_check to be use > > when querying host/service status. currently host_history/service_history is used > > but these results are stale right after the initial check." > > > > -- > > Matthew Kent <mk...@ma...> > > http://magoazul.com > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > > Tool for open source databases. Create drag-&-drop reports. Save time > > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > > _______________________________________________ > > Nagios-db-devel mailing list > > Nag...@li... > > https://lists.sourceforge.net/lists/listinfo/nagios-db-devel > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Nagios-db-devel mailing list > Nag...@li... > https://lists.sourceforge.net/lists/listinfo/nagios-db-devel |
From: Ben <be...@si...> - 2005-01-21 21:22:21
|
Well, I forget my rational at the time, but this was intentional. Maybe I was trying to lessen database load by keeping down the updates? Regardless, I think you are correct: current state should be displayed, as opposed to whatever things were like when the service/host first entered it's current state. On Fri, 21 Jan 2005, Matthew Kent wrote: > On Fri, 2005-01-21 at 20:32, Ben wrote: > > Well, as usual, blaming problems on something else publicly is a sure-fire > > way to figure out that it's really your fault. > > > > It appears that if a host is in a CRITICAL state since nagios has been > > started, then hostchecks still happen, but if they don't change the state, > > then NEB events are not fired. I've gotten around this by registering for > > host and service check events, as well as for status updates. Seems to be > > working better so far.... I'll watch how things progress over the next few > > hours. > > > > Great, I'll have to take a look at your changes when it's ready. > > So as for adding that extra plugin_output field I mentioned below, do > you agree with that logic? Or am I missing something obvious... seems to > me the UI should be displaying the most current check results. > > - Matt > > > On Fri, 21 Jan 2005, Matthew Kent wrote: > > > > > On Fri, 2005-01-21 at 19:37, Ben wrote: > > > > On Tue, 18 Jan 2005, Ben wrote: > > > > > > > > > > The issue I see with how it currently works is that if you clear out the > > > > > > db and wipe the nagios retention.dat, when you go to start nagios up > > > > > > from this 'fresh' state the module doesn't insert all the host/services > > > > > > on startup. So instead of seeing '800 pending checks' after refreshing > > > > > > the mat view you see 5 hosts up/20 service ok/0 pending. > > > > > > > > > > I suppose that is more correct, and doing this will also address the issue > > > > > about serviceDetails.php not showing pending services. > > > > > > > > Ok, so I made some changes to get this to work, and I'm now noticing that > > > > it seems nagios isn't doing host checks on some of my servers. Have you > > > > noticed that? > > > > > > Interesting, no I haven't noticed that. So they aren't showing up in the > > > nagios log either? > > > > > > What I did notice immediately after making that change was that host and service > > > check data in the UI was out of date. I made a note about it in the TODO. > > > > > > "need to define a plugin_output field for both host_check/service_check to be use > > > when querying host/service status. currently host_history/service_history is used > > > but these results are stale right after the initial check." > > > > > > -- > > > Matthew Kent <mk...@ma...> > > > http://magoazul.com > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > > > Tool for open source databases. Create drag-&-drop reports. Save time > > > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > > > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > > > _______________________________________________ > > > Nagios-db-devel mailing list > > > Nag...@li... > > > https://lists.sourceforge.net/lists/listinfo/nagios-db-devel > > > > > > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > > Tool for open source databases. Create drag-&-drop reports. Save time > > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > > _______________________________________________ > > Nagios-db-devel mailing list > > Nag...@li... > > https://lists.sourceforge.net/lists/listinfo/nagios-db-devel > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Nagios-db-devel mailing list > Nag...@li... > https://lists.sourceforge.net/lists/listinfo/nagios-db-devel > |
From: Ben <be...@si...> - 2005-01-25 18:08:21
|
On further research, it turns out that this is becuase nagios explicitly does not do regular host checks when you set the host checking mode to smart. So now I'm torn: while I like seeing that nagios has checked the hosts explicitly, this is not how nagios works by default. It seems that the web interface should reflect what nagios thinks... that is, if it beileves the host is up, regardless of if it's been checked, we should display it as being up. On Fri, 21 Jan 2005, Ben wrote: > On Tue, 18 Jan 2005, Ben wrote: > > > > The issue I see with how it currently works is that if you clear out the > > > db and wipe the nagios retention.dat, when you go to start nagios up > > > from this 'fresh' state the module doesn't insert all the host/services > > > on startup. So instead of seeing '800 pending checks' after refreshing > > > the mat view you see 5 hosts up/20 service ok/0 pending. > > > > I suppose that is more correct, and doing this will also address the issue > > about serviceDetails.php not showing pending services. > > Ok, so I made some changes to get this to work, and I'm now noticing that > it seems nagios isn't doing host checks on some of my servers. Have you > noticed that? > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting > Tool for open source databases. Create drag-&-drop reports. Save time > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. > Download a FREE copy at http://www.intelliview.com/go/osdn_nl > _______________________________________________ > Nagios-db-devel mailing list > Nag...@li... > https://lists.sourceforge.net/lists/listinfo/nagios-db-devel > |
From: Matthew K. <mk...@ma...> - 2005-01-25 19:04:20
|
On Tue, 2005-01-25 at 18:08, Ben wrote: > On further research, it turns out that this is becuase nagios explicitly > does not do regular host checks when you set the host checking mode to > smart. So now I'm torn: while I like seeing that nagios has checked the > hosts explicitly, this is not how nagios works by default. It seems that > the web interface should reflect what nagios thinks... that is, if it > beileves the host is up, regardless of if it's been checked, we should > display it as being up. > > On Fri, 21 Jan 2005, Ben wrote: > > > On Tue, 18 Jan 2005, Ben wrote: > > > > > > The issue I see with how it currently works is that if you clear out the > > > > db and wipe the nagios retention.dat, when you go to start nagios up > > > > from this 'fresh' state the module doesn't insert all the host/services > > > > on startup. So instead of seeing '800 pending checks' after refreshing > > > > the mat view you see 5 hosts up/20 service ok/0 pending. > > > > > > I suppose that is more correct, and doing this will also address the issue > > > about serviceDetails.php not showing pending services. > > > > Ok, so I made some changes to get this to work, and I'm now noticing that > > it seems nagios isn't doing host checks on some of my servers. Have you > > noticed that? > > Makes sense to me. I think this is what the current cgi's do (?) I recall the hosts being marked as UP with '(Host assumed to be up)' in the status field after some service checks had returned okay. - Matt |