Initial commit

This commit is contained in:
Bjango
2016-10-23 14:47:30 +11:00
commit a2d5d03629
65 changed files with 13642 additions and 0 deletions

97
resource/Makefile.am Normal file
View File

@@ -0,0 +1,97 @@
dist_man_MANS = istatserver.1 istatserver.conf.5
EXTRA_DIST = istatserver.conf istatserver_generated.conf
#dist_sysconf_DATA = istatserver.conf
MKDIR=/bin/mkdir
MV=/bin/mv
ADDUSER=/usr/sbin/useradd
ADDGROUP=/usr/sbin/groupadd
ADDUSERPW=/usr/sbin/pw
MKGROUP=/usr/bin/mkgroup
OLD_CONFIG_FILE = $(sysconfdir)/istat.conf
DEFAULT_CONFIG_FILE = $(sysconfdir)/istatserver/istatserver.conf
DEFAULT_CONFIG_FILE_MV = $(sysconfdir)/istatserver/istatserver.conf.old
DEFAULT_CONFIG_GENERATED_FILE = $(sysconfdir)/istatserver/istatserver_generated.conf
CERT_FILE = $(sysconfdir)/istatserver/cert.pem
KEY_FILE = $(sysconfdir)/istatserver/key.pem
CACHE_FILE = $(sysconfdir)/istatserver/clients.dat
install-exec-hook:
@if test -f "$(ADDUSERPW)" ; then \
$(ADDUSERPW) groupadd istat || true ; \
$(ADDUSERPW) useradd istat -g istat || true ; \
fi
@if test -f "$(ADDGROUP)" ; then \
$(ADDGROUP) istat || true ; \
fi
@if test -f "$(MKGROUP)" ; then \
$(MKGROUP) istat || true ; \
fi
@if test -f "$(ADDUSER)" ; then \
$(ADDUSER) --system -g istat istat || true ; \
$(ADDUSER) -g istat istat || true ; \
fi
$(MKDIR) -p "$(DESTDIR)$(sysconfdir)";
$(MKDIR) -p "$(DESTDIR)$(sysconfdir)/istatserver/"
$(MKDIR) -p "/var/run/istatserver" || true ;
chown istat:istat "/var/run/istatserver" || true ;
chown istat:istat "$(DESTDIR)$(sysconfdir)/istatserver/" || true ;
chmod 755 "$(DESTDIR)$(sysconfdir)/istatserver/" || true ;
@if test -f "$(DESTDIR)$(OLD_CONFIG_FILE)" ; then \
$(MV) "$(DESTDIR)$(OLD_CONFIG_FILE)" "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; \
fi
@if test -f "/var/cache/istat/clients.dat" ; then \
$(MV) "/var/cache/istat/clients.dat" "$(DESTDIR)$(sysconfdir)/istatserver/clients.dat" ; \
chown istat:istat "$(DESTDIR)$(sysconfdir)/istatserver/clients.dat" || true ; \
fi
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \
$(MV) "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" "$(DESTDIR)$(DEFAULT_CONFIG_FILE_MV)" ; \
$(INSTALL_DATA) "$(srcdir)/istatserver.conf" "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
echo "$@ running conf updater"; \
../conf/istatserverconf || true ; \
rm "$(DESTDIR)$(DEFAULT_CONFIG_FILE_MV)" || true ; \
chown istat:istat "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" || true ; \
else \
echo "$(INSTALL_DATA) istatserver.conf $(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
$(INSTALL_DATA) "$(srcdir)/istatserver.conf" "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
echo "$@ running conf updater and generating passcode"; \
../conf/istatserverconf -p || true ; \
chown istat:istat "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" || true ; \
fi
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_GENERATED_FILE)" ; then \
echo "$@ will not overwrite existing $(DESTDIR)$(DEFAULT_CONFIG_GENERATED_FILE)" ; \
else \
echo "$(INSTALL_DATA) istatserver_generated.conf $(DESTDIR)$(DEFAULT_CONFIG_GENERATED_FILE)"; \
$(INSTALL_DATA) "$(srcdir)/istatserver_generated.conf" "$(DESTDIR)$(DEFAULT_CONFIG_GENERATED_FILE)"; \
fi
uninstall-hook:
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_GENERATED_FILE)" ; then \
rm "$(DESTDIR)$(DEFAULT_CONFIG_GENERATED_FILE)"; \
fi
@if test -f "$(DESTDIR)$(DEFAULT_CONFIG_FILE)" ; then \
rm "$(DESTDIR)$(DEFAULT_CONFIG_FILE)"; \
fi
@if test -f "$(DESTDIR)$(CERT_FILE)" ; then \
rm "$(DESTDIR)$(CERT_FILE)"; \
fi
@if test -f "$(DESTDIR)$(KEY_FILE)" ; then \
rm "$(DESTDIR)$(KEY_FILE)"; \
fi
@if test -f "$(DESTDIR)$(CACHE_FILE)" ; then \
rm "$(DESTDIR)$(CACHE_FILE)"; \
fi

