Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nagios-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lcgdm
nagios-plugins
Commits
ed39e18d
Commit
ed39e18d
authored
13 years ago
by
abeche
Browse files
Options
Downloads
Patches
Plain Diff
Fix check_gridftp_transfer to follow the thread
parent
707b3ad4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/check_gridftp_transfer
+28
-11
28 additions, 11 deletions
plugins/check_gridftp_transfer
with
28 additions
and
11 deletions
plugins/check_gridftp_transfer
+
28
−
11
View file @
ed39e18d
...
...
@@ -99,9 +99,12 @@ class check_gridftp_transfer:
transfer_failed_before_starting
=
0
# Pattern to parse the logfile
endtrans_pattern
=
re
.
compile
(
"
^\[\d*\] (.*) :: Closed connection
"
)
begtrans_pattern
=
re
.
compile
(
"
Server started
"
)
return_pattern
=
re
.
compile
(
"
^\[\d*\] (.*) :: .* \[SERVER\]\: (\d*)
"
)
endtrans_pattern
=
re
.
compile
(
"
^\[(\d*)\] (.*) :: Closed connection
"
)
begtrans_pattern
=
re
.
compile
(
"
^\[(\d*)\] (.*) :: Server started
"
)
return_pattern
=
re
.
compile
(
"
^\[(\d*)\] (.*) :: .* \[SERVER\]\: (\d*)
"
)
# Flags for each thread (transfer_start and error)
thread_infos
=
{}
# Open the file and parse it in reverse order
gridftp
=
open
(
self
.
log
,
"
r
"
)
...
...
@@ -112,12 +115,15 @@ class check_gridftp_transfer:
# End transfer detected
if
found_end
:
thread_id
=
int
(
found_end
.
group
(
1
))
thread_infos
[
thread_id
]
=
{
"
transfer_start
"
:
0
,
"
error
"
:
0
}
# Set the error and transfer flags to 0
transfer_start
,
error
=
0
,
0
# Stop the probes if the wanted interval is finished
try
:
dt
=
strptime
(
found_end
.
group
(
1
).
strip
(),
"
%a %b %d %X %Y
"
)
dt
=
strptime
(
found_end
.
group
(
2
).
strip
(),
"
%a %b %d %X %Y
"
)
if
int
(
mktime
(
gmtime
())
-
mktime
(
dt
))
>
(
self
.
interval
*
60
):
break
except
:
...
...
@@ -125,23 +131,34 @@ class check_gridftp_transfer:
# Standard return detected
elif
found_pattern
:
thread_id
=
int
(
found_pattern
.
group
(
1
))
if
thread_id
not
in
thread_infos
:
continue
# Error code detected
code
=
found_pattern
.
group
(
2
)
code
=
found_pattern
.
group
(
3
)
if
(
int
(
code
)
>
399
)
and
(
int
(
code
)
<
555
):
error
=
1
thread_infos
[
thread_id
][
"
error
"
]
=
1
# Transfer starting detected
elif
int
(
code
)
==
150
:
transfer_start
=
1
thread_infos
[
thread_id
][
"
transfer_start
"
]
=
1
# Transfert starting pattern
elif
found_start
:
if
(
transfer_start
==
1
)
and
(
error
==
0
):
thread_id
=
int
(
found_start
.
group
(
1
))
if
thread_id
not
in
thread_infos
:
continue
if
(
thread_infos
[
thread_id
][
"
transfer_start
"
]
==
1
)
and
(
thread_infos
[
thread_id
][
"
error
"
]
==
0
):
transfer_succeed
+=
1
elif
(
transfer_start
==
1
)
and
(
error
==
1
):
elif
(
thread_infos
[
thread_id
][
"
transfer_start
"
]
==
1
)
and
(
thread_infos
[
thread_id
][
"
error
"
]
==
1
):
transfer_start_then_failed
+=
1
elif
(
transfer_start
==
0
)
and
(
error
==
1
):
elif
(
thread_infos
[
thread_id
][
"
transfer_start
"
]
==
0
)
and
(
thread_infos
[
thread_id
][
"
error
"
]
==
1
):
transfer_failed_before_starting
+=
1
# Remove the transfer infos from the list
del
thread_infos
[
thread_id
]
return
transfer_succeed
,
transfer_start_then_failed
,
transfer_failed_before_starting
def
main
(
self
):
...
...
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