-
Notifications
You must be signed in to change notification settings - Fork 0
Python interface to Nagios object, config and status files
License
LGPL-3.0, GPL-3.0 licenses found
Licenses found
LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
daa/nagdata
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Python interface to Nagios object and status files. Parses configuration files, status.dat (status file) and represents information as collection of objects with corresponding obj_type and attributes. Objects may be changed and saved. nagdata package contains following modules: nagdata -- main module, interface to nagios object and status files, also provides class with simpler api exceptions -- exceptions used by nagdata parser -- parsers of nagios configuration and status files (parses list of lines) cparser_fmt -- parse file and keep format cparser_fast -- just parse file and don't save format nagfile -- links together files and parsers, so we can parse files collection -- collection of Nagios objects factory -- factories to produce different Nagios objects model -- Nagios objects (hoststatus, servicestatus, service definition, etc) fields -- Types of Nagios object attributes fmt -- "Imaginary" format object helping to keep nagios file format and structure Both cparser_fmt and cparser_fast are produced from the same cparser.c (and symlink to it cparser2.c) Some little examples: # update status: from nagdata import nagdata n = nagdata.NagData() n.update_status() # retrieve some objects: from nagdata.nagdata import * n = NagData() for o in n.filter(obj_type='servicestatus', host_name='c6509'): print o hg = n.get('hostgroup', hostgroup_name='servers_corp') print hg sg = n.get('servicegroup', servicegroup_name='mailq_group') print sg # simpler api from nagdata import nagdata n = nagdata.NagDataSimpleApi() # get host by address h0 = n.get_host('172.16.1.1') # get host by name h1 = n.get_host('router1') # statuses print n.get_hoststatus('router1') print n.get_servicestatus('PING', 'router1') hg = n.get_hostgroup('servers_corp') # change address h0['address'] = 'router2' # and save to file n.save(h0) # create and add object from nagdata import nagdata n = nagdata.NagDataSimpleApi() #create and add config object svc = n.new('service', service_description='PING', host_name='localhost') # just create svc = n.factory('service', service_description='PING') svc['host_name'] = 'router1' # add to config n.config.add(svc)
About
Python interface to Nagios object, config and status files
Resources
License
LGPL-3.0, GPL-3.0 licenses found
Licenses found
LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Stars
Watchers
Forks
Packages 0
No packages published