Image 01
profile-image

jsaathof

Jurriaan Saathof , Netherlands
test
Nagios Plasmoid

Plasma 4 Widgets 11 comments

Score 74.3%
Feb 25 2011
I created a patch for storing multiple (different) passwords in kwallet (fixed password reading since a change in kwallet API in KDE4.4). Hope you find it useful...

I also added the KDE4.4 patches supplied earlier by logrus.

Sorry for the formatting of the patch. Lines starting with an exclamation mark are the altered or added lines. Send me a message and I will send the patch in proper format.


diff -crB ../orig/contents/code/main.py ../nagios.plasmoid/contents/code/main.py
*** ../orig/contents/code/main.py 2009-10-26 02:22:01.000000000 +0100
--- ../nagios.plasmoid/contents/code/main.py 2010-05-20 15:24:15.821869531 +0200
***************
*** 189,195 ****

self.nagios_server.nagios_url = str(gc.readEntry("nagios_url", QVariant("http://www.example.com/nagios/")).toString())

self.nagios_server.nagios_cgi_url = str(gc.readEntry("nagios_cgi_url",QVariant("http://www.example.com/cgi-bin/nagios3/")).toString())
self.nagios_server.username = str(gc.readEntry("username", QVariant("username")).toString())
! self.nagios_server.password = None
self.nagios_server.use_proxy_yes = bool(gc.readEntry("use_proxy_yes", QVariant(True)).toBool())
self.nagios_server.use_proxy_no = bool(gc.readEntry("use_proxy_no", QVariant(False)).toBool())
self.nagios_server.debug = bool(gc.readEntry("debug", QVariant(False)).toBool())
--- 189,195 ----
self.nagios_server.nagios_url = str(gc.readEntry("nagios_url", QVariant("http://www.example.com/nagios/")).toString())
self.nagios_server.nagios_cgi_url = str(gc.readEntry("nagios_cgi_url",QVariant("http://www.example.com/cgi-bin/nagios3/")).toString())
self.nagios_server.username = str(gc.readEntry("username", QVariant("username")).toString())
! self.nagios_server.password = "None"
self.nagios_server.use_proxy_yes = bool(gc.readEntry("use_proxy_yes", QVariant(True)).toBool())
self.nagios_server.use_proxy_no = bool(gc.readEntry("use_proxy_no", QVariant(False)).toBool())
self.nagios_server.debug = bool(gc.readEntry("debug", QVariant(False)).toBool())
***************
*** 207,213 ****
# Get passwords from wallet
self.wallet.setFolder("nagios-plasmoid")
passwd = QString()
! self.wallet.readPassword(self.nagios_server.username, passwd)
self.nagios_server.password = unicode(passwd)

# Now start checking for emails
--- 207,217 ----
# Get passwords from wallet
self.wallet.setFolder("nagios-plasmoid")
passwd = QString()
! try:
! # KDE 4.4
! passwd = self.wallet.readPassword(self.nagios_server.username + "@" + self.nagios_server.name)[1]
! except:
! self.wallet.readPassword(self.nagios_server.username + "@" + self.nagios_server.name, passwd)
self.nagios_server.password = unicode(passwd)

# Now start checking for emails
***************
*** 231,237 ****

def checkNow(self):
if self.nagios_server.isChecking :
! self.debug("checkNow: nagios-servier is already checking")
return False
self.debug("checkNow: scheduling check")
self.stopTimer()
--- 235,241 ----

def checkNow(self):
if self.nagios_server.isChecking :
! self.debug("checkNow: nagios-server is already checking")
return False
self.debug("checkNow: scheduling check")
self.stopTimer()
***************
*** 304,310 ****
if not wallet.hasFolder("nagios-plasmoid"):
wallet.createFolder("nagios-plasmoid")
wallet.setFolder("nagios-plasmoid")
! wallet.writePassword(self.configParameters.getUsername(), self.configParameters.getPassword())
else:
# KWallet disabled, we don't do anything...
pass
--- 308,314 ----
if not wallet.hasFolder("nagios-plasmoid"):
wallet.createFolder("nagios-plasmoid")
wallet.setFolder("nagios-plasmoid")
! wallet.writePassword(self.configParameters.getUsername() + "@" + self.configParameters.getServerName(), self.configParameters.getPassword())
else:
# KWallet disabled, we don't do anything...
pass
diff -crB ../orig/contents/code/NagiosUI.py ../nagios.plasmoid/contents/code/NagiosUI.py
*** ../orig/contents/code/NagiosUI.py 2009-10-26 02:07:53.000000000 +0100
--- ../nagios.plasmoid/contents/code/NagiosUI.py 2010-05-20 10:57:39.097863605 +0200
***************
*** 144,150 ****


def openNagios(self):
! self.openUrl(self.plasmoid.nagios_server.nagios_cgi_url)

def openNagiosHosts(self):
self.openUrl(self.plasmoid.nagios_server.nagios_cgi_url + "/status.cgi?hostgroup=all&style=hostdetail&hoststatustypes=12")
--- 144,150 ----


def openNagios(self):
! self.openUrl(self.plasmoid.nagios_server.nagios_cgi_url + "/status.cgi?host=all&servicestatustypes=28")

def openNagiosHosts(self):
self.openUrl(self.plasmoid.nagios_server.nagios_cgi_url + "/status.cgi?hostgroup=all&style=hostdetail&hoststatustypes=12")
diff -crB ../orig/metadata.desktop ../nagios.plasmoid/metadata.desktop
*** ../orig/metadata.desktop 2009-10-24 20:50:18.000000000 +0200
--- ../nagios.plasmoid/metadata.desktop 2010-05-20 16:08:21.581888262 +0200
***************
*** 7,12 ****
--- 7,13 ----
Icon=nagios-plasmoid-128.png
X-Plasma-API=python
X-Plasma-MainScript=code/main.py
+ X-Plasma-NotificationArea=true
X-KDE-PluginInfo-Author=Nik Lutz
X-KDE-PluginInfo-Email=nik.lutz@gmail.com
X-KDE-PluginInfo-Name=nagios-plasmoid
***************
*** 15,18 ****
X-KDE-PluginInfo-Category=Online Services
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
! X-KDE-PluginInfo-EnabledByDefault=true
\ No newline at end of file
--- 16,19 ----
X-KDE-PluginInfo-Category=Online Services
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
! X-KDE-PluginInfo-EnabledByDefault=true
- May 20 2010