Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
3adbaf3a
Commit
3adbaf3a
authored
May 14, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gateways: only force apinger status if running
(cherry picked from commit
89d73f69
)
parent
977e6e1a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
22 deletions
+24
-22
gwlb.inc
src/etc/inc/gwlb.inc
+24
-22
No files found.
src/etc/inc/gwlb.inc
View file @
3adbaf3a
...
@@ -393,31 +393,33 @@ function return_gateways_status($byname = false)
...
@@ -393,31 +393,33 @@ function return_gateways_status($byname = false)
{
{
global
$config
;
global
$config
;
$
apinger
status
=
array
();
$status
=
array
();
/* Always get the latest status from apinger */
if
(
isvalidpid
(
'/var/run/apinger.pid'
))
{
killbypid
(
'/var/run/apinger.pid'
,
'USR1'
);
/* always get the latest status from apinger */
/* we may read the wrong file here as it's async: */
killbypid
(
'/var/run/apinger.pid'
,
'USR1'
);
if
(
file_exists
(
'/var/run/apinger.status'
))
{
$apingerstatus
=
file
(
'/var/run/apinger.status'
);
}
$status
=
array
();
/* we may read the wrong file here as it's async: */
foreach
(
$apingerstatus
as
$line
)
{
if
(
file_exists
(
'/var/run/apinger.status'
))
{
$info
=
explode
(
'|'
,
$line
);
$apingerstatus
=
file
(
'/var/run/apinger.status'
);
if
(
$byname
==
false
)
{
$target
=
$info
[
0
];
}
else
{
$target
=
$info
[
2
];
}
$status
[
$target
]
=
array
();
foreach
(
$apingerstatus
as
$line
)
{
$status
[
$target
][
'monitorip'
]
=
$info
[
0
];
$info
=
explode
(
'|'
,
$line
);
$status
[
$target
][
'srcip'
]
=
$info
[
1
];
if
(
$byname
==
false
)
{
$status
[
$target
][
'name'
]
=
$info
[
2
];
$target
=
$info
[
0
];
$status
[
$target
][
'delay'
]
=
sprintf
(
'%0.1f ms'
,
empty
(
$info
[
6
])
?
0.0
:
round
(
$info
[
6
],
1
));
}
else
{
$status
[
$target
][
'loss'
]
=
sprintf
(
'%0.1f %%'
,
empty
(
$info
[
7
])
?
0.0
:
round
(
$info
[
7
],
1
));
$target
=
$info
[
2
];
$status
[
$target
][
'status'
]
=
trim
(
$info
[
8
]);
}
$status
[
$target
]
=
array
();
$status
[
$target
][
'monitorip'
]
=
$info
[
0
];
$status
[
$target
][
'srcip'
]
=
$info
[
1
];
$status
[
$target
][
'name'
]
=
$info
[
2
];
$status
[
$target
][
'delay'
]
=
sprintf
(
'%0.1f ms'
,
empty
(
$info
[
6
])
?
0.0
:
round
(
$info
[
6
],
1
));
$status
[
$target
][
'loss'
]
=
sprintf
(
'%0.1f %%'
,
empty
(
$info
[
7
])
?
0.0
:
round
(
$info
[
7
],
1
));
$status
[
$target
][
'status'
]
=
trim
(
$info
[
8
]);
}
}
}
}
/* tack on any gateways that have monitoring disabled
/* tack on any gateways that have monitoring disabled
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment