diff --git a/appmonitor/appmonitor.py b/appmonitor/appmonitor.py index 7ceb3c1..695b399 100644 --- a/appmonitor/appmonitor.py +++ b/appmonitor/appmonitor.py @@ -89,10 +89,10 @@ def influxdb_updater_thread(self): ',application=' + app +\ ' value=' + str(insert[dev][app]['KbpsUp']) +\ ' ' + str(insert[dev][app]['TsEnd']) + '000000000' + '\n' - data = data.encode() - req = urllib.request.Request(self.url, data, self.header) - with urllib.request.urlopen(req) as response: - self.printF('OK' if response.getcode()==204 else 'Unexpected:'+str(response.getcode())) + data = data.encode() + req = urllib.request.Request(self.url, data, self.header) + with urllib.request.urlopen(req) as response: + self.printF('OK' if response.getcode()==204 else 'Unexpected:'+str(response.getcode())) except Exception as e: self.printF("EXCEPTION: influxdb_updater_thread {0}".format(e)) self.influxdb_queue.task_done() diff --git a/cron-netmicroscope-daemon b/cron-netmicroscope-daemon new file mode 100644 index 0000000..c8e2006 --- /dev/null +++ b/cron-netmicroscope-daemon @@ -0,0 +1 @@ +@reboot root /usr/local/bin/nmd start > /tmp/nmd.log diff --git a/cron-nm b/cron-nm deleted file mode 100644 index 1b5f805..0000000 --- a/cron-nm +++ /dev/null @@ -1 +0,0 @@ -@reboot root cd /home/gmartins/; /sbin/ifconfig >/tmp/ifconfig.txt ; sleep 30; ./nm.sh >/tmp/nm.sh.log 2>&1 diff --git a/nm.sh b/nm.sh index 91763f3..9d7a70e 100755 --- a/nm.sh +++ b/nm.sh @@ -2,7 +2,3 @@ cd nm/src/github.com/noise-lab/netmicroscope/cmd/netmicroscope ./nm.sh -cd - -cd nm/netmicroscope-daemon/ -. venv/bin/activate -./nmd start diff --git a/nmd b/nmd index f5c975a..d4ee033 100755 --- a/nmd +++ b/nmd @@ -12,7 +12,7 @@ from appmonitor.appmonitor import AppMonitor #TODO: move this to setup.py __name__ = "netmicroscope-daemon", -__version__ = "0.9.8" +__version__ = "0.9.9" __author__ = "Guilherme Martins", PROGNAME = 'appmonitor' diff --git a/package/deb/netmicroscope-daemon/DEBIAN/control b/package/deb/netmicroscope-daemon/DEBIAN/control index 726a87e..7da2e71 100644 --- a/package/deb/netmicroscope-daemon/DEBIAN/control +++ b/package/deb/netmicroscope-daemon/DEBIAN/control @@ -1,5 +1,5 @@ Package: netmicroscope-daemon -Version: 0.9.8 +Version: 0.9.9 Section: custom Priority: optional Architecture: all diff --git a/package/deb/netmicroscope-daemon/etc/cron.d/cron-nm b/package/deb/netmicroscope-daemon/etc/cron.d/cron-nm deleted file mode 100644 index 1b5f805..0000000 --- a/package/deb/netmicroscope-daemon/etc/cron.d/cron-nm +++ /dev/null @@ -1 +0,0 @@ -@reboot root cd /home/gmartins/; /sbin/ifconfig >/tmp/ifconfig.txt ; sleep 30; ./nm.sh >/tmp/nm.sh.log 2>&1