Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
JR Dalrymple
/
check_passive_autocreate
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f375f837
authored
Oct 28, 2015
by
JR Dalrymple
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.1 version
parent
9c3aa7c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
check_passive_autocreate.py
+25
-0
No files found.
check_passive_autocreate.py
View file @
f375f837
#!/usr/bin/python
#################################################################################
#
# NAME: check_passive_autocreate.py
#
# COMMENT: Python program that will compare nagios.log unconfigured services
# with objects.cache file configured objects. If the host matches it
# will create the new service using a template FILE you specify.
# Requires that the nagios user has sudo access to restart nagios.
# Also this iteration assumes systemd, for older Linux you'll have to
# adjust.
#
# TODO: - Make it so that the template file can have register 0 and the new
# services still get registerd.
# - Add init system support.
#
#
# Release Hitory:
#
# 0.1 - 10/28/2015 - Initial Release. It totally works.
#################################################################################
import
os
import
sys
import
getopt
...
...
@@ -129,4 +151,7 @@ for newService in servicesToCreate:
for
line
in
outLines
:
f
.
write
(
line
)
f
.
close
outLines
=
[]
if
len
(
servicesToCreate
)
>
0
:
os
.
system
(
"/usr/bin/sudo /usr/bin/systemctl restart nagios"
)
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