Changeset 11326 in genesis
- Timestamp:
- Jul 12, 2012, 9:31:54 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/gformat.py
r10999 r11326 139 139 'service_proxy_ileiden' : False, 140 140 'service_accesspoint' : True, 141 'service_incoming_rdr' : False 141 'service_incoming_rdr' : False, 142 'monitoring_group' : 'wleiden', 142 143 } 143 144 for (key,value) in defaults.iteritems(): … … 1366 1367 \tstandalone [port] = Run configurator webserver [8000] 1367 1368 \tdns [outputdir] = Generate BIND compliant zone files in dns [./dns] 1369 \tnagios-export [--heavy-load] = Generate basic nagios configuration file. 1368 1370 \tfull-export = Generate yaml export script for heatmap. 1369 1371 \tstatic [outputdir] = Generate all config files and store on disk … … 1534 1536 VALUES ((SELECT id FROM nodes WHERE name = '%(nodename)s'), 'ap', 1535 1537 '%(ssid)s', 'IEEE 802.11b', %(channel)s, 'active');""" % ifacedump 1538 elif sys.argv[1] == "nagios-export": 1539 try: 1540 heavy_load = (sys.argv[2] == "--heavy-load") 1541 except IndexError: 1542 heavy_load = False 1543 1544 hostgroup_details = { 1545 'wleiden' : 'Stichting Wireless Leiden - FreeBSD Nodes', 1546 'wzoeterwoude' : 'Stichting Wireless Leiden - Afdeling Zoeterwoude - Free-WiFi Project', 1547 'walphen' : 'Stichting Wireless Alphen', 1548 'westeinder' : 'WestEinder Plassen', 1549 } 1550 1551 params = { 1552 'check_interval' : 5 if heavy_load else 60, 1553 'retry_interval' : 1 if heavy_load else 5, 1554 'max_check_attempts' : 10 if heavy_load else 3, 1555 } 1556 1557 print '''\ 1558 define host { 1559 name wleiden-node ; Default Node Template 1560 use generic-host ; Use the standard template as initial starting point 1561 check_period 24x7 ; By default, FreeBSD hosts are checked round the clock 1562 check_interval %(check_interval)s ; Actively check the host every 5 minutes 1563 retry_interval %(retry_interval)s ; Schedule host check retries at 1 minute intervals 1564 max_check_attempts %(max_check_attempts)s ; Check each FreeBSD host 10 times (max) 1565 register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! 1566 } 1567 1568 define service { 1569 name wleiden-service ; Default Service Template 1570 use generic-service ; Use the standard template as initial starting point 1571 check_period 24x7 ; By default, FreeBSD hosts are checked round the clock 1572 check_interval %(check_interval)s ; Actively check the host every 5 minutes 1573 retry_interval %(retry_interval)s ; Schedule host check retries at 1 minute intervals 1574 max_check_attempts %(max_check_attempts)s ; Check each FreeBSD host 10 times (max) 1575 register 0 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE! 1576 } 1577 1578 # Please make sure to install: 1579 # make -C /usr/ports/net-mgmt/nagios-check_netsnmp install clean 1580 # 1581 define command{ 1582 command_name check_netsnmp_disk 1583 command_line $USER1$/check_netsnmp -H $HOSTADDRESS$ -o disk 1584 } 1585 1586 define command{ 1587 command_name check_netsnmp_load 1588 command_line $USER1$/check_netsnmp -H $HOSTADDRESS$ -o load 1589 } 1590 1591 define command{ 1592 command_name check_netsnmp_proc 1593 command_line $USER1$/check_netsnmp -H $HOSTADDRESS$ -o proc 1594 } 1595 1596 # TDB: dhcp leases 1597 # /usr/local/libexec/nagios/check_netsnmp -H 192.168.178.47 --oid 1 exec 1598 1599 # TDB: internet status 1600 # /usr/local/libexec/nagios/check_netsnmp -H 192.168.178.47 --oid 1 file 1601 1602 # TDB: Advanced local passive checks 1603 # /usr/local/libexec/nagios/check_by_ssh 1604 ''' % params 1605 1606 print '''\ 1607 # Service Group, not displayed by default 1608 define hostgroup { 1609 hostgroup_name srv_hybrid 1610 alias All Hybrid Nodes 1611 register 0 1612 } 1613 1614 define service { 1615 use wleiden-service 1616 hostgroup_name srv_hybrid 1617 service_description SSH 1618 check_command check_ssh 1619 } 1620 1621 define service { 1622 use wleiden-service 1623 hostgroup_name srv_hybrid 1624 service_description HTTP 1625 check_command check_http 1626 } 1627 1628 define service { 1629 use wleiden-service 1630 hostgroup_name srv_hybrid 1631 service_description DNS 1632 check_command check_dns 1633 } 1634 1635 # TDB: Can only test this if we have the proxy listening to all addresses. 1636 # define service { 1637 # use wleiden-service 1638 # hostgroup_name srv_hybrid 1639 # service_description PROXY 1640 # check_command check_tcp!3128 1641 # } 1642 ''' 1643 1644 if heavy_load: 1645 print '''\ 1646 define service { 1647 use wleiden-service 1648 hostgroup_name srv_hybrid 1649 service_description SNMP 1650 check_command check_snmp 1651 } 1652 1653 define service { 1654 use wleiden-service 1655 hostgroup_name srv_hybrid 1656 service_description NTP 1657 check_command check_ntp_peer 1658 } 1659 1660 define service { 1661 use wleiden-service 1662 hostgroup_name srv_hybrid 1663 service_description LOAD 1664 check_command check_netsnmp_load 1665 } 1666 1667 define service { 1668 use wleiden-service 1669 hostgroup_name srv_hybrid 1670 service_description PROC 1671 check_command check_netsnmp_proc 1672 } 1673 1674 define service { 1675 use wleiden-service 1676 hostgroup_name srv_hybrid 1677 service_description DISK 1678 check_command check_netsnmp_disk 1679 } 1680 ''' 1681 for node in get_hostlist(): 1682 datadump = get_yaml(node) 1683 if not datadump['status'] == 'up': 1684 continue 1685 if not hostgroup_details.has_key(datadump['monitoring_group']): 1686 hostgroup_details[datadump['monitoring_group']] = datadump['monitoring_group'] 1687 print '''\ 1688 define host { 1689 use wleiden-node 1690 host_name %(autogen_fqdn)s 1691 address %(masterip)s 1692 hostgroups srv_hybrid,%(monitoring_group)s 1693 } 1694 ''' % datadump 1695 1696 for name,alias in hostgroup_details.iteritems(): 1697 print '''\ 1698 define hostgroup { 1699 hostgroup_name %s 1700 alias %s 1701 } ''' % (name, alias) 1702 1703 1536 1704 elif sys.argv[1] == "full-export": 1537 1705 hosts = {}
Note:
See TracChangeset
for help on using the changeset viewer.