File: get_service_info.py

package info (click to toggle)
pynag 0.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,196 kB
  • ctags: 1,181
  • sloc: python: 9,155; makefile: 200; sh: 151
file content (20 lines) | stat: -rwxr-xr-x 417 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/python
import sys

if len(sys.argv) != 3:
    sys.stderr.write("Usage:  %s 'Host Name' 'Service Description'\n" % (sys.argv[0]))
    sys.exit(2)


## This is for the custom nagios module
sys.path.insert(1, '../')
from pynag.Parsers import config


## Create the plugin option
nc = config('/etc/nagios/nagios.cfg')
nc.parse()

service = nc.get_service(sys.argv[1],sys.argv[2])

print nc.print_conf(service)