File: list_all_hostgroups.py

package info (click to toggle)
pynag 1.1.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,324 kB
  • sloc: python: 9,792; makefile: 200
file content (17 lines) | stat: -rw-r--r-- 385 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/python

from __future__ import absolute_import
from __future__ import print_function
import sys
sys.path.insert(1, '/opt/pynag')
from pynag import Model


# If your nagios config is in an unusal place, uncomment this:
# Model.cfg_file = '/etc/nagios/nagios.cfg'

hostgroups = Model.Hostgroup.objects.all

for hostgroup in hostgroups:
    print(hostgroup['hostgroup_name'])