05.02.2013 Views

opsi manual opsi version 4.0.2 - opsi Download - uib

opsi manual opsi version 4.0.2 - opsi Download - uib

opsi manual opsi version 4.0.2 - opsi Download - uib

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>opsi</strong> <strong>manual</strong> <strong>opsi</strong> <strong>version</strong> <strong>4.0.2</strong><br />

165 / 193<br />

The usage is optional. If a client may be not connected by the <strong>opsi</strong> configuration server directly, you will here write<br />

down from which depot server the client can be contacted.<br />

To make it easier to create the configuration files for your large number of <strong>opsi</strong> clients, you may run the following<br />

script on your <strong>opsi</strong> configuration server:<br />

#!/usr/bin/env python<br />

from OPSI.Backend.BackendManager import *<br />

template = ’’’<br />

define host {<br />

use <strong>opsi</strong>-client-tmpl<br />

host_name %hostId%<br />

hostgroups <strong>opsi</strong>-clients<br />

alias %hostId%<br />

address %hostId%<br />

}<br />

’’’<br />

backend = BackendManager(<br />

dispatchConfigFile = u’/etc/<strong>opsi</strong>/backendManager/dispatch.conf’,<br />

backendConfigDir = u’/etc/<strong>opsi</strong>/backends’,<br />

extensionConfigDir = u’/etc/<strong>opsi</strong>/backendManager/extend.d’,<br />

)<br />

hosts = backend.host_getObjects(type="OpsiClient")<br />

for host in hosts:<br />

filename = "%s.cfg" % host.id<br />

entry = template.replace("%hostId%",host.id)<br />

f = open(filename, ’w’)<br />

f.write(entry)<br />

f.close()<br />

20.5.7 <strong>opsi</strong> command configuration: <strong>opsi</strong>commands.cfg<br />

Now we have to define which of the check commands, which are described before, we want to use. You should do this<br />

in a file named <strong>opsi</strong>commands.cfg.<br />

This is just an example which you may change to your needs:<br />

First let us explain the structure of the entries:<br />

define command{<br />

command_name check_<strong>opsi</strong>_clientstatus<br />

command_line $USER1$/check_<strong>opsi</strong> -H $_HOSTCONFIGSERVER$ -P $_HOSTCONFIGSERVERPORT$ -u $USER2$ -p \<br />

$USER3$ -t checkClientStatus -c $HOSTADDRESS$<br />

}<br />

The command_name will be used by other configuration files. The option command_line defines the command and all<br />

used arguments.<br />

Based on this pattern we create now the file <strong>opsi</strong>commands.cfg:<br />

define command {<br />

command_name check_<strong>opsi</strong>webservice<br />

command_line /usr/lib/nagios/plugins/check_<strong>opsi</strong> -H $HOSTADDRESS$ -P 4447 -u $USER2$ -p $USER3$ -t \<br />

checkOpsiWebservice<br />

}<br />

define command {<br />

command_name check_<strong>opsi</strong>diskusage<br />

command_line /usr/lib/nagios/plugins/check_<strong>opsi</strong> -H $HOSTADDRESS$ -P $_HOSTCONFIGSERVERPORT$ -u $USER2$ -p \<br />

$USER3$ -t checkOpsiDiskUsage<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!