Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
icinga-plugins
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
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
cscf
icinga-plugins
Commits
370fb107
Commit
370fb107
authored
3 years ago
by
root
Browse files
Options
Downloads
Patches
Plain Diff
Added suppor for multiple input/output phases on check_ups_eaton.
parent
525523bc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
check_ups_eaton
+38
-12
38 additions, 12 deletions
check_ups_eaton
with
38 additions
and
12 deletions
check_ups_eaton
+
38
−
12
View file @
370fb107
...
...
@@ -49,7 +49,10 @@ xupsBatVoltage=".1.3.6.1.4.1.534.1.2.2.0"
xupsBatCurrent
=
"
.1.3.6.1.4.1.534.1.2.3.0
"
# Input
xupsInputVoltage
=
"
.1.3.6.1.4.1.534.1.3.4.1.2.1
"
# Input line voltage (V)
xupsInputPhase
=
"
.1.3.6.1.4.1.534.1.3.4.1.1
"
# Input phase index
xupsInputVoltage
=
"
.1.3.6.1.4.1.534.1.3.4.1.2
"
# Input line voltage (V)
xupsInputCurrent
=
"
.1.3.6.1.4.1.534.1.3.4.1.3
"
xupsInputWatts
=
"
.1.3.6.1.4.1.534.1.3.4.1.4
"
xupsInputFrequency
=
"
.1.3.6.1.4.1.534.1.3.1.0
"
# Input line frequency (0.1 Hz)
xupsInputSource
=
"
.1.3.6.1.4.1.534.1.3.5.0
"
InputSource
=
{
...
...
@@ -64,6 +67,7 @@ InputSource = {
}
# xupsOutput
xupsOutputPhase
=
"
.1.3.6.1.4.1.534.1.4.4.1.1
"
xupsOutputSource
=
"
.1.3.6.1.4.1.534.1.4.5.0
"
OutputSource
=
{
1
:
"
Other
"
,
...
...
@@ -79,11 +83,11 @@ OutputSource = {
11
:
"
Maintenance Bypass
"
}
xupsOutputVoltage
=
"
.1.3.6.1.4.1.534.1.4.4.1.2
.1
"
# Output line voltage (V)
xupsOutputVoltage
=
"
.1.3.6.1.4.1.534.1.4.4.1.2
"
# Output line voltage (V)
xupsOutputFrequency
=
"
.1.3.6.1.4.1.534.1.4.2.0
"
# Output line frequency (0.1 Hz)
xupsOutputLoad
=
"
.1.3.6.1.4.1.534.1.4.1.0
"
# Load placed on the UPS (%)
xupsOutputCurrent
=
"
.1.3.6.1.4.1.534.1.4.4.1.3
.1
"
# Output line current (A)
xupsOutputWatts
=
"
.1.3.6.1.4.1.534.1.4.4.1.4
.1
"
# Output Watts (W)
xupsOutputCurrent
=
"
.1.3.6.1.4.1.534.1.4.4.1.3
"
# Output line current (A)
xupsOutputWatts
=
"
.1.3.6.1.4.1.534.1.4.4.1.4
"
# Output Watts (W)
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
-c
"
,
default
=
"
public
"
,
dest
=
"
community
"
,
help
=
"
Community to query the agent
"
)
...
...
@@ -121,16 +125,28 @@ xupsBatTimeRemaining=int(netsnmp.snmpget(netsnmp.Varbind(xupsBatTimeRemaining),
xupsBatVoltage
=
int
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsBatVoltage
),
**
args
)[
0
])
xupsBatCurrent
=
int
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsBatCurrent
),
**
args
)[
0
])
xupsInputVoltage
=
float
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsInputVoltage
),
**
args
)[
0
])
# Determine the amount of input phases
xupsInputPhase
=
netsnmp
.
snmpwalk
(
netsnmp
.
Varbind
(
xupsInputPhase
),
**
args
)
xupsInputFrequency
=
int
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsInputFrequency
),
**
args
)[
0
])
/
10
# 0.1 Hertz
xupsInputSource
=
int
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsInputSource
),
**
args
)[
0
])
# Determine the amount of output phases
xupsOutputPhase
=
netsnmp
.
snmpwalk
(
netsnmp
.
Varbind
(
xupsOutputPhase
),
**
args
)
xupsOutputSource
=
int
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsOutputSource
),
**
args
)[
0
])
xupsOutputVoltage
=
float
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsOutputVoltage
),
**
args
)[
0
])
# Dynamic input variables
xupsInputVoltage
=
netsnmp
.
snmpwalk
(
netsnmp
.
Varbind
(
xupsInputVoltage
),
**
args
)
xupsInputCurrent
=
netsnmp
.
snmpwalk
(
netsnmp
.
Varbind
(
xupsInputCurrent
),
**
args
)
xupsInputWatts
=
netsnmp
.
snmpwalk
(
netsnmp
.
Varbind
(
xupsInputWatts
),
**
args
)
# Dynamic output variables
xupsOutputVoltage
=
netsnmp
.
snmpwalk
(
netsnmp
.
Varbind
(
xupsOutputVoltage
),
**
args
)
xupsOutputCurrent
=
netsnmp
.
snmpwalk
(
netsnmp
.
Varbind
(
xupsOutputCurrent
),
**
args
)
xupsOutputWatts
=
netsnmp
.
snmpwalk
(
netsnmp
.
Varbind
(
xupsOutputWatts
),
**
args
)
xupsOutputFrequency
=
int
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsOutputFrequency
),
**
args
)[
0
])
/
10
xupsOutputLoad
=
float
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsOutputLoad
),
**
args
)[
0
])
xupsOutputCurrent
=
float
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsOutputCurrent
),
**
args
)[
0
])
xupsOutputWatts
=
int
(
netsnmp
.
snmpget
(
netsnmp
.
Varbind
(
xupsOutputWatts
),
**
args
)[
0
])
# Check whether batteries need replacement
if
(
xupsBatteryAbmStatus
==
8
):
...
...
@@ -154,16 +170,26 @@ OUTPUT_TEXT += " Runtime: " + str(xupsBatTimeRemaining / 60) + "m"
OUTPUT_TEXT
+=
"
Batteries Last Replaced:
"
+
xupsBatteryLastReplacedDate
# Perfdata
PERFDATA
+=
"
xupsInputVoltage=
"
+
str
(
xupsInputVoltage
)
PERFDATA
+=
"
xupsInputFrequency=
"
+
str
(
xupsInputFrequency
)
PERFDATA
+=
"
xupsInputSource=
"
+
str
(
xupsInputSource
)
PERFDATA
+=
"
xupsOutputSource=
"
+
str
(
xupsOutputSource
)
PERFDATA
+=
"
xupsOutputVoltage=
"
+
str
(
xupsOutputVoltage
)
PERFDATA
+=
"
xupsOutputFrequency=
"
+
str
(
xupsOutputFrequency
)
PERFDATA
+=
"
xupsOutputCurrent=
"
+
str
(
xupsOutputCurrent
)
PERFDATA
+=
"
xupsOutputLoad=
"
+
str
(
xupsOutputLoad
)
PERFDATA
+=
"
xupsOutputWatts=
"
+
str
(
xupsOutputWatts
)
for
phase
in
xupsInputPhase
:
PERFDATA
+=
"
xupsInputVoltage_Phase-
"
+
phase
+
"
=
"
+
str
(
xupsInputVoltage
[
int
(
phase
)
-
1
])
if
xupsInputCurrent
:
PERFDATA
+=
"
xupsInputCurrent_Phase-
"
+
phase
+
"
=
"
+
str
(
xupsInputCurrent
[
int
(
phase
)
-
1
])
if
xupsInputWatts
:
PERFDATA
+=
"
xupsInputWatts_Phase-
"
+
phase
+
"
=
"
+
str
(
xupsInputWatts
[
int
(
phase
)
-
1
])
for
phase
in
xupsOutputPhase
:
PERFDATA
+=
"
xupsOutputVoltage_Phase-
"
+
phase
+
"
=
"
+
str
(
xupsOutputVoltage
[
int
(
phase
)
-
1
])
PERFDATA
+=
"
xupsOutputCurrent_Phase-
"
+
phase
+
"
=
"
+
str
(
xupsOutputCurrent
[
int
(
phase
)
-
1
])
PERFDATA
+=
"
xupsOutputWatts_Phase-
"
+
phase
+
"
=
"
+
str
(
xupsOutputWatts
[
int
(
phase
)
-
1
])
PERFDATA
+=
"
xupsBatteryAbmStatus=
"
+
str
(
xupsBatteryAbmStatus
)
PERFDATA
+=
"
xupsBatCapacity=
"
+
str
(
xupsBatCapacity
)
...
...
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