[Midnightbsd-cvs] src [9433] trunk: add hast module for bsnmpd.
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Sun Mar 5 09:28:35 EST 2017
Revision: 9433
http://svnweb.midnightbsd.org/src/?rev=9433
Author: laffer1
Date: 2017-03-05 09:28:35 -0500 (Sun, 05 Mar 2017)
Log Message:
-----------
add hast module for bsnmpd. Obtained from: FreeBSD 9 stable
Modified Paths:
--------------
trunk/usr.sbin/bsnmpd/modules/Makefile
Added Paths:
-----------
trunk/lib/libprocstat/core.c
trunk/lib/libprocstat/core.h
trunk/usr.sbin/bsnmpd/modules/snmp_hast/
trunk/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt
trunk/usr.sbin/bsnmpd/modules/snmp_hast/Makefile
trunk/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c
trunk/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def
trunk/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.8
Added: trunk/lib/libprocstat/core.c
===================================================================
--- trunk/lib/libprocstat/core.c (rev 0)
+++ trunk/lib/libprocstat/core.c 2017-03-05 14:28:35 UTC (rev 9433)
@@ -0,0 +1,433 @@
+/*-
+ * Copyright (c) 2013 Mikolaj Golub <trociny at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/elf.h>
+#include <sys/exec.h>
+#include <sys/user.h>
+
+#include <assert.h>
+#include <err.h>
+#include <fcntl.h>
+#include <gelf.h>
+#include <libelf.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "core.h"
+
+#define PROCSTAT_CORE_MAGIC 0x012DADB8
+struct procstat_core
+{
+ int pc_magic;
+ int pc_fd;
+ Elf *pc_elf;
+ GElf_Ehdr pc_ehdr;
+ GElf_Phdr pc_phdr;
+};
+
+static bool core_offset(struct procstat_core *core, off_t offset);
+static bool core_read(struct procstat_core *core, void *buf, size_t len);
+static ssize_t core_read_mem(struct procstat_core *core, void *buf,
+ size_t len, vm_offset_t addr, bool readall);
+static void *get_args(struct procstat_core *core, vm_offset_t psstrings,
+ enum psc_type type, void *buf, size_t *lenp);
+
+struct procstat_core *
+procstat_core_open(const char *filename)
+{
+ struct procstat_core *core;
+ Elf *e;
+ GElf_Ehdr ehdr;
+ GElf_Phdr phdr;
+ size_t nph;
+ int fd, i;
+
+ if (elf_version(EV_CURRENT) == EV_NONE) {
+ warnx("ELF library too old");
+ return (NULL);
+ }
+ fd = open(filename, O_RDONLY, 0);
+ if (fd == -1) {
+ warn("open(%s)", filename);
+ return (NULL);
+ }
+ e = elf_begin(fd, ELF_C_READ, NULL);
+ if (e == NULL) {
+ warnx("elf_begin: %s", elf_errmsg(-1));
+ goto fail;
+ }
+ if (elf_kind(e) != ELF_K_ELF) {
+ warnx("%s is not an ELF object", filename);
+ goto fail;
+ }
+ if (gelf_getehdr(e, &ehdr) == NULL) {
+ warnx("gelf_getehdr: %s", elf_errmsg(-1));
+ goto fail;
+ }
+ if (ehdr.e_type != ET_CORE) {
+ warnx("%s is not a CORE file", filename);
+ goto fail;
+ }
+ if (elf_getphnum(e, &nph) == 0) {
+ warnx("program headers not found");
+ goto fail;
+ }
+ for (i = 0; i < ehdr.e_phnum; i++) {
+ if (gelf_getphdr(e, i, &phdr) != &phdr) {
+ warnx("gelf_getphdr: %s", elf_errmsg(-1));
+ goto fail;
+ }
+ if (phdr.p_type == PT_NOTE)
+ break;
+ }
+ if (i == ehdr.e_phnum) {
+ warnx("NOTE program header not found");
+ goto fail;
+ }
+ core = malloc(sizeof(struct procstat_core));
+ if (core == NULL) {
+ warn("malloc(%zu)", sizeof(struct procstat_core));
+ goto fail;
+ }
+ core->pc_magic = PROCSTAT_CORE_MAGIC;
+ core->pc_fd = fd;
+ core->pc_elf = e;
+ core->pc_ehdr = ehdr;
+ core->pc_phdr = phdr;
+
+ return (core);
+fail:
+ if (e != NULL)
+ elf_end(e);
+ close(fd);
+
+ return (NULL);
+}
+
+void
+procstat_core_close(struct procstat_core *core)
+{
+
+ assert(core->pc_magic == PROCSTAT_CORE_MAGIC);
+
+ elf_end(core->pc_elf);
+ close(core->pc_fd);
+ free(core);
+}
+
+void *
+procstat_core_get(struct procstat_core *core, enum psc_type type, void *buf,
+ size_t *lenp)
+{
+ Elf_Note nhdr;
+ off_t offset, eoffset;
+ vm_offset_t psstrings;
+ void *freebuf;
+ size_t len;
+ u_int32_t n_type;
+ int cstructsize, structsize;
+ char nbuf[8];
+
+ assert(core->pc_magic == PROCSTAT_CORE_MAGIC);
+
+ switch(type) {
+ case PSC_TYPE_PROC:
+ n_type = NT_PROCSTAT_PROC;
+ structsize = sizeof(struct kinfo_proc);
+ break;
+ case PSC_TYPE_FILES:
+ n_type = NT_PROCSTAT_FILES;
+ structsize = sizeof(struct kinfo_file);
+ break;
+ case PSC_TYPE_VMMAP:
+ n_type = NT_PROCSTAT_VMMAP;
+ structsize = sizeof(struct kinfo_vmentry);
+ break;
+ case PSC_TYPE_GROUPS:
+ n_type = NT_PROCSTAT_GROUPS;
+ structsize = sizeof(gid_t);
+ break;
+ case PSC_TYPE_UMASK:
+ n_type = NT_PROCSTAT_UMASK;
+ structsize = sizeof(u_short);
+ break;
+ case PSC_TYPE_RLIMIT:
+ n_type = NT_PROCSTAT_RLIMIT;
+ structsize = sizeof(struct rlimit) * RLIM_NLIMITS;
+ break;
+ case PSC_TYPE_OSREL:
+ n_type = NT_PROCSTAT_OSREL;
+ structsize = sizeof(int);
+ break;
+ case PSC_TYPE_PSSTRINGS:
+ case PSC_TYPE_ARGV:
+ case PSC_TYPE_ENVV:
+ n_type = NT_PROCSTAT_PSSTRINGS;
+ structsize = sizeof(vm_offset_t);
+ break;
+ case PSC_TYPE_AUXV:
+ n_type = NT_PROCSTAT_AUXV;
+ structsize = sizeof(Elf_Auxinfo);
+ break;
+ default:
+ warnx("unknown core stat type: %d", type);
+ return (NULL);
+ }
+
+ offset = core->pc_phdr.p_offset;
+ eoffset = offset + core->pc_phdr.p_filesz;
+
+ while (offset < eoffset) {
+ if (!core_offset(core, offset))
+ return (NULL);
+ if (!core_read(core, &nhdr, sizeof(nhdr)))
+ return (NULL);
+
+ offset += sizeof(nhdr) +
+ roundup2(nhdr.n_namesz, sizeof(Elf32_Size)) +
+ roundup2(nhdr.n_descsz, sizeof(Elf32_Size));
+
+ if (nhdr.n_namesz == 0 && nhdr.n_descsz == 0)
+ break;
+ if (nhdr.n_type != n_type)
+ continue;
+ if (nhdr.n_namesz != 8)
+ continue;
+ if (!core_read(core, nbuf, sizeof(nbuf)))
+ return (NULL);
+ if (strcmp(nbuf, "FreeBSD") != 0)
+ continue;
+ if (nhdr.n_descsz < sizeof(cstructsize)) {
+ warnx("corrupted core file");
+ return (NULL);
+ }
+ if (!core_read(core, &cstructsize, sizeof(cstructsize)))
+ return (NULL);
+ if (cstructsize != structsize) {
+ warnx("version mismatch");
+ return (NULL);
+ }
+ len = nhdr.n_descsz - sizeof(cstructsize);
+ if (len == 0)
+ return (NULL);
+ if (buf != NULL) {
+ len = MIN(len, *lenp);
+ freebuf = NULL;
+ } else {
+ freebuf = buf = malloc(len);
+ if (buf == NULL) {
+ warn("malloc(%zu)", len);
+ return (NULL);
+ }
+ }
+ if (!core_read(core, buf, len)) {
+ free(freebuf);
+ return (NULL);
+ }
+ if (type == PSC_TYPE_ARGV || type == PSC_TYPE_ENVV) {
+ if (len < sizeof(psstrings)) {
+ free(freebuf);
+ return (NULL);
+ }
+ psstrings = *(vm_offset_t *)buf;
+ if (freebuf == NULL)
+ len = *lenp;
+ else
+ buf = NULL;
+ free(freebuf);
+ buf = get_args(core, psstrings, type, buf, &len);
+ }
+ *lenp = len;
+ return (buf);
+ }
+
+ return (NULL);
+}
+
+static bool
+core_offset(struct procstat_core *core, off_t offset)
+{
+
+ assert(core->pc_magic == PROCSTAT_CORE_MAGIC);
+
+ if (lseek(core->pc_fd, offset, SEEK_SET) == -1) {
+ warn("core: lseek(%jd)", (intmax_t)offset);
+ return (false);
+ }
+ return (true);
+}
+
+static bool
+core_read(struct procstat_core *core, void *buf, size_t len)
+{
+ ssize_t n;
+
+ assert(core->pc_magic == PROCSTAT_CORE_MAGIC);
+
+ n = read(core->pc_fd, buf, len);
+ if (n == -1) {
+ warn("core: read");
+ return (false);
+ }
+ if (n < (ssize_t)len) {
+ warnx("core: short read");
+ return (false);
+ }
+ return (true);
+}
+
+static ssize_t
+core_read_mem(struct procstat_core *core, void *buf, size_t len,
+ vm_offset_t addr, bool readall)
+{
+ GElf_Phdr phdr;
+ off_t offset;
+ int i;
+
+ assert(core->pc_magic == PROCSTAT_CORE_MAGIC);
+
+ for (i = 0; i < core->pc_ehdr.e_phnum; i++) {
+ if (gelf_getphdr(core->pc_elf, i, &phdr) != &phdr) {
+ warnx("gelf_getphdr: %s", elf_errmsg(-1));
+ return (-1);
+ }
+ if (phdr.p_type != PT_LOAD)
+ continue;
+ if (addr < phdr.p_vaddr || addr > phdr.p_vaddr + phdr.p_memsz)
+ continue;
+ offset = phdr.p_offset + (addr - phdr.p_vaddr);
+ if ((phdr.p_vaddr + phdr.p_memsz) - addr < len) {
+ if (readall) {
+ warnx("format error: "
+ "attempt to read out of segment");
+ return (-1);
+ }
+ len = (phdr.p_vaddr + phdr.p_memsz) - addr;
+ }
+ if (!core_offset(core, offset))
+ return (-1);
+ if (!core_read(core, buf, len))
+ return (-1);
+ return (len);
+ }
+ warnx("format error: address %ju not found", (uintmax_t)addr);
+ return (-1);
+}
+
+#define ARGS_CHUNK_SZ 256 /* Chunk size (bytes) for get_args operations. */
+
+static void *
+get_args(struct procstat_core *core, vm_offset_t psstrings, enum psc_type type,
+ void *args, size_t *lenp)
+{
+ struct ps_strings pss;
+ void *freeargs;
+ vm_offset_t addr;
+ char **argv, *p;
+ size_t chunksz, done, len, nchr, size;
+ ssize_t n;
+ u_int i, nstr;
+
+ assert(type == PSC_TYPE_ARGV || type == PSC_TYPE_ENVV);
+
+ if (core_read_mem(core, &pss, sizeof(pss), psstrings, true) == -1)
+ return (NULL);
+ if (type == PSC_TYPE_ARGV) {
+ addr = (vm_offset_t)pss.ps_argvstr;
+ nstr = pss.ps_nargvstr;
+ } else /* type == PSC_TYPE_ENVV */ {
+ addr = (vm_offset_t)pss.ps_envstr;
+ nstr = pss.ps_nenvstr;
+ }
+ if (addr == 0 || nstr == 0)
+ return (NULL);
+ if (nstr > ARG_MAX) {
+ warnx("format error");
+ return (NULL);
+ }
+ size = nstr * sizeof(char *);
+ argv = malloc(size);
+ if (argv == NULL) {
+ warn("malloc(%zu)", size);
+ return (NULL);
+ }
+ done = 0;
+ freeargs = NULL;
+ if (core_read_mem(core, argv, size, addr, true) == -1)
+ goto fail;
+ if (args != NULL) {
+ nchr = MIN(ARG_MAX, *lenp);
+ } else {
+ nchr = ARG_MAX;
+ freeargs = args = malloc(nchr);
+ if (args == NULL) {
+ warn("malloc(%zu)", nchr);
+ goto fail;
+ }
+ }
+ p = args;
+ for (i = 0; ; i++) {
+ if (i == nstr)
+ goto done;
+ /*
+ * The program may have scribbled into its argv array, e.g. to
+ * remove some arguments. If that has happened, break out
+ * before trying to read from NULL.
+ */
+ if (argv[i] == NULL)
+ goto done;
+ for (addr = (vm_offset_t)argv[i]; ; addr += chunksz) {
+ chunksz = MIN(ARGS_CHUNK_SZ, nchr - 1 - done);
+ if (chunksz <= 0)
+ goto done;
+ n = core_read_mem(core, p, chunksz, addr, false);
+ if (n == -1)
+ goto fail;
+ len = strnlen(p, chunksz);
+ p += len;
+ done += len;
+ if (len != chunksz)
+ break;
+ }
+ *p++ = '\0';
+ done++;
+ }
+fail:
+ free(freeargs);
+ args = NULL;
+done:
+ *lenp = done;
+ free(argv);
+ return (args);
+}
Property changes on: trunk/lib/libprocstat/core.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/lib/libprocstat/core.h
===================================================================
--- trunk/lib/libprocstat/core.h (rev 0)
+++ trunk/lib/libprocstat/core.h 2017-03-05 14:28:35 UTC (rev 9433)
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 2013 Mikolaj Golub <trociny at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _CORE_H
+#define _CORE_H
+
+enum psc_type {
+ PSC_TYPE_PROC,
+ PSC_TYPE_FILES,
+ PSC_TYPE_VMMAP,
+ PSC_TYPE_GROUPS,
+ PSC_TYPE_UMASK,
+ PSC_TYPE_RLIMIT,
+ PSC_TYPE_OSREL,
+ PSC_TYPE_PSSTRINGS,
+ PSC_TYPE_ARGV,
+ PSC_TYPE_ENVV,
+ PSC_TYPE_AUXV,
+};
+
+struct procstat_core;
+
+void procstat_core_close(struct procstat_core *core);
+void *procstat_core_get(struct procstat_core *core, enum psc_type type,
+ void * buf, size_t *lenp);
+struct procstat_core *procstat_core_open(const char *filename);
+
+#endif /* !_CORE_H_ */
Property changes on: trunk/lib/libprocstat/core.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/usr.sbin/bsnmpd/modules/Makefile
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/Makefile 2017-03-05 14:25:04 UTC (rev 9432)
+++ trunk/usr.sbin/bsnmpd/modules/Makefile 2017-03-05 14:28:35 UTC (rev 9433)
@@ -10,6 +10,7 @@
SUBDIR= ${_snmp_atm} \
snmp_bridge \
+ snmp_hast \
snmp_hostres \
snmp_mibII \
snmp_pf \
Added: trunk/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt (rev 0)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt 2017-03-05 14:28:35 UTC (rev 9433)
@@ -0,0 +1,298 @@
+--
+-- Copyright (c) 2013 Mikolaj Golub <trociny at FreeBSD.org>
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+-- 1. Redistributions of source code must retain the above copyright
+-- notice, this list of conditions and the following disclaimer.
+-- 2. Redistributions in binary form must reproduce the above copyright
+-- notice, this list of conditions and the following disclaimer in the
+-- documentation and/or other materials provided with the distribution.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+-- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+-- SUCH DAMAGE.
+--
+-- $FreeBSD$
+--
+
+BEGEMOT-HAST-MIB DEFINITIONS ::= BEGIN
+
+IMPORTS
+ MODULE-IDENTITY, OBJECT-TYPE, NOTIFICATION-TYPE,
+ Counter64, Integer32
+ FROM SNMPv2-SMI
+ TEXTUAL-CONVENTION, RowStatus
+ FROM SNMPv2-TC
+ InterfaceIndex, ifIndex
+ FROM IF-MIB
+ begemot
+ FROM BEGEMOT-MIB;
+
+begemotHast MODULE-IDENTITY
+ LAST-UPDATED "201304130000Z"
+ ORGANIZATION "FreeBSD"
+ CONTACT-INFO
+ " Mikolaj Golub
+
+ Postal: Bluhera 27v 11
+ 61146 Kharkiv
+ Ukraine
+
+ Fax: N/A
+
+ E-Mail: trociny at FreeBSD.org"
+ DESCRIPTION
+ "The Begemot MIB for managing HAST."
+ REVISION "201304130000Z"
+ DESCRIPTION
+ "Initial revision."
+ ::= { begemot 220 }
+
+begemotHastObjects OBJECT IDENTIFIER ::= { begemotHast 1 }
+
+-- ---------------------------------------------------------- --
+-- Configuration parameters
+-- ---------------------------------------------------------- --
+
+hastConfig OBJECT IDENTIFIER ::= { begemotHastObjects 1 }
+
+hastConfigFile OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "HAST configuration file location."
+ ::= { hastConfig 1 }
+
+-- ---------------------------------------------------------- --
+-- Resource Table
+-- ---------------------------------------------------------- --
+hastResourceTable OBJECT-TYPE
+ SYNTAX SEQUENCE OF HastResourceEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "A table containing information about all HAST resources."
+ ::= { begemotHastObjects 2 }
+
+hastResourceEntry OBJECT-TYPE
+ SYNTAX HastResourceEntry
+ MAX-ACCESS not-accessible
+ STATUS current
+ DESCRIPTION
+ "Table entry that describes one HAST resource."
+ INDEX { hastResourceIndex }
+ ::= { hastResourceTable 1 }
+
+HastResourceEntry ::= SEQUENCE {
+ hastResourceIndex Integer32,
+ hastResourceName OCTET STRING,
+ hastResourceRole INTEGER,
+ hastResourceProvName OCTET STRING,
+ hastResourceLocalPath OCTET STRING,
+ hastResourceExtentSize Integer32,
+ hastResourceKeepDirty Integer32,
+ hastResourceRemoteAddr OCTET STRING,
+ hastResourceSourceAddr OCTET STRING,
+ hastResourceReplication INTEGER,
+ hastResourceStatus INTEGER,
+ hastResourceDirty Counter64,
+ hastResourceReads Counter64,
+ hastResourceWrites Counter64,
+ hastResourceDeletes Counter64,
+ hastResourceFlushes Counter64,
+ hastResourceActivemapUpdates Counter64,
+ hastResourceReadErrors Counter64,
+ hastResourceWriteErrors Counter64,
+ hastResourceDeleteErrors Counter64,
+ hastResourceFlushErrors Counter64
+}
+
+hastResourceIndex OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Resource index."
+ ::= { hastResourceEntry 1 }
+
+hastResourceName OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Resource name."
+ ::= { hastResourceEntry 2 }
+
+hastResourceRole OBJECT-TYPE
+ SYNTAX INTEGER { undef(0), init(1), primary(2), secondary(3) }
+ MAX-ACCESS read-write
+ STATUS current
+ DESCRIPTION
+ "Resource role."
+ ::= { hastResourceEntry 3 }
+
+hastResourceProvName OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Resource GEOM provider name that appears as /dev/hast/<name>."
+ ::= { hastResourceEntry 4 }
+
+hastResourceLocalPath OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Path to the local component which is used as a backend
+ provider for the resource."
+ ::= { hastResourceEntry 5 }
+
+hastResourceExtentSize OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Size of an extent. Extent is a block which is
+ used for synchronization. hastd(8) maintains a
+ map of dirty extents and extent is the smallest
+ region that can be marked as dirty. If any part
+ of an extent is modified, entire extent will be
+ synchronized when nodes connect."
+ ::= { hastResourceEntry 6 }
+
+hastResourceKeepDirty OBJECT-TYPE
+ SYNTAX Integer32
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Maximum number of dirty extents to keep dirty all
+ the time. Most recently used extents are kept
+ dirty to reduce number of metadata updates."
+ ::= { hastResourceEntry 7 }
+
+hastResourceRemoteAddr OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Address of the remote hastd(8) daemon for the resource."
+ ::= { hastResourceEntry 8 }
+
+hastResourceSourceAddr OBJECT-TYPE
+ SYNTAX OCTET STRING
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Local address the resource is bound to."
+ ::= { hastResourceEntry 9 }
+
+hastResourceReplication OBJECT-TYPE
+ SYNTAX INTEGER { fullsync(0), memsync(1), async(2) }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Resource replication mode."
+ ::= { hastResourceEntry 10 }
+
+hastResourceStatus OBJECT-TYPE
+ SYNTAX INTEGER { complete(0), degraded(1) }
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Resource replication status."
+ ::= { hastResourceEntry 11 }
+
+hastResourceDirty OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Current number of dirty extents for the resource."
+ ::= { hastResourceEntry 12 }
+
+hastResourceReads OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Count of resource local read operations."
+ ::= { hastResourceEntry 13 }
+
+hastResourceWrites OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Count of resource local write operations."
+ ::= { hastResourceEntry 14 }
+
+hastResourceDeletes OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Count of resource local delete operations."
+ ::= { hastResourceEntry 15 }
+
+hastResourceFlushes OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Count of resource local flush operations."
+ ::= { hastResourceEntry 16 }
+
+hastResourceActivemapUpdates OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Count of resource local activemap updates."
+ ::= { hastResourceEntry 17 }
+
+hastResourceReadErrors OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Count of resource local read operations that failed."
+ ::= { hastResourceEntry 18 }
+
+hastResourceWriteErrors OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Count of resource local write operations that failed."
+ ::= { hastResourceEntry 19 }
+
+hastResourceDeleteErrors OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Count of resource local delete operations that failed."
+ ::= { hastResourceEntry 20 }
+
+hastResourceFlushErrors OBJECT-TYPE
+ SYNTAX Counter64
+ MAX-ACCESS read-only
+ STATUS current
+ DESCRIPTION
+ "Count of resource local flush operations that failed."
+ ::= { hastResourceEntry 21 }
+
+END
Property changes on: trunk/usr.sbin/bsnmpd/modules/snmp_hast/BEGEMOT-HAST-MIB.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/usr.sbin/bsnmpd/modules/snmp_hast/Makefile
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_hast/Makefile (rev 0)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_hast/Makefile 2017-03-05 14:28:35 UTC (rev 9433)
@@ -0,0 +1,477 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+.PATH: ${.CURDIR}/../../../../sbin/hastd
+
+MOD= hast
+SRCS= ebuf.c
+SRCS+= hast_compression.c hast_proto.c hast_snmp.c
+SRCS+= lzf.c
+SRCS+= nv.c
+SRCS+= parse.y pjdlog.c
+SRCS+= proto.c proto_common.c proto_uds.c
+SRCS+= token.l
+SRCS+= y.tab.h
+MAN= snmp_hast.8
+
+NO_WFORMAT=
+NO_WCAST_ALIGN=
+NO_WMISSING_VARIABLE_DECLARATIONS=
+CFLAGS+=-I${.CURDIR}/../../../../sbin/hastd
+CFLAGS+=-DHAVE_CAPSICUM
+CFLAGS+=-DINET
+.if ${MK_INET6_SUPPORT} != "no"
+CFLAGS+=-DINET6
+.endif
+# This is needed to have WARNS > 1.
+CFLAGS+=-DYY_NO_UNPUT
+CFLAGS+=-DYY_NO_INPUT
+CFLAGS+= -DSNMPTREE_TYPES
+
+DPADD= ${LIBUTIL}
+LDADD= -lutil
+
+XSYM= begemotHast
+DEFS= ${MOD}_tree.def
+BMIBS= BEGEMOT-HAST-MIB.txt
+
+YFLAGS+=-v
+
+CLEANFILES=y.tab.c y.tab.h y.output
+
+.include <bsd.snmpmod.mk>
+#
+# $MidnightBSD$
+#
+# The user-driven targets are:
+#
+# universe - *Really* build *everything* (buildworld and
+# all kernels on all architectures).
+# tinderbox - Same as universe, but presents a list of failed build
+# targets and exits with an error if there were any.
+# buildworld - Rebuild *everything*, including glue to help do
+# upgrades.
+# installworld - Install everything built by "buildworld".
+# world - buildworld + installworld, no kernel.
+# buildkernel - Rebuild the kernel and the kernel-modules.
+# installkernel - Install the kernel and the kernel-modules.
+# installkernel.debug
+# reinstallkernel - Reinstall the kernel and the kernel-modules.
+# reinstallkernel.debug
+# kernel - buildkernel + installkernel.
+# kernel-toolchain - Builds the subset of world necessary to build a kernel
+# doxygen - Build API documentation of the kernel, needs doxygen.
+# update - Convenient way to update your source tree (cvs).
+# check-old - List obsolete directories/files/libraries.
+# check-old-dirs - List obsolete directories.
+# check-old-files - List obsolete files.
+# check-old-libs - List obsolete libraries.
+# delete-old - Delete obsolete directories/files/libraries.
+# delete-old-dirs - Delete obsolete directories.
+# delete-old-files - Delete obsolete files.
+# delete-old-libs - Delete obsolete libraries.
+# targets - Print a list of supported TARGET/TARGET_ARCH pairs
+# for world and kernel targets.
+# toolchains - Build a toolchain for all world and kernel targets.
+#
+# This makefile is simple by design. The MidnightBSD make automatically reads
+# the /usr/share/mk/sys.mk unless the -m argument is specified on the
+# command line. By keeping this makefile simple, it doesn't matter too
+# much how different the installed mk files are from those in the source
+# tree. This makefile executes a child make process, forcing it to use
+# the mk files from the source tree which are supposed to DTRT.
+#
+# Most of the user-driven targets (as listed above) are implemented in
+# Makefile.inc1. The exceptions are universe, tinderbox and targets.
+#
+# If you want to build your system from source be sure that /usr/obj has
+# at least 1GB of diskspace available. A complete 'universe' build requires
+# about 15GB of space.
+#
+# For individuals wanting to build from the sources currently on their
+# system, the simple instructions are:
+#
+# 1. `cd /usr/src' (or to the directory containing your source tree).
+# 2. Define `HISTORICAL_MAKE_WORLD' variable (see README).
+# 3. `make world'
+#
+# For individuals wanting to upgrade their sources (even if only a
+# delta of a few days):
+#
+# 1. `cd /usr/src' (or to the directory containing your source tree).
+# 2. `make buildworld'
+# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
+# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
+# [steps 3. & 4. can be combined by using the "kernel" target]
+# 5. `reboot' (in single user mode: boot -s from the loader prompt).
+# 6. `mergemaster -p'
+# 7. `make installworld'
+# 8. `make delete-old'
+# 9. `mergemaster' (you may wish to use -i, along with -U or -F)
+# 10. `reboot'
+# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore)
+#
+# See src/UPDATING `COMMON ITEMS' for more complete information.
+#
+# If TARGET=machine (e.g. amd64, ...) is specified you can
+# cross build world for other machine types using the buildworld target,
+# and once the world is built you can cross build a kernel using the
+# buildkernel target.
+#
+# Define the user-driven targets. These are listed here in alphabetical
+# order, but that's not important.
+#
+# Targets that begin with underscore are internal targets intended for
+# developer convenience only. They are intentionally not documented and
+# completely subject to change without notice.
+#
+# For more information, see the build(7) manual page.
+#
+TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
+ check-old check-old-dirs check-old-files check-old-libs \
+ checkdpadd clean cleandepend cleandir \
+ delete-old delete-old-dirs delete-old-files delete-old-libs \
+ depend distribute distributekernel distributekernel.debug \
+ distributeworld distrib-dirs distribution doxygen \
+ everything hierarchy install installcheck installkernel \
+ installkernel.debug packagekernel packageworld \
+ reinstallkernel reinstallkernel.debug \
+ installworld kernel-toolchain libraries lint maninstall \
+ obj objlink regress rerelease showconfig tags toolchain update \
+ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \
+ _build-tools _cross-tools _includes _libraries _depend \
+ build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
+
+TGTS+= ${SUBDIR_TARGETS}
+
+# XXX: clang integrated-as doesn't grok .codeNN directives yet
+CFLAGS.cdboot.S= ${CLANG_NO_IAS}
+CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
+
+BITGTS= files includes
+BITGTS:=${BITGTS} ${BITGTS:S/^/build/} ${BITGTS:S/^/install/}
+TGTS+= ${BITGTS}
+
+.ORDER: buildworld installworld
+.ORDER: buildworld distributeworld
+.ORDER: buildworld buildkernel
+.ORDER: buildkernel installkernel
+.ORDER: buildkernel installkernel.debug
+.ORDER: buildkernel reinstallkernel
+.ORDER: buildkernel reinstallkernel.debug
+
+PATH= /sbin:/bin:/usr/sbin:/usr/bin
+MAKEOBJDIRPREFIX?= /usr/obj
+_MAKEOBJDIRPREFIX!= /usr/bin/env -i PATH=${PATH} ${MAKE} \
+ ${.MAKEFLAGS:MMAKEOBJDIRPREFIX=*} __MAKE_CONF=${__MAKE_CONF} \
+ -f /dev/null -V MAKEOBJDIRPREFIX dummy
+.if !empty(_MAKEOBJDIRPREFIX)
+.error MAKEOBJDIRPREFIX can only be set in environment, not as a global\
+ (in make.conf(5)) or command-line variable.
+.endif
+MAKEPATH= ${MAKEOBJDIRPREFIX}${.CURDIR}/make.${MACHINE}
+BINMAKE= \
+ `if [ -x ${MAKEPATH}/make ]; then echo ${MAKEPATH}/make; else echo ${MAKE}; fi` \
+ -m ${.CURDIR}/share/mk
+_MAKE= PATH=${PATH} ${BINMAKE} -f Makefile.inc1 TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
+
+# Guess machine architecture from machine type, and vice versa.
+.if !defined(TARGET_ARCH) && defined(TARGET)
+_TARGET_ARCH= ${TARGET}
+.elif !defined(TARGET) && defined(TARGET_ARCH) && \
+ ${TARGET_ARCH} != ${MACHINE_ARCH}
+_TARGET= ${TARGET_ARCH}
+.endif
+.if defined(TARGET) && !defined(_TARGET)
+_TARGET=${TARGET}
+.endif
+.if defined(TARGET_ARCH) && !defined(_TARGET_ARCH)
+_TARGET_ARCH=${TARGET_ARCH}
+.endif
+# Otherwise, default to current machine type and architecture.
+_TARGET?= ${MACHINE}
+_TARGET_ARCH?= ${MACHINE_ARCH}
+
+#
+# Make sure we have an up-to-date make(1). Only world and buildworld
+# should do this as those are the initial targets used for upgrades.
+# The user can define ALWAYS_CHECK_MAKE to have this check performed
+# for all targets.
+#
+.if defined(ALWAYS_CHECK_MAKE)
+${TGTS}: upgrade_checks
+.else
+buildworld: upgrade_checks
+.endif
+
+#
+# This 'cleanworld' target is not included in TGTS, because it is not a
+# recursive target. All of the work for it is done right here. It is
+# expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be
+# created by bsd.obj.mk, except that we don't want to .include that file
+# in this makefile.
+#
+# In the following, the first 'rm' in a series will usually remove all
+# files and directories. If it does not, then there are probably some
+# files with chflags set, so this unsets them and tries the 'rm' a
+# second time. There are situations where this target will be cleaning
+# some directories via more than one method, but that duplication is
+# needed to correctly handle all the possible situations.
+#
+BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
+cleanworld:
+.if ${.CURDIR} == ${.OBJDIR} || ${.CURDIR}/obj == ${.OBJDIR}
+.if exists(${BW_CANONICALOBJDIR}/)
+ -rm -rf ${BW_CANONICALOBJDIR}/*
+ -chflags -R 0 ${BW_CANONICALOBJDIR}
+ rm -rf ${BW_CANONICALOBJDIR}/*
+.endif
+ # To be safe in this case, fall back to a 'make cleandir'
+ ${_+_}@cd ${.CURDIR}; ${_MAKE} cleandir
+.else
+ -rm -rf ${.OBJDIR}/*
+ -chflags -R 0 ${.OBJDIR}
+ rm -rf ${.OBJDIR}/*
+.endif
+
+#
+# Handle the user-driven targets, using the source relative mk files.
+#
+
+${TGTS}:
+ ${_+_}@cd ${.CURDIR}; ${_MAKE} ${.TARGET}
+
+# The historic default "all" target creates files which may cause stale
+# or (in the cross build case) unlinkable results. Fail with an error
+# when no target is given. The users can explicitly specify "all"
+# if they want the historic behavior.
+.MAIN: _guard
+
+_guard:
+ @echo
+ @echo "Explicit target required (use \"all\" for historic behavior)"
+ @echo
+ @false
+
+STARTTIME!= LC_ALL=C date
+CHECK_TIME!= find ${.CURDIR}/sys/sys/param.h -mtime -0s ; echo
+.if !empty(CHECK_TIME)
+.error check your date/time: ${STARTTIME}
+.endif
+
+.if defined(HISTORICAL_MAKE_WORLD) || defined(DESTDIR)
+#
+# world
+#
+# Attempt to rebuild and reinstall everything. This target is not to be
+# used for upgrading an existing MidnightBSD system, because the kernel is
+# not included. One can argue that this target doesn't build everything
+# then.
+#
+world: upgrade_checks
+ @echo "--------------------------------------------------------------"
+ @echo ">>> make world started on ${STARTTIME}"
+ @echo "--------------------------------------------------------------"
+.if target(pre-world)
+ @echo
+ @echo "--------------------------------------------------------------"
+ @echo ">>> Making 'pre-world' target"
+ @echo "--------------------------------------------------------------"
+ ${_+_}@cd ${.CURDIR}; ${_MAKE} pre-world
+.endif
+ ${_+_}@cd ${.CURDIR}; ${_MAKE} buildworld
+ ${_+_}@cd ${.CURDIR}; ${_MAKE} -B installworld
+.if target(post-world)
+ @echo
+ @echo "--------------------------------------------------------------"
+ @echo ">>> Making 'post-world' target"
+ @echo "--------------------------------------------------------------"
+ ${_+_}@cd ${.CURDIR}; ${_MAKE} post-world
+.endif
+ @echo
+ @echo "--------------------------------------------------------------"
+ @echo ">>> make world completed on `LC_ALL=C date`"
+ @echo " (started ${STARTTIME})"
+ @echo "--------------------------------------------------------------"
+.else
+world:
+ @echo "WARNING: make world will overwrite your existing MidnightBSD"
+ @echo "installation without also building and installing a new"
+ @echo "kernel. This can be dangerous. Please read the handbook,"
+ @echo "'Rebuilding world', for how to upgrade your system."
+ @echo "Define DESTDIR to where you want to install MidnightBSD,"
+ @echo "including /, to override this warning and proceed as usual."
+ @echo ""
+ @echo "Bailing out now..."
+ @false
+.endif
+
+#
+# kernel
+#
+# Short hand for `make buildkernel installkernel'
+#
+kernel: buildkernel installkernel
+
+#
+# Perform a few tests to determine if the installed tools are adequate
+# for building the world.
+#
+upgrade_checks:
+.if !defined(.PARSEDIR)
+ @if ! (cd ${.CURDIR}/tools/build/make_check && \
+ PATH=${PATH} ${BINMAKE} obj >/dev/null 2>&1 && \
+ PATH=${PATH} ${BINMAKE} >/dev/null 2>&1); \
+ then \
+ (cd ${.CURDIR} && ${MAKE} make); \
+ fi
+.endif
+
+#
+# Upgrade make(1) to the current version using the installed
+# headers, libraries and tools. Also, allow the location of
+# the system bsdmake-like utility to be overridden.
+#
+MMAKEENV= MAKEOBJDIRPREFIX=${MAKEPATH} \
+ DESTDIR= \
+ INSTALL="sh ${.CURDIR}/tools/install.sh"
+MMAKE= ${MMAKEENV} ${MAKE} \
+ -D_UPGRADING \
+ -DNOMAN -DNO_MAN -DNOSHARED -DNO_SHARED \
+ -DNO_CPU_CFLAGS -DNO_WERROR
+
+make: .PHONY
+ @echo
+ @echo "--------------------------------------------------------------"
+ @echo ">>> Building an up-to-date make(1)"
+ @echo "--------------------------------------------------------------"
+ ${_+_}@cd ${.CURDIR}/usr.bin/make; \
+ ${MMAKE} obj && \
+ ${MMAKE} depend && \
+ ${MMAKE} all && \
+ ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR=
+
+tinderbox:
+ @cd ${.CURDIR} && ${MAKE} DOING_TINDERBOX=YES universe
+
+toolchains:
+ @cd ${.CURDIR} && ${MAKE} UNIVERSE_TARGET=toolchain universe
+
+#
+# universe
+#
+# Attempt to rebuild *everything* for all supported architectures,
+# with a reasonable chance of success, regardless of how old your
+# existing system is.
+#
+.if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets)
+TARGETS?=amd64 i386
+.for target in ${TARGETS}
+TARGET_ARCHES_${target}?= ${target}
+.endfor
+
+.if defined(UNIVERSE_TARGET)
+MAKE_JUST_WORLDS= YES
+.else
+UNIVERSE_TARGET?= buildworld
+.endif
+KERNSRCDIR?= ${.CURDIR}/sys
+
+targets:
+ @echo "Supported TARGET/TARGET_ARCH pairs for world and kernel targets"
+.for target in ${TARGETS}
+.for target_arch in ${TARGET_ARCHES_${target}}
+ @echo " ${target}/${target_arch}"
+.endfor
+.endfor
+
+.if defined(DOING_TINDERBOX)
+FAILFILE=${.CURDIR}/_.tinderbox.failed
+MAKEFAIL=tee -a ${FAILFILE}
+.else
+MAKEFAIL=cat
+.endif
+
+universe: universe_prologue upgrade_checks
+universe_prologue:
+ @echo "--------------------------------------------------------------"
+ @echo ">>> make universe started on ${STARTTIME}"
+ @echo "--------------------------------------------------------------"
+.if defined(DOING_TINDERBOX)
+ @rm -f ${FAILFILE}
+.endif
+.for target in ${TARGETS}
+universe: universe_${target}
+.ORDER: universe_prologue upgrade_checks universe_${target}_prologue universe_${target} universe_epilogue
+universe_${target}: universe_${target}_prologue
+universe_${target}_prologue:
+ @echo ">> ${target} started on `LC_ALL=C date`"
+.if !defined(MAKE_JUST_KERNELS)
+.for target_arch in ${TARGET_ARCHES_${target}}
+universe_${target}: universe_${target}_${target_arch}
+universe_${target}_${target_arch}: universe_${target}_prologue
+ @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} started on `LC_ALL=C date`"
+ @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
+ ${MAKE} ${JFLAG} ${UNIVERSE_TARGET} \
+ TARGET=${target} \
+ TARGET_ARCH=${target_arch} \
+ > _.${target}.${target_arch}.${UNIVERSE_TARGET} 2>&1 || \
+ (echo "${target}.${target_arch} ${UNIVERSE_TARGET} failed," \
+ "check _.${target}.${target_arch}.${UNIVERSE_TARGET} for details" | \
+ ${MAKEFAIL}))
+ @echo ">> ${target}.${target_arch} ${UNIVERSE_TARGET} completed on `LC_ALL=C date`"
+.endfor
+.endif
+.if !defined(MAKE_JUST_WORLDS)
+.if exists(${KERNSRCDIR}/${target}/conf/NOTES)
+ @(cd ${KERNSRCDIR}/${target}/conf && env __MAKE_CONF=/dev/null \
+ ${MAKE} LINT > ${.CURDIR}/_.${target}.makeLINT 2>&1 || \
+ (echo "${target} 'make LINT' failed," \
+ "check _.${target}.makeLINT for details"| ${MAKEFAIL}))
+.endif
+ @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} TARGET=${target} \
+ universe_kernels
+.endif
+ @echo ">> ${target} completed on `LC_ALL=C date`"
+.endfor
+universe_kernels: universe_kernconfs
+.if !defined(TARGET)
+TARGET!= uname -m
+.endif
+KERNCONFS!= cd ${KERNSRCDIR}/${TARGET}/conf && \
+ find [A-Z0-9]*[A-Z0-9] -type f -maxdepth 0 \
+ ! -name DEFAULTS ! -name NOTES
+universe_kernconfs:
+.for kernel in ${KERNCONFS}
+TARGET_ARCH_${kernel}!= cd ${KERNSRCDIR}/${TARGET}/conf && \
+ config -m ${KERNSRCDIR}/${TARGET}/conf/${kernel} 2> /dev/null | \
+ grep -v WARNING: | cut -f 2
+.if empty(TARGET_ARCH_${kernel})
+.error "Target architecture for ${TARGET}/conf/${kernel} unknown. config(8) likely too old."
+.endif
+universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
+universe_kernconf_${TARGET}_${kernel}:
+ @(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
+ ${MAKE} ${JFLAG} buildkernel \
+ TARGET=${TARGET} \
+ TARGET_ARCH=${TARGET_ARCH_${kernel}} \
+ KERNCONF=${kernel} \
+ > _.${TARGET}.${kernel} 2>&1 || \
+ (echo "${TARGET} ${kernel} kernel failed," \
+ "check _.${TARGET}.${kernel} for details"| ${MAKEFAIL}))
+.endfor
+universe: universe_epilogue
+universe_epilogue:
+ @echo "--------------------------------------------------------------"
+ @echo ">>> make universe completed on `LC_ALL=C date`"
+ @echo " (started ${STARTTIME})"
+ @echo "--------------------------------------------------------------"
+.if defined(DOING_TINDERBOX)
+ @if [ -e ${FAILFILE} ] ; then \
+ echo "Tinderbox failed:" ;\
+ cat ${FAILFILE} ;\
+ exit 1 ;\
+ fi
+.endif
+.endif
Property changes on: trunk/usr.sbin/bsnmpd/modules/snmp_hast/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c (rev 0)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c 2017-03-05 14:28:35 UTC (rev 9433)
@@ -0,0 +1,506 @@
+/*-
+ * Copyright (c) 2013 Mikolaj Golub <trociny at FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/queue.h>
+
+#include <bsnmp/snmpmod.h>
+
+#include <string.h>
+
+#include "hast.h"
+#include "hast_oid.h"
+#include "hast_proto.h"
+#include "hast_tree.h"
+#include "nv.h"
+#include "pjdlog.h"
+#include "proto.h"
+
+#define UPDATE_INTERVAL 500 /* update interval in ticks */
+
+static struct lmodule *module;
+
+static const struct asn_oid oid_hast = OIDX_begemotHast;
+
+/* the Object Resource registration index */
+static u_int hast_index = 0;
+
+/*
+ * Structure that describes single resource.
+ */
+struct hast_snmp_resource {
+ TAILQ_ENTRY(hast_snmp_resource) link;
+ int32_t index;
+ char name[NAME_MAX];
+ int error;
+ int role;
+ char provname[NAME_MAX];
+ char localpath[PATH_MAX];
+ int32_t extentsize;
+ int32_t keepdirty;
+ char remoteaddr[HAST_ADDRSIZE];
+ char sourceaddr[HAST_ADDRSIZE];
+ int replication;
+ int status;
+ uint64_t dirty;
+ uint64_t reads;
+ uint64_t writes;
+ uint64_t deletes;
+ uint64_t flushes;
+ uint64_t activemap_updates;
+ uint64_t read_errors;
+ uint64_t write_errors;
+ uint64_t delete_errors;
+ uint64_t flush_errors;
+};
+
+static TAILQ_HEAD(, hast_snmp_resource) resources =
+ TAILQ_HEAD_INITIALIZER(resources);
+
+/* Path to configuration file. */
+static u_char *cfgpath;
+/* Ticks of the last hast resources update. */
+static uint64_t last_resources_update;
+
+static void free_resources(void);
+static int hastctl(struct nv *nvin, struct nv **nvout);
+static int hast_fini(void);
+static int hast_init(struct lmodule *mod, int argc, char *argv[]);
+static void hast_start(void);
+static int set_role(const char *resource, int role);
+static int str2role(const char *str);
+static int str2replication(const char *str);
+static int str2status(const char *str);
+static int update_resources(void);
+
+const struct snmp_module config = {
+ .comment = "This module implements the BEGEMOT MIB for HAST.",
+ .init = hast_init,
+ .start = hast_start,
+ .fini = hast_fini,
+ .tree = hast_ctree,
+ .tree_size = hast_CTREE_SIZE,
+};
+
+static int
+hast_init(struct lmodule *mod, int argc __unused, char *argv[] __unused)
+{
+
+ module = mod;
+
+ pjdlog_init(PJDLOG_MODE_SYSLOG);
+ pjdlog_debug_set(0);
+
+ cfgpath = malloc(sizeof(HAST_CONFIG));
+ if (cfgpath == NULL) {
+ pjdlog_error("Unable to allocate %zu bytes for cfgpath",
+ sizeof(HAST_CONFIG));
+ return (-1);
+ }
+ strcpy(cfgpath, HAST_CONFIG);
+ return(0);
+}
+
+static void
+hast_start(void)
+{
+ hast_index = or_register(&oid_hast,
+ "The MIB module for BEGEMOT-HAST-MIB.", module);
+}
+
+static int
+hast_fini(void)
+{
+
+ or_unregister(hast_index);
+ free_resources();
+ free(cfgpath);
+ return (0);
+}
+
+static void
+free_resources(void)
+{
+ struct hast_snmp_resource *res;
+
+ while ((res = TAILQ_FIRST(&resources)) != NULL) {
+ TAILQ_REMOVE(&resources, res, link);
+ free(res);
+ }
+}
+
+static int
+str2role(const char *str)
+{
+
+ if (strcmp(str, "init") == 0)
+ return (HAST_ROLE_INIT);
+ if (strcmp(str, "primary") == 0)
+ return (HAST_ROLE_PRIMARY);
+ if (strcmp(str, "secondary") == 0)
+ return (HAST_ROLE_SECONDARY);
+ return (HAST_ROLE_UNDEF);
+}
+
+static int
+str2replication(const char *str)
+{
+
+ if (strcmp(str, "fullsync") == 0)
+ return (HAST_REPLICATION_FULLSYNC);
+ if (strcmp(str, "memsync") == 0)
+ return (HAST_REPLICATION_MEMSYNC);
+ if (strcmp(str, "async") == 0)
+ return (HAST_REPLICATION_ASYNC);
+ return (-1);
+}
+
+static int
+str2status(const char *str)
+{
+
+ if (strcmp(str, "complete") == 0)
+ return (0);
+ if (strcmp(str, "degraded") == 0)
+ return (1);
+ return (-1);
+}
+
+static int
+hastctl(struct nv *nvin, struct nv **nvout)
+{
+ struct hastd_config *cfg;
+ struct proto_conn *conn;
+ struct nv *nv;
+ int error;
+
+ cfg = yy_config_parse(cfgpath, true);
+ if (cfg == NULL)
+ return (-1);
+
+ /* Setup control connection... */
+ if (proto_client(NULL, cfg->hc_controladdr, &conn) == -1) {
+ pjdlog_error("Unable to setup control connection to %s",
+ cfg->hc_controladdr);
+ return (-1);
+ }
+ /* ...and connect to hastd. */
+ if (proto_connect(conn, HAST_TIMEOUT) == -1) {
+ pjdlog_error("Unable to connect to hastd via %s",
+ cfg->hc_controladdr);
+ proto_close(conn);
+ return (-1);
+ }
+ /* Send the command to the server... */
+ if (hast_proto_send(NULL, conn, nvin, NULL, 0) == -1) {
+ pjdlog_error("Unable to send command to hastd via %s",
+ cfg->hc_controladdr);
+ proto_close(conn);
+ return (-1);
+ }
+ /* ...and receive reply. */
+ if (hast_proto_recv_hdr(conn, &nv) == -1) {
+ pjdlog_error("cannot receive reply from hastd via %s",
+ cfg->hc_controladdr);
+ proto_close(conn);
+ return (-1);
+ }
+ proto_close(conn);
+ error = nv_get_int16(nv, "error");
+ if (error != 0) {
+ pjdlog_error("Error %d received from hastd.", error);
+ nv_free(nv);
+ return (-1);
+ }
+ nv_set_error(nv, 0);
+ *nvout = nv;
+ return (0);
+}
+
+static int
+set_role(const char *resource, int role)
+{
+ struct nv *nvin, *nvout;
+ int error;
+
+ nvin = nv_alloc();
+ nv_add_string(nvin, resource, "resource%d", 0);
+ nv_add_uint8(nvin, HASTCTL_CMD_SETROLE, "cmd");
+ nv_add_uint8(nvin, role, "role");
+ error = hastctl(nvin, &nvout);
+ nv_free(nvin);
+ if (error != 0)
+ return (-1);
+ nv_free(nvout);
+ return (SNMP_ERR_NOERROR);
+}
+
+static int
+update_resources(void)
+{
+ struct hast_snmp_resource *res;
+ struct nv *nvin, *nvout;
+ static uint64_t now;
+ unsigned int i;
+ const char *str;
+ int error;
+
+ now = get_ticks();
+ if (now - last_resources_update < UPDATE_INTERVAL)
+ return (0);
+
+ last_resources_update = now;
+
+ free_resources();
+
+ nvin = nv_alloc();
+ nv_add_uint8(nvin, HASTCTL_CMD_STATUS, "cmd");
+ nv_add_string(nvin, "all", "resource%d", 0);
+ error = hastctl(nvin, &nvout);
+ nv_free(nvin);
+ if (error != 0)
+ return (-1);
+
+ for (i = 0; ; i++) {
+ str = nv_get_string(nvout, "resource%u", i);
+ if (str == NULL)
+ break;
+ res = calloc(1, sizeof(*res));
+ if (res == NULL) {
+ pjdlog_error("Unable to allocate %zu bytes for "
+ "resource", sizeof(*res));
+ return (-1);
+ }
+ res->index = i + 1;
+ strncpy(res->name, str, sizeof(res->name) - 1);
+ error = nv_get_int16(nvout, "error%u", i);
+ if (error != 0)
+ continue;
+ str = nv_get_string(nvout, "role%u", i);
+ res->role = str != NULL ? str2role(str) : HAST_ROLE_UNDEF;
+ str = nv_get_string(nvout, "provname%u", i);
+ if (str != NULL)
+ strncpy(res->provname, str, sizeof(res->provname) - 1);
+ str = nv_get_string(nvout, "localpath%u", i);
+ if (str != NULL) {
+ strncpy(res->localpath, str,
+ sizeof(res->localpath) - 1);
+ }
+ res->extentsize = nv_get_uint32(nvout, "extentsize%u", i);
+ res->keepdirty = nv_get_uint32(nvout, "keepdirty%u", i);
+ str = nv_get_string(nvout, "remoteaddr%u", i);
+ if (str != NULL) {
+ strncpy(res->remoteaddr, str,
+ sizeof(res->remoteaddr) - 1);
+ }
+ str = nv_get_string(nvout, "sourceaddr%u", i);
+ if (str != NULL) {
+ strncpy(res->sourceaddr, str,
+ sizeof(res->sourceaddr) - 1);
+ }
+ str = nv_get_string(nvout, "replication%u", i);
+ res->replication = str != NULL ? str2replication(str) : -1;
+ str = nv_get_string(nvout, "status%u", i);
+ res->status = str != NULL ? str2status(str) : -1;
+ res->dirty = nv_get_uint64(nvout, "dirty%u", i);
+ res->reads = nv_get_uint64(nvout, "stat_read%u", i);
+ res->writes = nv_get_uint64(nvout, "stat_write%u", i);
+ res->deletes = nv_get_uint64(nvout, "stat_delete%u", i);
+ res->flushes = nv_get_uint64(nvout, "stat_flush%u", i);
+ res->activemap_updates =
+ nv_get_uint64(nvout, "stat_activemap_update%u", i);
+ res->read_errors =
+ nv_get_uint64(nvout, "stat_read_error%u", i);
+ res->write_errors =
+ nv_get_uint64(nvout, "stat_write_error%u", i);
+ res->delete_errors =
+ nv_get_uint64(nvout, "stat_delete_error%u", i);
+ res->flush_errors =
+ nv_get_uint64(nvout, "stat_flush_error%u", i);
+ TAILQ_INSERT_TAIL(&resources, res, link);
+ }
+ nv_free(nvout);
+ return (0);
+}
+
+int
+op_hastConfig(struct snmp_context *context, struct snmp_value *value,
+ u_int sub, u_int iidx __unused, enum snmp_op op)
+{
+ asn_subid_t which;
+
+ which = value->var.subs[sub - 1];
+
+ switch (op) {
+ case SNMP_OP_GET:
+ switch (which) {
+ case LEAF_hastConfigFile:
+ return (string_get(value, cfgpath, -1));
+ default:
+ return (SNMP_ERR_RES_UNAVAIL);
+ }
+ case SNMP_OP_SET:
+ switch (which) {
+ case LEAF_hastConfigFile:
+ return (string_save(value, context, -1,
+ (u_char **)&cfgpath));
+ default:
+ return (SNMP_ERR_RES_UNAVAIL);
+ }
+ case SNMP_OP_GETNEXT:
+ case SNMP_OP_ROLLBACK:
+ case SNMP_OP_COMMIT:
+ return (SNMP_ERR_NOERROR);
+ default:
+ return (SNMP_ERR_RES_UNAVAIL);
+ }
+}
+
+int
+op_hastResourceTable(struct snmp_context *context __unused,
+ struct snmp_value *value, u_int sub, u_int iidx __unused, enum snmp_op op)
+{
+ struct hast_snmp_resource *res;
+ asn_subid_t which;
+ int ret;
+
+ if (update_resources() == -1)
+ return (SNMP_ERR_RES_UNAVAIL);
+
+ which = value->var.subs[sub - 1];
+
+ switch (op) {
+ case SNMP_OP_GETNEXT:
+ res = NEXT_OBJECT_INT(&resources, &value->var, sub);
+ if (res == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ value->var.len = sub + 1;
+ value->var.subs[sub] = res->index;
+ break;
+ case SNMP_OP_GET:
+ if (value->var.len - sub != 1)
+ return (SNMP_ERR_NOSUCHNAME);
+ res = FIND_OBJECT_INT(&resources, &value->var, sub);
+ if (res == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ break;
+ case SNMP_OP_SET:
+ res = FIND_OBJECT_INT(&resources, &value->var, sub);
+ if (res == NULL)
+ return (SNMP_ERR_NOSUCHNAME);
+ switch (which) {
+ case LEAF_hastResourceRole:
+ ret = set_role(res->name, value->v.integer);
+ /* force update on next run */
+ last_resources_update = 0;
+ break;
+ default:
+ ret = SNMP_ERR_NOT_WRITEABLE;
+ break;
+ }
+ return ret;
+ case SNMP_OP_ROLLBACK:
+ case SNMP_OP_COMMIT:
+ return (SNMP_ERR_NOERROR);
+ default:
+ return (SNMP_ERR_RES_UNAVAIL);
+ }
+
+ ret = SNMP_ERR_NOERROR;
+
+ switch (which) {
+ case LEAF_hastResourceIndex:
+ value->v.integer = res->index;
+ break;
+ case LEAF_hastResourceName:
+ ret = string_get(value, res->name, -1);
+ break;
+ case LEAF_hastResourceRole:
+ value->v.integer = res->role;
+ break;
+ case LEAF_hastResourceProvName:
+ ret = string_get(value, res->provname, -1);
+ break;
+ case LEAF_hastResourceLocalPath:
+ ret = string_get(value, res->localpath, -1);
+ break;
+ case LEAF_hastResourceExtentSize:
+ value->v.integer = res->extentsize;
+ break;
+ case LEAF_hastResourceKeepDirty:
+ value->v.integer = res->keepdirty;
+ break;
+ case LEAF_hastResourceRemoteAddr:
+ ret = string_get(value, res->remoteaddr, -1);
+ break;
+ case LEAF_hastResourceSourceAddr:
+ ret = string_get(value, res->sourceaddr, -1);
+ break;
+ case LEAF_hastResourceReplication:
+ value->v.integer = res->replication;
+ break;
+ case LEAF_hastResourceStatus:
+ value->v.integer = res->status;
+ break;
+ case LEAF_hastResourceDirty:
+ value->v.counter64 = res->dirty;
+ break;
+ case LEAF_hastResourceReads:
+ value->v.counter64 = res->reads;
+ break;
+ case LEAF_hastResourceWrites:
+ value->v.counter64 = res->writes;
+ break;
+ case LEAF_hastResourceDeletes:
+ value->v.counter64 = res->deletes;
+ break;
+ case LEAF_hastResourceFlushes:
+ value->v.counter64 = res->flushes;
+ break;
+ case LEAF_hastResourceActivemapUpdates:
+ value->v.counter64 = res->activemap_updates;
+ break;
+ case LEAF_hastResourceReadErrors:
+ value->v.counter64 = res->read_errors;
+ break;
+ case LEAF_hastResourceWriteErrors:
+ value->v.counter64 = res->write_errors;
+ break;
+ case LEAF_hastResourceDeleteErrors:
+ value->v.counter64 = res->delete_errors;
+ break;
+ case LEAF_hastResourceFlushErrors:
+ value->v.counter64 = res->flush_errors;
+ break;
+ default:
+ ret = SNMP_ERR_RES_UNAVAIL;
+ break;
+ }
+ return (ret);
+}
Property changes on: trunk/usr.sbin/bsnmpd/modules/snmp_hast/hast_snmp.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def (rev 0)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_hast/hast_tree.def 2017-03-05 14:28:35 UTC (rev 9433)
@@ -0,0 +1,70 @@
+#-
+# Copyright (c) 2013 Mikolaj Golub <trociny at FreeBSD.org>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+(1 internet
+ (4 private
+ (1 enterprises
+ (12325 fokus
+ (1 begemot
+ (220 begemotHast
+ (1 begemotHastObjects
+ (1 hastConfig
+ (1 hastConfigFile OCTETSTRING op_hastConfig GET)
+ )
+ (2 hastResourceTable
+ (1 hastResourceEntry : OCTETSTRING op_hastResourceTable
+ (1 hastResourceIndex INTEGER32 GET)
+ (2 hastResourceName OCTETSTRING GET)
+ (3 hastResourceRole INTEGER GET SET)
+ (4 hastResourceProvName OCTETSTRING GET)
+ (5 hastResourceLocalPath OCTETSTRING GET)
+ (6 hastResourceExtentSize INTEGER32 GET)
+ (7 hastResourceKeepDirty INTEGER32 GET)
+ (8 hastResourceRemoteAddr OCTETSTRING GET)
+ (9 hastResourceSourceAddr OCTETSTRING GET)
+ (10 hastResourceReplication INTEGER GET)
+ (11 hastResourceStatus INTEGER GET)
+ (12 hastResourceDirty COUNTER64 GET)
+ (13 hastResourceReads COUNTER64 GET)
+ (14 hastResourceWrites COUNTER64 GET)
+ (15 hastResourceDeletes COUNTER64 GET)
+ (16 hastResourceFlushes COUNTER64 GET)
+ (17 hastResourceActivemapUpdates COUNTER64 GET)
+ (18 hastResourceReadErrors COUNTER64 GET)
+ (19 hastResourceWriteErrors COUNTER64 GET)
+ (20 hastResourceDeleteErrors COUNTER64 GET)
+ (21 hastResourceFlushErrors COUNTER64 GET)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
Added: trunk/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.8
===================================================================
--- trunk/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.8 (rev 0)
+++ trunk/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.8 2017-03-05 14:28:35 UTC (rev 9433)
@@ -0,0 +1,69 @@
+.\"-
+.\" Copyright (c) 2013 Mikolaj Golub <trociny at FreeBSD.org>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd May 1, 2013
+.Dt SNMP_HAST 8
+.Os
+.Sh NAME
+.Nm snmp_hast
+.Nd "HAST module for"
+.Xr bsnmpd 1
+.Sh LIBRARY
+.Pq begemotSnmpdModulePath."hast" = "/usr/lib/snmp_hast.so"
+.Sh DESCRIPTION
+The
+.Nm snmp_hast
+module implements a private BEGEMOT-HAST-MIB, which allows
+management of HAST resources.
+.Pp
+The module uses
+.Xr hastd 8
+control socket to communicate with the daemon.
+.Va hastConfigFile
+variable can be used to specify the location of
+.Xr hast.conf 5
+file to find the address of the control connection.
+.Sh FILES
+.Bl -tag -width "XXXXXXXXX"
+.It Pa /usr/share/snmp/defs/hast_tree.def
+The description of the MIB tree implemented by
+.Nm .
+.It Pa /usr/share/snmp/mibs/BEGEMOT-HAST-MIB.txt
+The private BEGEMOT-HAST-MIB that is implemented by this module.
+.It Pa /etc/hast.conf
+The default
+.Xr hastd 8
+configuration file.
+.El
+.Sh SEE ALSO
+.Xr bsnmpd 1 ,
+.Xr gensnmptree 1 ,
+.Xr hastctl 8 ,
+.Xr hastd 8 ,
+.Xr snmpmod 3
+.Sh AUTHORS
+.An Mikolaj Golub Aq trociny at FreeBSD.org
Property changes on: trunk/usr.sbin/bsnmpd/modules/snmp_hast/snmp_hast.8
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
More information about the Midnightbsd-cvs
mailing list