50
resource/istatserver.1 Normal file
View File

@@ -0,0 +1,50 @@
.Dd 2009-05-17
.Dt istatd 1
.Os
.Sh NAME
.Nm istatd
.Nd serving statistics to your istat iphone application
.Sh SYNOPSIS
.Nm
.Op Fl c Ar config
.Op Fl a Ar address
.Op Fl p Ar port
.Op Fl d
.Sh DESCRIPTION
.Nm
is a server daemon for serving statistics to your istat iphone application.
.Nm
collects data such as cpu, mem, network and disk usage and keeps the history.
once connecting from the iphone and entering the lock code this data will be
sent to the iphone and shown in fancy graphs.
.Sh OPTIONS
.Bl -tag -width -indent-three
.It Fl v
Print version number
.It Fl d
Run in the process in background
.It Fl c Ar config
Use a custom config file search path
.It Fl a Ar address
Listen for network connections on this address
.It Fl p Ar port
Listen for network connections on this port
.It Fl u Ar user
User to run daemon as
.It Fl g Ar group
Group to run daemon as
.It Fl -pid Ar path
Custom pid file location
.It Fl -clear-sessions
Clear all saved authorized sessions.
.El
.Pp
.Sh FILES
/etc/istat.conf
.Pp
Configuration for network settings, lock code, running user, devices to monitor and more.
.El
.Sh SEE ALSO
.Xr istat.conf 5

28
resource/istatserver.conf Normal file
View File

@@ -0,0 +1,28 @@
#
# istatserver.conf: Configuration for istatserver
#
# server_code is a 5 digit number by default but it can be anything you like including text
server_code 12345
# network_addr 127.0.0.1
# network_port 5109
# server_user istat
# server_group istat
# server_socket /tmp/istatserver.sock
# server_pid /var/run/istatserver/istatserver.pid
# Set to 1 if you want to disable sqlite history storage.
disable_history_storage 0
# Set to 1 if you want to disable disk filtering based on mount path.
disk_disable_filtering 0
# Set to 1 if you want to use mount path as label instead of the device name.
disk_mount_path_label 1
# Set custom disk label. Will override all other labels.
# disk_rename_label /dev/sda1 "root"
# disk_rename_label /home "home"
# End of file

View File

@@ -0,0 +1,43 @@
.Dd 2009-05-17
.Dt istat.conf 5
.Os
.Sh NAME
.Nm istat.conf
.Nd configuration file for istatd
.Sh OPTIONS
.Bl -tag -width -indent-three
.It network_addr
Address to bind (default: 0.0.0.0)
.It network_port
Port to bind (default: 5109)
.It server_code
Lock code needed when connecting to the server for the first time.
.It server_socket
Location of the unix socket. (default: /tmp/istatd.sock)
.It server_pid
Location of the pid. (default: /var/run/istat/istatd.pid)
.It server_user
User to switch to when entering daemon mode. It's not recommended to use high privilaged users like root due to security reasons. Defaults to root if the user doesn't exist. (default: istat)
.It server_group
Group to switch to when entering daemon mode. Defaults to root if the group doesn't exist. (default: istat)
.It monitor_disk
Can contain search path to device or mount point. When specifying more than one disk, use paranteses around the list:
monitor_disk /dev/sda1
monitor_disk ( /dev/sda1 /dev/sda2 )
.It disk_mount_path_label
Set to 1 if you want to use mount path as label instead of the device name.
.It disk_filesystem_label
Set to 1 if you want to probe the filesystem for disk label, will override the mount path and device name.
.It disk_rename_label
Set custom disk label. Will override all other labels. You can use either the device name or mount path:
disk_rename_label /dev/sda1 "root"
disk_rename_label /home "home"
.El
.Sh SEE ALSO
.Xr istatd 1

View File

@@ -0,0 +1,5 @@
#
# istatserver_generated.conf: Configuration for istatserver
# this file is generated by istatserver
# do not modify