Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
centreon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
centreon
Commits
d1b97015
Commit
d1b97015
authored
Feb 6, 2013
by
Maximilien Bersoult
Browse files
Options
Downloads
Plain Diff
Merge branch '2.4.x' of
http://git.centreon.com/centreon
into 2.4.x
parents
618b1a81
37149f83
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/centreon-trapmanager
+20
-20
20 additions, 20 deletions
bin/centreon-trapmanager
www/include/eventLogs/viewLog.php
+4
-2
4 additions, 2 deletions
www/include/eventLogs/viewLog.php
with
24 additions
and
22 deletions
bin/centreon-trapmanager
+
20
−
20
View file @
d1b97015
...
...
@@ -51,9 +51,9 @@ use vars qw($centrapmanager_daemon $centrapmanager_log_debug $centrapmanager_sle
$centrapmanager_logfile $centrapmanager_cmd_timeout $centrapmanager_seperator
$centrapmanager_cmdFile)
;
use
vars
qw($mysql_database_oreon $mysql_database_ods $mysql_host $mysql_user $mysql_passwd $debug $htmlentities)
;
use
vars
qw($etc $
NAGIOS
USER)
;
use
vars
qw($etc $
CENTREON_
USER)
;
$
NAGIOSUSER
=
'
@MONITORINGENGINE
_USER@
';
$
CENTREON_USER
=
'
@CENTREON
_USER@
';
use
POSIX
qw(strftime)
;
eval
"
use HTML::Entities
";
...
...
@@ -277,10 +277,10 @@ sub forceCheck($$$$) {
if
(
defined
(
$id
)
&&
$id
!=
0
)
{
my
$submit
;
if
(
$whoami
eq
$
NAGIOS
USER
)
{
if
(
$whoami
eq
$
CENTREON_
USER
)
{
$submit
=
"
/bin/echo
\"
EXTERNALCMD:
$id
:[
$datetime
] SCHEDULE_FORCED_SVC_CHECK;
$this_host
;
$this_service
;
$datetime
\"
>>
$cmdFile
";
}
else
{
$submit
=
"
su -l
$
NAGIOS
USER
-c '/bin/echo
\"
EXTERNALCMD:
$id
:[
$datetime
] SCHEDULE_FORCED_SVC_CHECK;
$this_host
;
$this_service
;
$datetime
\"
>>
$cmdFile
'
";
$submit
=
"
su -l
$
CENTREON_
USER
-c '/bin/echo
\"
EXTERNALCMD:
$id
:[
$datetime
] SCHEDULE_FORCED_SVC_CHECK;
$this_host
;
$this_service
;
$datetime
\"
>>
$cmdFile
'
";
}
$result
=
send_command
(
$submit
);
...
...
@@ -295,29 +295,27 @@ sub forceCheck($$$$) {
## Submit result via external command
#
sub
submitResult
($$$$$$)
{
my
(
$dbh
,
$this_host
,
$this_service
,
$datetime
,
$status
,
$
arguments_line
)
=
@_
;
my
(
$dbh
,
$this_host
,
$this_service
,
$datetime
,
$status
,
$
traps_output
)
=
@_
;
my
$result
;
# No matching rules
my
$id
=
get_hostNagiosServerID
(
$dbh
,
$this_host
);
if
(
defined
(
$id
)
&&
$id
!=
0
)
{
my
$str
=
"
PROCESS_SERVICE_CHECK_RESULT;
$this_host
;
$this_service
;
$status
;
$
arguments_line
";
my
$str
=
"
PROCESS_SERVICE_CHECK_RESULT;
$this_host
;
$this_service
;
$status
;
$
traps_output
";
my
$submit
;
if
(
$whoami
eq
$
NAGIOS
USER
)
{
if
(
$whoami
eq
$
CENTREON_
USER
)
{
$str
=~
s/"/\\"/g
;
$submit
=
"
/bin/echo
\"
EXTERNALCMD:
$id
:[
$datetime
]
$str
\"
>>
$cmdFile
";
}
else
{
$str
=~
s/'/'\\''/g
;
$str
=~
s/"/\\"/g
;
$submit
=
"
su -l
$
NAGIOS
USER
-c '/bin/echo
\"
EXTERNALCMD:
$id
:[
$datetime
]
$str
\"
>>
$cmdFile
'
";
$submit
=
"
su -l
$
CENTREON_
USER
-c '/bin/echo
\"
EXTERNALCMD:
$id
:[
$datetime
]
$str
\"
>>
$cmdFile
'
";
}
$result
=
send_command
(
$submit
);
logit
("
SUBMIT: Force service status via passive check update
",
"
II
");
logit
("
SUBMIT: Launched command:
$submit
",
"
II
");
undef
(
$submit
);
}
return
$result
;
}
...
...
@@ -347,8 +345,8 @@ sub substitute_string {
#######################################
## Check Advanced Matching Rules
#
sub
checkMatchingRules
($$$$$$$$)
{
my
(
$dbh
,
$trap_id
,
$this_host
,
$ip
,
$hostname
,
$
arguments_line
,
$datetime
,
$status
)
=
@_
;
sub
checkMatchingRules
($$$$$$$$
$
)
{
my
(
$dbh
,
$trap_id
,
$this_host
,
$this_service
,
$ip
,
$hostname
,
$
traps_output
,
$datetime
,
$status
)
=
@_
;
# Check matching options
my
$sth
=
$dbh
->
prepare
("
SELECT tmo_regexp, tmo_status, tmo_string FROM traps_matching_properties WHERE trap_id = '
"
.
$trap_id
.
"
' ORDER BY tmo_order
");
...
...
@@ -384,8 +382,9 @@ sub checkMatchingRules($$$$$$$$) {
$tmoString
=~
s/\@HOSTNAME\@/$this_host/g
;
$tmoString
=~
s/\@HOSTADDRESS\@/$ip/g
;
$tmoString
=~
s/\@HOSTADDRESS2\@/$hostname/g
;
$tmoString
=~
s/\@TRAPOUTPUT\@/$arguments_line/g
;
$tmoString
=~
s/\@OUTPUT\@/$arguments_line/g
;
$tmoString
=~
s/\@SERVICEDESC\@/$this_service/g
;
$tmoString
=~
s/\@TRAPOUTPUT\@/$traps_output/g
;
$tmoString
=~
s/\@OUTPUT\@/$traps_output/g
;
$tmoString
=~
s/\@TIME\@/$datetime/g
;
# Integrate OID Matching
...
...
@@ -403,8 +402,8 @@ sub checkMatchingRules($$$$$$$$) {
################################
## Execute a specific command
#
sub
executeCommand
($$$$$$$)
{
my
(
$traps_execution_command
,
$this_host
,
$ip
,
$hostname
,
$
arguments_line
,
$datetime
,
$status
)
=
@_
;
sub
executeCommand
($$$$$$$
$
)
{
my
(
$traps_execution_command
,
$this_host
,
$this_service
,
$ip
,
$hostname
,
$
traps_output
,
$datetime
,
$status
)
=
@_
;
$traps_execution_command
=
substitute_string
(
$traps_execution_command
);
...
...
@@ -420,8 +419,9 @@ sub executeCommand($$$$$$$) {
$traps_execution_command
=~
s/\@HOSTNAME\@/$this_host/g
;
$traps_execution_command
=~
s/\@HOSTADDRESS\@/$_[1]/g
;
$traps_execution_command
=~
s/\@HOSTADDRESS2\@/$_[2]/g
;
$traps_execution_command
=~
s/\@TRAPOUTPUT\@/$arguments_line/g
;
$traps_execution_command
=~
s/\@OUTPUT\@/$arguments_line/g
;
$traps_execution_command
=~
s/\@SERVICEDESC\@/$this_service/g
;
$traps_execution_command
=~
s/\@TRAPOUTPUT\@/$traps_output/g
;
$traps_execution_command
=~
s/\@OUTPUT\@/$traps_output/g
;
$traps_execution_command
=~
s/\@STATUS\@/$status/g
;
$traps_execution_command
=~
s/\@TIME\@/$datetime/g
;
...
...
@@ -476,7 +476,7 @@ sub getTrapsInfos($$$) {
######################################################################
# Advanced matching rules
if
(
defined
(
$traps_advanced_treatment
)
&&
$traps_advanced_treatment
eq
1
)
{
$status
=
checkMatchingRules
(
$dbh
,
$trap_id
,
$this_host
,
$ip
,
$hostname
,
$traps_output
,
$datetime
,
$status
);
$status
=
checkMatchingRules
(
$dbh
,
$trap_id
,
$this_host
,
$this_service
,
$ip
,
$hostname
,
$traps_output
,
$datetime
,
$status
);
}
#####################################################################
...
...
@@ -494,7 +494,7 @@ sub getTrapsInfos($$$) {
######################################################################
# Execute special command
if
(
defined
(
$traps_execution_command_enable
)
&&
$traps_execution_command_enable
)
{
executeCommand
(
$traps_execution_command
,
$this_host
,
$ip
,
$hostname
,
$traps_output
,
$datetime
,
$status
);
executeCommand
(
$traps_execution_command
,
$this_host
,
$this_service
,
$ip
,
$hostname
,
$traps_output
,
$datetime
,
$status
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
www/include/eventLogs/viewLog.php
+
4
−
2
View file @
d1b97015
...
...
@@ -154,7 +154,8 @@
$services
=
preg_split
(
"/\,/"
,
$_POST
[
"svc_id"
]);
foreach
(
$services
as
$str
)
{
$buf_svc
=
preg_split
(
"/\;/"
,
$str
);
$id
.
=
"HS_"
.
getMyServiceID
(
$buf_svc
[
1
],
getMyHostID
(
$buf_svc
[
0
]))
.
","
;
$lhost_id
=
getMyHostID
(
$buf_svc
[
0
]);
$id
.
=
"HS_"
.
getMyServiceID
(
$buf_svc
[
1
],
$lhost_id
)
.
"_"
.
$lhost_id
.
","
;
}
}
...
...
@@ -169,7 +170,8 @@
$tab_svcs
=
explode
(
","
,
$id_svc
);
foreach
(
$tab_svcs
as
$svc
){
$tmp
=
explode
(
";"
,
$svc
);
$id
.
=
"HS_"
.
getMyServiceID
(
$tmp
[
1
],
getMyHostID
(
$tmp
[
0
]))
.
","
;
$lhost_id
=
getMyHostID
(
$tmp
[
0
]);
$id
.
=
"HS_"
.
getMyServiceID
(
$tmp
[
1
],
$lhost_id
)
.
"_"
.
$lhost_id
.
","
;
}
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment