mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
Revamp livestatus startup logging a bit.
This commit is contained in:
parent
09db65fcd0
commit
a326ddbb9f
@ -21,11 +21,14 @@
|
|||||||
#include "base/objectlock.h"
|
#include "base/objectlock.h"
|
||||||
#include "base/dynamictype.h"
|
#include "base/dynamictype.h"
|
||||||
#include "base/logger_fwd.h"
|
#include "base/logger_fwd.h"
|
||||||
|
#include "base/exception.h"
|
||||||
#include "base/tcpsocket.h"
|
#include "base/tcpsocket.h"
|
||||||
#include "base/unixsocket.h"
|
#include "base/unixsocket.h"
|
||||||
#include "base/networkstream.h"
|
#include "base/networkstream.h"
|
||||||
#include "base/application.h"
|
#include "base/application.h"
|
||||||
#include <boost/smart_ptr/make_shared.hpp>
|
#include <boost/smart_ptr/make_shared.hpp>
|
||||||
|
#include <boost/exception/diagnostic_information.hpp>
|
||||||
|
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
using namespace livestatus;
|
using namespace livestatus;
|
||||||
@ -49,6 +52,7 @@ void LivestatusListener::Start(void)
|
|||||||
|
|
||||||
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
|
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
|
||||||
thread.detach();
|
thread.detach();
|
||||||
|
Log(LogInformation, "livestatus", "Created tcp socket listening on host '" + GetBindHost() + "' port '" + GetBindPort() + "'.");
|
||||||
}
|
}
|
||||||
else if (GetSocketType() == "unix") {
|
else if (GetSocketType() == "unix") {
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -56,13 +60,18 @@ void LivestatusListener::Start(void)
|
|||||||
socket->Bind(GetSocketPath());
|
socket->Bind(GetSocketPath());
|
||||||
|
|
||||||
/* group must be able to write */
|
/* group must be able to write */
|
||||||
if (chmod(GetSocketPath().CStr(), 0660) < 0) {
|
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
|
||||||
Log(LogCritical, "livestatus", "Cannot chmod unix socket '" + GetSocketPath() + "' to 0660: " + strerror(errno));
|
|
||||||
return;
|
if (chmod(GetSocketPath().CStr(), mode) < 0) {
|
||||||
|
BOOST_THROW_EXCEPTION(posix_error()
|
||||||
|
<< boost::errinfo_api_function("chmod")
|
||||||
|
<< boost::errinfo_errno(errno)
|
||||||
|
<< boost::errinfo_file_name(GetSocketPath()));
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
|
boost::thread thread(boost::bind(&LivestatusListener::ServerThreadProc, this, socket));
|
||||||
thread.detach();
|
thread.detach();
|
||||||
|
Log(LogInformation, "livestatus", "Created unix socket in '" + GetSocketPath() + "'.");
|
||||||
#else
|
#else
|
||||||
/* no unix sockets on windows */
|
/* no unix sockets on windows */
|
||||||
Log(LogCritical, "livestatus", "Unix sockets are not supported on Windows.");
|
Log(LogCritical, "livestatus", "Unix sockets are not supported on Windows.");
|
||||||
|
@ -54,7 +54,6 @@ object PerfdataWriter "pnp" {
|
|||||||
/**
|
/**
|
||||||
* LIVESTATUS
|
* LIVESTATUS
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
library "livestatus"
|
library "livestatus"
|
||||||
|
|
||||||
object LivestatusListener "livestatus-tcp" {
|
object LivestatusListener "livestatus-tcp" {
|
||||||
@ -65,9 +64,9 @@ object LivestatusListener "livestatus-tcp" {
|
|||||||
|
|
||||||
object LivestatusListener "livestatus-unix" {
|
object LivestatusListener "livestatus-unix" {
|
||||||
socket_type = "unix",
|
socket_type = "unix",
|
||||||
socket_path = (Icinga2Prefix + "/var/run/icinga2/livestatus")
|
socket_path = (Icinga2Prefix + "/var/run/icinga2/rw/livestatus")
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* IDO
|
* IDO
|
||||||
*/
|
*/
|
||||||
@ -131,7 +130,7 @@ object Host "localhost" {
|
|||||||
notifications["mail-michi"] = {
|
notifications["mail-michi"] = {
|
||||||
templates = [ "mail-notification" ],
|
templates = [ "mail-notification" ],
|
||||||
users = [ "michi" ],
|
users = [ "michi" ],
|
||||||
groups = [ "all-michis" ],
|
user_groups = [ "all-michis" ],
|
||||||
notification_period = "24x7",
|
notification_period = "24x7",
|
||||||
notification_state_filter = (StateFilterUnknown | StateFilterOK | StateFilterWarning | StateFilterCritical),
|
notification_state_filter = (StateFilterUnknown | StateFilterOK | StateFilterWarning | StateFilterCritical),
|
||||||
notification_type_filter = (NotificationRecovery | NotificationDowntimeStart | NotificationDowntimeEnd),
|
notification_type_filter = (NotificationRecovery | NotificationDowntimeStart | NotificationDowntimeEnd),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user